mirror of
https://github.com/SerenityOS/serenity
synced 2024-09-06 17:06:31 +00:00
AK: Move the userspace SharedBuffer from LibC to AK
This always felt out-of-place in LibC.
This commit is contained in:
parent
38f93ef13b
commit
fc86460134
|
@ -1,9 +1,11 @@
|
|||
#include <AK/SharedBuffer.h>
|
||||
#include <AK/kmalloc.h>
|
||||
#include <Kernel/Syscall.h>
|
||||
#include <SharedBuffer.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
RefPtr<SharedBuffer> SharedBuffer::create_with_size(int size)
|
||||
{
|
||||
void* data;
|
||||
|
@ -35,7 +37,6 @@ bool SharedBuffer::share_globally()
|
|||
return true;
|
||||
}
|
||||
|
||||
|
||||
RefPtr<SharedBuffer> SharedBuffer::create_from_shared_buffer_id(int shared_buffer_id)
|
||||
{
|
||||
void* data = get_shared_buffer(shared_buffer_id);
|
||||
|
@ -92,3 +93,5 @@ bool SharedBuffer::set_nonvolatile()
|
|||
return false;
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,8 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
|
||||
namespace AK {
|
||||
|
||||
class SharedBuffer : public RefCounted<SharedBuffer> {
|
||||
public:
|
||||
static RefPtr<SharedBuffer> create_with_size(int);
|
||||
|
@ -26,3 +28,7 @@ private:
|
|||
int m_size { 0 };
|
||||
void* m_data;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
using AK::SharedBuffer;
|
|
@ -3,7 +3,7 @@
|
|||
#include <AK/JsonArray.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/JsonValue.h>
|
||||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibCore/CProcessStatisticsReader.h>
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include "TaskbarWindow.h"
|
||||
#include "TaskbarButton.h"
|
||||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibCore/CConfigFile.h>
|
||||
#include <LibGUI/GBoxLayout.h>
|
||||
#include <LibGUI/GButton.h>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include <AK/ByteBuffer.h>
|
||||
#include <AK/Types.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
|
||||
// A single sample in an audio buffer.
|
||||
// Values are floating point, and should range from -1.0 to +1.0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <AK/SharedBuffer.h>
|
||||
#include <LibAudio/ABuffer.h>
|
||||
#include <LibAudio/AClientConnection.h>
|
||||
#include <SharedBuffer.h>
|
||||
|
||||
AClientConnection::AClientConnection()
|
||||
: IServerConnection(*this, "/tmp/portal/audio")
|
||||
|
|
|
@ -9,10 +9,10 @@ AK_OBJS = \
|
|||
../../AK/JsonParser.o \
|
||||
../../AK/LogStream.o \
|
||||
../../AK/MappedFile.o \
|
||||
../../AK/SharedBuffer.o \
|
||||
../../AK/Utf8View.o
|
||||
|
||||
LIBC_OBJS = \
|
||||
SharedBuffer.o \
|
||||
stdio.o \
|
||||
unistd.o \
|
||||
string.o \
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
#include <AK/MappedFile.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <AK/String.h>
|
||||
#include <AK/StringView.h>
|
||||
#include <SharedBuffer.h>
|
||||
|
||||
class GraphicsBitmap : public RefCounted<GraphicsBitmap> {
|
||||
public:
|
||||
|
@ -105,7 +105,8 @@ public:
|
|||
[[nodiscard]] bool set_nonvolatile();
|
||||
|
||||
private:
|
||||
enum class Purgeable { No, Yes };
|
||||
enum class Purgeable { No,
|
||||
Yes };
|
||||
GraphicsBitmap(Format, const Size&, Purgeable);
|
||||
GraphicsBitmap(Format, const Size&, size_t pitch, RGBA32*);
|
||||
GraphicsBitmap(Format, const Size&, MappedFile&&);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <AK/Types.h>
|
||||
#include <LibDraw/Color.h>
|
||||
#include <SharedBuffer.h>
|
||||
|
||||
enum class ColorRole {
|
||||
NoRole,
|
||||
|
|
|
@ -6,6 +6,10 @@
|
|||
#include <LibDraw/Palette.h>
|
||||
#include <LibGUI/GShortcut.h>
|
||||
|
||||
namespace AK {
|
||||
class SharedBuffer;
|
||||
}
|
||||
|
||||
class CEventLoop;
|
||||
class GAction;
|
||||
class GKeyEvent;
|
||||
|
@ -14,7 +18,6 @@ class GWindow;
|
|||
class GWindowServerConnection;
|
||||
class Palette;
|
||||
class Point;
|
||||
class SharedBuffer;
|
||||
|
||||
class GApplication {
|
||||
public:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibGUI/GClipboard.h>
|
||||
#include <LibGUI/GWindowServerConnection.h>
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include <AK/HashMap.h>
|
||||
#include <AK/JsonObject.h>
|
||||
#include <AK/NeverDestroyed.h>
|
||||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibC/stdio.h>
|
||||
#include <LibC/stdlib.h>
|
||||
#include <LibC/unistd.h>
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibCore/CFile.h>
|
||||
#include <LibHTML/ResourceLoader.h>
|
||||
#include <LibProtocol/Client.h>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#include <AK/SharedBuffer.h>
|
||||
#include <LibProtocol/Client.h>
|
||||
#include <LibProtocol/Download.h>
|
||||
#include <SharedBuffer.h>
|
||||
|
||||
namespace LibProtocol {
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibProtocol/Client.h>
|
||||
#include <LibProtocol/Download.h>
|
||||
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
#include <AK/RefCounted.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
|
||||
namespace AK {
|
||||
class SharedBuffer;
|
||||
}
|
||||
|
||||
namespace LibProtocol {
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#include "ASClientConnection.h"
|
||||
#include "ASMixer.h"
|
||||
#include "AudioClientEndpoint.h"
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibAudio/ABuffer.h>
|
||||
#include <LibCore/CEventLoop.h>
|
||||
#include <SharedBuffer.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/socket.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#include <ProtocolServer/PSClientConnection.h>
|
||||
#include <ProtocolServer/Protocol.h>
|
||||
#include <ProtocolServer/ProtocolClientEndpoint.h>
|
||||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
|
||||
static HashMap<int, RefPtr<PSClientConnection>> s_connections;
|
||||
|
||||
|
|
|
@ -4,8 +4,11 @@
|
|||
#include <LibIPC/IClientConnection.h>
|
||||
#include <ProtocolServer/ProtocolServerEndpoint.h>
|
||||
|
||||
class Download;
|
||||
namespace AK {
|
||||
class SharedBuffer;
|
||||
}
|
||||
|
||||
class Download;
|
||||
|
||||
class PSClientConnection final : public IClientConnection<ProtocolServerEndpoint>
|
||||
, public ProtocolServerEndpoint {
|
||||
|
@ -26,5 +29,5 @@ private:
|
|||
virtual OwnPtr<ProtocolServer::StopDownloadResponse> handle(const ProtocolServer::StopDownload&) override;
|
||||
virtual OwnPtr<ProtocolServer::DisownSharedBufferResponse> handle(const ProtocolServer::DisownSharedBuffer&) override;
|
||||
|
||||
HashMap<i32, RefPtr<SharedBuffer>> m_shared_buffers;
|
||||
HashMap<i32, RefPtr<AK::SharedBuffer>> m_shared_buffers;
|
||||
};
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibDraw/GraphicsBitmap.h>
|
||||
#include <LibDraw/SystemTheme.h>
|
||||
#include <SharedBuffer.h>
|
||||
#include <WindowServer/WSClientConnection.h>
|
||||
#include <WindowServer/WSClipboard.h>
|
||||
#include <WindowServer/WSCompositor.h>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <AK/String.h>
|
||||
#include <SharedBuffer.h>
|
||||
|
||||
class WSClipboard {
|
||||
public:
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#include <AK/URL.h>
|
||||
#include <LibC/SharedBuffer.h>
|
||||
#include <AK/SharedBuffer.h>
|
||||
#include <LibCore/CEventLoop.h>
|
||||
#include <LibProtocol/Client.h>
|
||||
#include <LibProtocol/Download.h>
|
||||
|
|
Loading…
Reference in a new issue