diff options
author | Andreas Kling <awesomekling@gmail.com> | 2019-02-17 08:58:42 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2019-02-17 08:58:42 +0100 |
commit | f02a49023006e43f9fbbd9aef7383ae20901742d (patch) | |
tree | d07142e88ee3aa11aeba867bfd96aa68ce450f3e /WindowServer | |
parent | 9a39c01551dc8880a49ac86783011199187f6e7d (diff) | |
download | serenity-f02a49023006e43f9fbbd9aef7383ae20901742d.zip |
WindowServer: Get rid of unnecessary messaging indirection.
Diffstat (limited to 'WindowServer')
-rw-r--r-- | WindowServer/WSClientConnection.cpp | 28 | ||||
-rw-r--r-- | WindowServer/WSMessageLoop.cpp | 8 | ||||
-rw-r--r-- | WindowServer/WSMessageLoop.h | 1 |
3 files changed, 14 insertions, 23 deletions
diff --git a/WindowServer/WSClientConnection.cpp b/WindowServer/WSClientConnection.cpp index f34cab763e..3df245d655 100644 --- a/WindowServer/WSClientConnection.cpp +++ b/WindowServer/WSClientConnection.cpp @@ -59,7 +59,7 @@ void WSClientConnection::post_error(const String& error_message) ASSERT(error_message.length() < sizeof(message.text)); strcpy(message.text, error_message.characters()); message.text_length = error_message.length(); - WSMessageLoop::the().post_message_to_client(m_client_id, message); + post_message(message); } void WSClientConnection::post_message(const WSAPI_ServerMessage& message) @@ -110,7 +110,7 @@ void WSClientConnection::handle_request(WSAPICreateMenubarRequest& request) WSAPI_ServerMessage response; response.type = WSAPI_ServerMessage::Type::DidCreateMenubar; response.menu.menubar_id = menubar_id; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPIDestroyMenubarRequest& request) @@ -127,7 +127,7 @@ void WSClientConnection::handle_request(WSAPIDestroyMenubarRequest& request) WSAPI_ServerMessage response; response.type = WSAPI_ServerMessage::Type::DidDestroyMenubar; response.menu.menubar_id = menubar_id; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPICreateMenuRequest& request) @@ -138,7 +138,7 @@ void WSClientConnection::handle_request(WSAPICreateMenuRequest& request) WSAPI_ServerMessage response; response.type = WSAPI_ServerMessage::Type::DidCreateMenu; response.menu.menu_id = menu_id; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPIDestroyMenuRequest& request) @@ -155,7 +155,7 @@ void WSClientConnection::handle_request(WSAPIDestroyMenuRequest& request) WSAPI_ServerMessage response; response.type = WSAPI_ServerMessage::Type::DidDestroyMenu; response.menu.menu_id = menu_id; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPISetApplicationMenubarRequest& request) @@ -172,7 +172,7 @@ void WSClientConnection::handle_request(WSAPISetApplicationMenubarRequest& reque WSAPI_ServerMessage response; response.type = WSAPI_ServerMessage::Type::DidSetApplicationMenubar; response.menu.menubar_id = menubar_id; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPIAddMenuToMenubarRequest& request) @@ -196,7 +196,7 @@ void WSClientConnection::handle_request(WSAPIAddMenuToMenubarRequest& request) response.type = WSAPI_ServerMessage::Type::DidAddMenuToMenubar; response.menu.menubar_id = menubar_id; response.menu.menu_id = menu_id; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPIAddMenuItemRequest& request) @@ -215,7 +215,7 @@ void WSClientConnection::handle_request(WSAPIAddMenuItemRequest& request) response.type = WSAPI_ServerMessage::Type::DidAddMenuItem; response.menu.menu_id = menu_id; response.menu.identifier = identifier; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPIAddMenuSeparatorRequest& request) @@ -231,7 +231,7 @@ void WSClientConnection::handle_request(WSAPIAddMenuSeparatorRequest& request) WSAPI_ServerMessage response; response.type = WSAPI_ServerMessage::Type::DidAddMenuSeparator; response.menu.menu_id = menu_id; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPISetWindowTitleRequest& request) @@ -261,7 +261,7 @@ void WSClientConnection::handle_request(WSAPIGetWindowTitleRequest& request) ASSERT(window.title().length() < sizeof(response.text)); strcpy(response.text, window.title().characters()); response.text_length = window.title().length(); - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPISetWindowRectRequest& request) @@ -289,7 +289,7 @@ void WSClientConnection::handle_request(WSAPIGetWindowRectRequest& request) response.type = WSAPI_ServerMessage::Type::DidGetWindowRect; response.window_id = window.window_id(); response.window.rect = window.rect(); - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPICreateWindowRequest& request) @@ -302,7 +302,7 @@ void WSClientConnection::handle_request(WSAPICreateWindowRequest& request) WSAPI_ServerMessage response; response.type = WSAPI_ServerMessage::Type::DidCreateWindow; response.window_id = window_id; - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPIDestroyWindowRequest& request) @@ -330,7 +330,7 @@ void WSClientConnection::handle_request(WSAPIInvalidateRectRequest& request) response.type = WSAPI_ServerMessage::Type::Paint; response.window_id = window_id; response.paint.rect = request.rect(); - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPIDidFinishPaintingNotification& request) @@ -363,7 +363,7 @@ void WSClientConnection::handle_request(WSAPIGetWindowBackingStoreRequest& reque response.backing.pitch = backing_store->pitch(); response.backing.size = backing_store->size(); response.backing.shared_buffer_id = backing_store->shared_buffer_id(); - WSMessageLoop::the().post_message_to_client(request.client_id(), response); + post_message(response); } void WSClientConnection::handle_request(WSAPISetGlobalCursorTrackingRequest& request) diff --git a/WindowServer/WSMessageLoop.cpp b/WindowServer/WSMessageLoop.cpp index df0ed7bf3f..6cf92b8374 100644 --- a/WindowServer/WSMessageLoop.cpp +++ b/WindowServer/WSMessageLoop.cpp @@ -76,14 +76,6 @@ int WSMessageLoop::exec() } } -void WSMessageLoop::post_message_to_client(int client_id, const WSAPI_ServerMessage& message) -{ - auto* client = WSClientConnection::from_client_id(client_id); - if (!client) - return; - client->post_message(message); -} - void WSMessageLoop::post_message(WSMessageReceiver* receiver, OwnPtr<WSMessage>&& message) { #ifdef WSEVENTLOOP_DEBUG diff --git a/WindowServer/WSMessageLoop.h b/WindowServer/WSMessageLoop.h index 0bf69bd461..5851c8a5db 100644 --- a/WindowServer/WSMessageLoop.h +++ b/WindowServer/WSMessageLoop.h @@ -26,7 +26,6 @@ public: int start_timer(int ms, Function<void()>&&); int stop_timer(int timer_id); - void post_message_to_client(int client_id, const WSAPI_ServerMessage&); void on_receive_from_client(int client_id, const WSAPI_ClientMessage&); void notify_client_disconnected(int client_id); |