diff options
author | Andreas Kling <kling@serenityos.org> | 2021-01-16 17:22:35 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-01-16 17:22:35 +0100 |
commit | d846808122c272b173f1f8f7169d78d1e29bd3c7 (patch) | |
tree | a09a7f513fb211d064aca14a971fcc4f40268d9b /Userland | |
parent | 04f95f91601731ee4970a7f1252c8a2b2bde149a (diff) | |
download | serenity-d846808122c272b173f1f8f7169d78d1e29bd3c7.zip |
LibWeb: Port the WebContent service to Core::AnonymousBuffer for themes
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Services/WebContent/ClientConnection.cpp | 9 | ||||
-rw-r--r-- | Userland/Services/WebContent/PageHost.cpp | 6 | ||||
-rw-r--r-- | Userland/Services/WebContent/WebContentServer.ipc | 2 | ||||
-rw-r--r-- | Userland/Services/WebContent/main.cpp | 2 |
4 files changed, 7 insertions, 12 deletions
diff --git a/Userland/Services/WebContent/ClientConnection.cpp b/Userland/Services/WebContent/ClientConnection.cpp index 46b38f440b..2f5b44f95a 100644 --- a/Userland/Services/WebContent/ClientConnection.cpp +++ b/Userland/Services/WebContent/ClientConnection.cpp @@ -73,13 +73,8 @@ OwnPtr<Messages::WebContentServer::GreetResponse> ClientConnection::handle(const void ClientConnection::handle(const Messages::WebContentServer::UpdateSystemTheme& message) { - auto shared_buffer = SharedBuffer::create_from_shbuf_id(message.shbuf_id()); - if (!shared_buffer) { - dbgln("WebContentServer::UpdateSystemTheme: SharedBuffer already gone! Ignoring :^)"); - return; - } - Gfx::set_system_theme(*shared_buffer); - auto impl = Gfx::PaletteImpl::create_with_shared_buffer(*shared_buffer); + Gfx::set_system_theme(message.theme_buffer()); + auto impl = Gfx::PaletteImpl::create_with_anonymous_buffer(message.theme_buffer()); m_page_host->set_palette_impl(*impl); } diff --git a/Userland/Services/WebContent/PageHost.cpp b/Userland/Services/WebContent/PageHost.cpp index 11641235eb..c76f1b02cd 100644 --- a/Userland/Services/WebContent/PageHost.cpp +++ b/Userland/Services/WebContent/PageHost.cpp @@ -49,11 +49,11 @@ PageHost::~PageHost() void PageHost::setup_palette() { // FIXME: Get the proper palette from our peer somehow - auto buffer = SharedBuffer::create_with_size(sizeof(Gfx::SystemTheme)); - auto* theme = buffer->data<Gfx::SystemTheme>(); + auto buffer = Core::AnonymousBuffer::create_with_size(sizeof(Gfx::SystemTheme)); + auto* theme = buffer.data<Gfx::SystemTheme>(); theme->color[(int)Gfx::ColorRole::Window] = Color::Magenta; theme->color[(int)Gfx::ColorRole::WindowText] = Color::Cyan; - m_palette_impl = Gfx::PaletteImpl::create_with_shared_buffer(*buffer); + m_palette_impl = Gfx::PaletteImpl::create_with_anonymous_buffer(buffer); } Gfx::Palette PageHost::palette() const diff --git a/Userland/Services/WebContent/WebContentServer.ipc b/Userland/Services/WebContent/WebContentServer.ipc index 143650dab7..cb2ff26b85 100644 --- a/Userland/Services/WebContent/WebContentServer.ipc +++ b/Userland/Services/WebContent/WebContentServer.ipc @@ -2,7 +2,7 @@ endpoint WebContentServer = 89 { Greet(i32 client_pid) => (i32 client_id, i32 server_pid) - UpdateSystemTheme(i32 shbuf_id) =| + UpdateSystemTheme(Core::AnonymousBuffer theme_buffer) =| LoadURL(URL url) =| LoadHTML(String html, URL url) =| diff --git a/Userland/Services/WebContent/main.cpp b/Userland/Services/WebContent/main.cpp index 20b6f8daa0..65c79ced7b 100644 --- a/Userland/Services/WebContent/main.cpp +++ b/Userland/Services/WebContent/main.cpp @@ -32,7 +32,7 @@ int main(int, char**) { Core::EventLoop event_loop; - if (pledge("stdio sendfd shared_buffer accept unix rpath recvfd", nullptr) < 0) { + if (pledge("stdio recvfd sendfd shared_buffer accept unix rpath recvfd", nullptr) < 0) { perror("pledge"); return 1; } |