mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:07:45 +00:00
Kernel+LibC: Rename shared buffer syscalls to use a prefix
This feels a lot more consistent and Unixy: create_shared_buffer() => shbuf_create() share_buffer_with() => shbuf_allow_pid() share_buffer_globally() => shbuf_allow_all() get_shared_buffer() => shbuf_get() release_shared_buffer() => shbuf_release() seal_shared_buffer() => shbuf_seal() get_shared_buffer_size() => shbuf_get_size() Also, "shared_buffer_id" is shortened to "shbuf_id" all around.
This commit is contained in:
parent
8460d02651
commit
f72e5bbb17
36 changed files with 549 additions and 549 deletions
|
@ -92,7 +92,7 @@ OwnPtr<Messages::AudioServer::SetMainMixVolumeResponse> ASClientConnection::hand
|
|||
|
||||
OwnPtr<Messages::AudioServer::EnqueueBufferResponse> ASClientConnection::handle(const Messages::AudioServer::EnqueueBuffer& message)
|
||||
{
|
||||
auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.buffer_id());
|
||||
auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.buffer_id());
|
||||
if (!shared_buffer) {
|
||||
// FIXME: The shared buffer should have been retrieved for us already.
|
||||
// We don't want to do IPC error checking at this layer.
|
||||
|
|
|
@ -64,7 +64,7 @@ public:
|
|||
++m_played_samples;
|
||||
|
||||
if (m_position >= m_current->sample_count()) {
|
||||
m_client->did_finish_playing_buffer({}, m_current->shared_buffer_id());
|
||||
m_client->did_finish_playing_buffer({}, m_current->shbuf_id());
|
||||
m_current = nullptr;
|
||||
m_position = 0;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public:
|
|||
int get_playing_buffer() const
|
||||
{
|
||||
if (m_current)
|
||||
return m_current->shared_buffer_id();
|
||||
return m_current->shbuf_id();
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
|
|
@ -82,9 +82,9 @@ void PSClientConnection::did_finish_download(Badge<Download>, Download& download
|
|||
memcpy(buffer->data(), download.payload().data(), download.payload().size());
|
||||
buffer->seal();
|
||||
buffer->share_with(client_pid());
|
||||
m_shared_buffers.set(buffer->shared_buffer_id(), buffer);
|
||||
m_shared_buffers.set(buffer->shbuf_id(), buffer);
|
||||
}
|
||||
post_message(Messages::ProtocolClient::DownloadFinished(download.id(), success, download.total_size(), buffer ? buffer->shared_buffer_id() : -1));
|
||||
post_message(Messages::ProtocolClient::DownloadFinished(download.id(), success, download.total_size(), buffer ? buffer->shbuf_id() : -1));
|
||||
}
|
||||
|
||||
void PSClientConnection::did_progress_download(Badge<Download>, Download& download)
|
||||
|
@ -99,6 +99,6 @@ OwnPtr<Messages::ProtocolServer::GreetResponse> PSClientConnection::handle(const
|
|||
|
||||
OwnPtr<Messages::ProtocolServer::DisownSharedBufferResponse> PSClientConnection::handle(const Messages::ProtocolServer::DisownSharedBuffer& message)
|
||||
{
|
||||
m_shared_buffers.remove(message.shared_buffer_id());
|
||||
m_shared_buffers.remove(message.shbuf_id());
|
||||
return make<Messages::ProtocolServer::DisownSharedBufferResponse>();
|
||||
}
|
||||
|
|
|
@ -2,5 +2,5 @@ endpoint ProtocolClient = 13
|
|||
{
|
||||
// Download notifications
|
||||
DownloadProgress(i32 download_id, u32 total_size, u32 downloaded_size) =|
|
||||
DownloadFinished(i32 download_id, bool success, u32 total_size, i32 shared_buffer_id) =|
|
||||
DownloadFinished(i32 download_id, bool success, u32 total_size, i32 shbuf_id) =|
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ endpoint ProtocolServer = 9
|
|||
Greet() => (i32 client_id)
|
||||
|
||||
// FIXME: It would be nice if the kernel provided a way to avoid this
|
||||
DisownSharedBuffer(i32 shared_buffer_id) => ()
|
||||
DisownSharedBuffer(i32 shbuf_id) => ()
|
||||
|
||||
// Test if a specific protocol is supported, e.g "http"
|
||||
IsSupportedProtocol(String protocol) => (bool supported)
|
||||
|
|
|
@ -193,7 +193,7 @@ OwnPtr<Messages::WindowServer::AddMenuItemResponse> ClientConnection::handle(con
|
|||
auto& menu = *(*it).value;
|
||||
auto menu_item = make<MenuItem>(menu, identifier, message.text(), message.shortcut(), message.enabled(), message.checkable(), message.checked());
|
||||
if (message.icon_buffer_id() != -1) {
|
||||
auto icon_buffer = SharedBuffer::create_from_shared_buffer_id(message.icon_buffer_id());
|
||||
auto icon_buffer = SharedBuffer::create_from_shbuf_id(message.icon_buffer_id());
|
||||
if (!icon_buffer)
|
||||
return nullptr;
|
||||
// FIXME: Verify that the icon buffer can accomodate a 16x16 bitmap view.
|
||||
|
@ -349,7 +349,7 @@ OwnPtr<Messages::WindowServer::SetWindowIconBitmapResponse> ClientConnection::ha
|
|||
}
|
||||
auto& window = *(*it).value;
|
||||
|
||||
auto icon_buffer = SharedBuffer::create_from_shared_buffer_id(message.icon_buffer_id());
|
||||
auto icon_buffer = SharedBuffer::create_from_shbuf_id(message.icon_buffer_id());
|
||||
|
||||
if (!icon_buffer) {
|
||||
window.set_default_icon();
|
||||
|
@ -393,7 +393,7 @@ OwnPtr<Messages::WindowServer::GetWindowRectResponse> ClientConnection::handle(c
|
|||
|
||||
OwnPtr<Messages::WindowServer::SetClipboardContentsResponse> ClientConnection::handle(const Messages::WindowServer::SetClipboardContents& message)
|
||||
{
|
||||
auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.shared_buffer_id());
|
||||
auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id());
|
||||
if (!shared_buffer) {
|
||||
did_misbehave("SetClipboardContents: Bad shared buffer ID");
|
||||
return nullptr;
|
||||
|
@ -406,7 +406,7 @@ OwnPtr<Messages::WindowServer::GetClipboardContentsResponse> ClientConnection::h
|
|||
{
|
||||
auto& clipboard = Clipboard::the();
|
||||
|
||||
i32 shared_buffer_id = -1;
|
||||
i32 shbuf_id = -1;
|
||||
if (clipboard.size()) {
|
||||
// FIXME: Optimize case where an app is copy/pasting within itself.
|
||||
// We can just reuse the SharedBuffer then, since it will have the same peer PID.
|
||||
|
@ -416,13 +416,13 @@ OwnPtr<Messages::WindowServer::GetClipboardContentsResponse> ClientConnection::h
|
|||
memcpy(shared_buffer->data(), clipboard.data(), clipboard.size());
|
||||
shared_buffer->seal();
|
||||
shared_buffer->share_with(client_pid());
|
||||
shared_buffer_id = shared_buffer->shared_buffer_id();
|
||||
shbuf_id = shared_buffer->shbuf_id();
|
||||
|
||||
// FIXME: This is a workaround for the fact that SharedBuffers will go away if neither side is retaining them.
|
||||
// After we respond to GetClipboardContents, we have to wait for the client to ref the buffer on his side.
|
||||
m_last_sent_clipboard_content = move(shared_buffer);
|
||||
}
|
||||
return make<Messages::WindowServer::GetClipboardContentsResponse>(shared_buffer_id, clipboard.size(), clipboard.data_type());
|
||||
return make<Messages::WindowServer::GetClipboardContentsResponse>(shbuf_id, clipboard.size(), clipboard.data_type());
|
||||
}
|
||||
|
||||
OwnPtr<Messages::WindowServer::CreateWindowResponse> ClientConnection::handle(const Messages::WindowServer::CreateWindow& message)
|
||||
|
@ -509,10 +509,10 @@ OwnPtr<Messages::WindowServer::SetWindowBackingStoreResponse> ClientConnection::
|
|||
return nullptr;
|
||||
}
|
||||
auto& window = *(*it).value;
|
||||
if (window.last_backing_store() && window.last_backing_store()->shared_buffer_id() == message.shared_buffer_id()) {
|
||||
if (window.last_backing_store() && window.last_backing_store()->shbuf_id() == message.shbuf_id()) {
|
||||
window.swap_backing_stores();
|
||||
} else {
|
||||
auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.shared_buffer_id());
|
||||
auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id());
|
||||
if (!shared_buffer)
|
||||
return make<Messages::WindowServer::SetWindowBackingStoreResponse>();
|
||||
auto backing_store = Gfx::Bitmap::create_with_shared_buffer(
|
||||
|
@ -669,7 +669,7 @@ OwnPtr<Messages::WindowServer::StartDragResponse> ClientConnection::handle(const
|
|||
|
||||
RefPtr<Gfx::Bitmap> bitmap;
|
||||
if (message.bitmap_id() != -1) {
|
||||
auto shared_buffer = SharedBuffer::create_from_shared_buffer_id(message.bitmap_id());
|
||||
auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.bitmap_id());
|
||||
ssize_t size_in_bytes = message.bitmap_size().area() * sizeof(Gfx::RGBA32);
|
||||
if (size_in_bytes > shared_buffer->size()) {
|
||||
did_misbehave("SetAppletBackingStore: Shared buffer is too small for applet size");
|
||||
|
|
|
@ -252,13 +252,13 @@ void WindowManager::tell_wm_listener_about_window_icon(Window& listener, Window&
|
|||
return;
|
||||
if (window.is_internal())
|
||||
return;
|
||||
if (window.icon().shared_buffer_id() == -1)
|
||||
if (window.icon().shbuf_id() == -1)
|
||||
return;
|
||||
dbg() << "WindowServer: Sharing icon buffer " << window.icon().shared_buffer_id() << " with PID " << listener.client()->client_pid();
|
||||
if (share_buffer_with(window.icon().shared_buffer_id(), listener.client()->client_pid()) < 0) {
|
||||
dbg() << "WindowServer: Sharing icon buffer " << window.icon().shbuf_id() << " with PID " << listener.client()->client_pid();
|
||||
if (shbuf_allow_pid(window.icon().shbuf_id(), listener.client()->client_pid()) < 0) {
|
||||
ASSERT_NOT_REACHED();
|
||||
}
|
||||
listener.client()->post_message(Messages::WindowClient::WM_WindowIconBitmapChanged(listener.window_id(), window.client_id(), window.window_id(), window.icon().shared_buffer_id(), window.icon().size()));
|
||||
listener.client()->post_message(Messages::WindowClient::WM_WindowIconBitmapChanged(listener.window_id(), window.client_id(), window.window_id(), window.icon().shbuf_id(), window.icon().size()));
|
||||
}
|
||||
|
||||
void WindowManager::tell_wm_listeners_window_state_changed(Window& window)
|
||||
|
|
|
@ -57,9 +57,9 @@ endpoint WindowServer = 2
|
|||
SetGlobalCursorTracking(i32 window_id, bool enabled) => ()
|
||||
SetWindowOpacity(i32 window_id, float opacity) => ()
|
||||
|
||||
SetWindowBackingStore(i32 window_id, i32 bpp, i32 pitch, i32 shared_buffer_id, bool has_alpha_channel, Gfx::Size size, bool flush_immediately) => ()
|
||||
GetClipboardContents() => (i32 shared_buffer_id, i32 content_size, String content_type)
|
||||
SetClipboardContents(i32 shared_buffer_id, i32 content_size, String content_type) => ()
|
||||
SetWindowBackingStore(i32 window_id, i32 bpp, i32 pitch, i32 shbuf_id, bool has_alpha_channel, Gfx::Size size, bool flush_immediately) => ()
|
||||
GetClipboardContents() => (i32 shbuf_id, i32 content_size, String content_type)
|
||||
SetClipboardContents(i32 shbuf_id, i32 content_size, String content_type) => ()
|
||||
|
||||
WM_SetActiveWindow(i32 client_id, i32 window_id) =|
|
||||
WM_SetWindowMinimized(i32 client_id, i32 window_id, bool minimized) =|
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue