1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:17:35 +00:00

Userland: Rename IPC ClientConnection => ConnectionFromClient

This was done with CLion's automatic rename feature and with:
find . -name ClientConnection.h
    | rename 's/ClientConnection\.h/ConnectionFromClient.h/'

find . -name ClientConnection.cpp
    | rename 's/ClientConnection\.cpp/ConnectionFromClient.cpp/'
This commit is contained in:
Itamar 2022-02-25 12:18:30 +02:00 committed by Andreas Kling
parent efac862570
commit 3a71748e5d
137 changed files with 896 additions and 896 deletions

View file

@ -7,7 +7,7 @@ compile_ipc(WebContentServer.ipc WebContentServerEndpoint.h)
compile_ipc(WebContentClient.ipc WebContentClientEndpoint.h)
set(SOURCES
ClientConnection.cpp
ConnectionFromClient.cpp
ConsoleGlobalObject.cpp
main.cpp
PageHost.cpp

View file

@ -25,58 +25,58 @@
#include <LibWeb/Layout/InitialContainingBlock.h>
#include <LibWeb/Loader/ContentFilter.h>
#include <LibWeb/Loader/ResourceLoader.h>
#include <WebContent/ClientConnection.h>
#include <WebContent/ConnectionFromClient.h>
#include <WebContent/PageHost.h>
#include <WebContent/WebContentClientEndpoint.h>
#include <pthread.h>
namespace WebContent {
ClientConnection::ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
: IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket), 1)
ConnectionFromClient::ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket> socket)
: IPC::ConnectionFromClient<WebContentClientEndpoint, WebContentServerEndpoint>(*this, move(socket), 1)
, m_page_host(PageHost::create(*this))
{
m_paint_flush_timer = Core::Timer::create_single_shot(0, [this] { flush_pending_paint_requests(); });
}
ClientConnection::~ClientConnection()
ConnectionFromClient::~ConnectionFromClient()
{
}
void ClientConnection::die()
void ConnectionFromClient::die()
{
Core::EventLoop::current().quit(0);
}
Web::Page& ClientConnection::page()
Web::Page& ConnectionFromClient::page()
{
return m_page_host->page();
}
const Web::Page& ClientConnection::page() const
const Web::Page& ConnectionFromClient::page() const
{
return m_page_host->page();
}
void ClientConnection::update_system_theme(const Core::AnonymousBuffer& theme_buffer)
void ConnectionFromClient::update_system_theme(const Core::AnonymousBuffer& theme_buffer)
{
Gfx::set_system_theme(theme_buffer);
auto impl = Gfx::PaletteImpl::create_with_anonymous_buffer(theme_buffer);
m_page_host->set_palette_impl(*impl);
}
void ClientConnection::update_system_fonts(String const& default_font_query, String const& fixed_width_font_query)
void ConnectionFromClient::update_system_fonts(String const& default_font_query, String const& fixed_width_font_query)
{
Gfx::FontDatabase::set_default_font_query(default_font_query);
Gfx::FontDatabase::set_fixed_width_font_query(fixed_width_font_query);
}
void ClientConnection::update_screen_rects(const Vector<Gfx::IntRect>& rects, u32 main_screen)
void ConnectionFromClient::update_screen_rects(const Vector<Gfx::IntRect>& rects, u32 main_screen)
{
m_page_host->set_screen_rects(rects, main_screen);
}
void ClientConnection::load_url(const URL& url)
void ConnectionFromClient::load_url(const URL& url)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadURL: url={}", url);
@ -91,29 +91,29 @@ void ClientConnection::load_url(const URL& url)
page().load(url);
}
void ClientConnection::load_html(const String& html, const URL& url)
void ConnectionFromClient::load_html(const String& html, const URL& url)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::LoadHTML: html={}, url={}", html, url);
page().load_html(html, url);
}
void ClientConnection::set_viewport_rect(const Gfx::IntRect& rect)
void ConnectionFromClient::set_viewport_rect(const Gfx::IntRect& rect)
{
dbgln_if(SPAM_DEBUG, "handle: WebContentServer::SetViewportRect: rect={}", rect);
m_page_host->set_viewport_rect(rect);
}
void ClientConnection::add_backing_store(i32 backing_store_id, const Gfx::ShareableBitmap& bitmap)
void ConnectionFromClient::add_backing_store(i32 backing_store_id, const Gfx::ShareableBitmap& bitmap)
{
m_backing_stores.set(backing_store_id, *bitmap.bitmap());
}
void ClientConnection::remove_backing_store(i32 backing_store_id)
void ConnectionFromClient::remove_backing_store(i32 backing_store_id)
{
m_backing_stores.remove(backing_store_id);
}
void ClientConnection::paint(const Gfx::IntRect& content_rect, i32 backing_store_id)
void ConnectionFromClient::paint(const Gfx::IntRect& content_rect, i32 backing_store_id)
{
for (auto& pending_paint : m_pending_paint_requests) {
if (pending_paint.bitmap_id == backing_store_id) {
@ -133,7 +133,7 @@ void ClientConnection::paint(const Gfx::IntRect& content_rect, i32 backing_store
m_paint_flush_timer->start();
}
void ClientConnection::flush_pending_paint_requests()
void ConnectionFromClient::flush_pending_paint_requests()
{
for (auto& pending_paint : m_pending_paint_requests) {
m_page_host->paint(pending_paint.content_rect, *pending_paint.bitmap);
@ -142,37 +142,37 @@ void ClientConnection::flush_pending_paint_requests()
m_pending_paint_requests.clear();
}
void ClientConnection::mouse_down(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers)
void ConnectionFromClient::mouse_down(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers)
{
page().handle_mousedown(position, button, modifiers);
}
void ClientConnection::mouse_move(const Gfx::IntPoint& position, [[maybe_unused]] unsigned int button, unsigned int buttons, unsigned int modifiers)
void ConnectionFromClient::mouse_move(const Gfx::IntPoint& position, [[maybe_unused]] unsigned int button, unsigned int buttons, unsigned int modifiers)
{
page().handle_mousemove(position, buttons, modifiers);
}
void ClientConnection::mouse_up(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers)
void ConnectionFromClient::mouse_up(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers)
{
page().handle_mouseup(position, button, modifiers);
}
void ClientConnection::mouse_wheel(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers, i32 wheel_delta_x, i32 wheel_delta_y)
void ConnectionFromClient::mouse_wheel(const Gfx::IntPoint& position, unsigned int button, [[maybe_unused]] unsigned int buttons, unsigned int modifiers, i32 wheel_delta_x, i32 wheel_delta_y)
{
page().handle_mousewheel(position, button, modifiers, wheel_delta_x, wheel_delta_y);
}
void ClientConnection::key_down(i32 key, unsigned int modifiers, u32 code_point)
void ConnectionFromClient::key_down(i32 key, unsigned int modifiers, u32 code_point)
{
page().handle_keydown((KeyCode)key, modifiers, code_point);
}
void ClientConnection::key_up(i32 key, unsigned int modifiers, u32 code_point)
void ConnectionFromClient::key_up(i32 key, unsigned int modifiers, u32 code_point)
{
page().handle_keyup((KeyCode)key, modifiers, code_point);
}
void ClientConnection::debug_request(const String& request, const String& argument)
void ConnectionFromClient::debug_request(const String& request, const String& argument)
{
if (request == "dump-dom-tree") {
if (auto* doc = page().top_level_browsing_context().active_document())
@ -231,21 +231,21 @@ void ClientConnection::debug_request(const String& request, const String& argume
}
}
void ClientConnection::get_source()
void ConnectionFromClient::get_source()
{
if (auto* doc = page().top_level_browsing_context().active_document()) {
async_did_get_source(doc->url(), doc->source());
}
}
void ClientConnection::inspect_dom_tree()
void ConnectionFromClient::inspect_dom_tree()
{
if (auto* doc = page().top_level_browsing_context().active_document()) {
async_did_get_dom_tree(doc->dump_dom_tree_as_json());
}
}
Messages::WebContentServer::InspectDomNodeResponse ClientConnection::inspect_dom_node(i32 node_id)
Messages::WebContentServer::InspectDomNodeResponse ConnectionFromClient::inspect_dom_node(i32 node_id)
{
auto& top_context = page().top_level_browsing_context();
@ -311,7 +311,7 @@ Messages::WebContentServer::InspectDomNodeResponse ClientConnection::inspect_dom
return { false, "", "", "" };
}
Messages::WebContentServer::GetHoveredNodeIdResponse ClientConnection::get_hovered_node_id()
Messages::WebContentServer::GetHoveredNodeIdResponse ConnectionFromClient::get_hovered_node_id()
{
if (auto* document = page().top_level_browsing_context().active_document()) {
auto hovered_node = document->hovered_node();
@ -321,7 +321,7 @@ Messages::WebContentServer::GetHoveredNodeIdResponse ClientConnection::get_hover
return (i32)0;
}
void ClientConnection::initialize_js_console(Badge<PageHost>)
void ConnectionFromClient::initialize_js_console(Badge<PageHost>)
{
auto* document = page().top_level_browsing_context().active_document();
auto interpreter = document->interpreter().make_weak_ptr();
@ -333,13 +333,13 @@ void ClientConnection::initialize_js_console(Badge<PageHost>)
interpreter->global_object().console().set_client(*m_console_client.ptr());
}
void ClientConnection::js_console_input(const String& js_source)
void ConnectionFromClient::js_console_input(const String& js_source)
{
if (m_console_client)
m_console_client->handle_input(js_source);
}
void ClientConnection::run_javascript(String const& js_source)
void ConnectionFromClient::run_javascript(String const& js_source)
{
auto* active_document = page().top_level_browsing_context().active_document();
@ -366,24 +366,24 @@ void ClientConnection::run_javascript(String const& js_source)
dbgln("Exception :(");
}
void ClientConnection::js_console_request_messages(i32 start_index)
void ConnectionFromClient::js_console_request_messages(i32 start_index)
{
if (m_console_client)
m_console_client->send_messages(start_index);
}
Messages::WebContentServer::GetSelectedTextResponse ClientConnection::get_selected_text()
Messages::WebContentServer::GetSelectedTextResponse ConnectionFromClient::get_selected_text()
{
return page().focused_context().selected_text();
}
void ClientConnection::select_all()
void ConnectionFromClient::select_all()
{
page().focused_context().select_all();
page().client().page_did_change_selection();
}
Messages::WebContentServer::DumpLayoutTreeResponse ClientConnection::dump_layout_tree()
Messages::WebContentServer::DumpLayoutTreeResponse ConnectionFromClient::dump_layout_tree()
{
auto* document = page().top_level_browsing_context().active_document();
if (!document)
@ -396,18 +396,18 @@ Messages::WebContentServer::DumpLayoutTreeResponse ClientConnection::dump_layout
return builder.to_string();
}
void ClientConnection::set_content_filters(Vector<String> const& filters)
void ConnectionFromClient::set_content_filters(Vector<String> const& filters)
{
for (auto& filter : filters)
Web::ContentFilter::the().add_pattern(filter);
}
void ClientConnection::set_preferred_color_scheme(Web::CSS::PreferredColorScheme const& color_scheme)
void ConnectionFromClient::set_preferred_color_scheme(Web::CSS::PreferredColorScheme const& color_scheme)
{
m_page_host->set_preferred_color_scheme(color_scheme);
}
void ClientConnection::set_has_focus(bool has_focus)
void ConnectionFromClient::set_has_focus(bool has_focus)
{
m_page_host->set_has_focus(has_focus);
}

View file

@ -7,7 +7,7 @@
#pragma once
#include <AK/HashMap.h>
#include <LibIPC/ClientConnection.h>
#include <LibIPC/ConnectionFromClient.h>
#include <LibJS/Forward.h>
#include <LibJS/Heap/Handle.h>
#include <LibWeb/CSS/PreferredColorScheme.h>
@ -20,19 +20,19 @@
namespace WebContent {
class ClientConnection final
: public IPC::ClientConnection<WebContentClientEndpoint, WebContentServerEndpoint> {
C_OBJECT(ClientConnection);
class ConnectionFromClient final
: public IPC::ConnectionFromClient<WebContentClientEndpoint, WebContentServerEndpoint> {
C_OBJECT(ConnectionFromClient);
public:
~ClientConnection() override;
~ConnectionFromClient() override;
virtual void die() override;
void initialize_js_console(Badge<PageHost>);
private:
explicit ClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket>);
explicit ConnectionFromClient(NonnullOwnPtr<Core::Stream::LocalSocket>);
Web::Page& page();
const Web::Page& page() const;

View file

@ -7,7 +7,7 @@ Server Client
WebContent GUI process (OutOfProcessWebView embedder)
OutOfProcessWebView (this is a GUI::Widget)
WebContent::ClientConnection <---> WebContentClient
WebContent::ConnectionFromClient <---> WebContentClient
WebContent::PageHost (Web::PageClient)
Web::Page
Web::Frame

View file

@ -8,7 +8,7 @@
namespace WebContent {
class ClientConnection;
class ConnectionFromClient;
class ConsoleGlobalObject;
class PageHost;
class WebContentConsoleClient;

View file

@ -5,7 +5,7 @@
*/
#include "PageHost.h"
#include "ClientConnection.h"
#include "ConnectionFromClient.h"
#include <LibGfx/Painter.h>
#include <LibGfx/ShareableBitmap.h>
#include <LibGfx/SystemTheme.h>
@ -16,7 +16,7 @@
namespace WebContent {
PageHost::PageHost(ClientConnection& client)
PageHost::PageHost(ConnectionFromClient& client)
: m_client(client)
, m_page(make<Web::Page>(*this))
{

View file

@ -11,14 +11,14 @@
namespace WebContent {
class ClientConnection;
class ConnectionFromClient;
class PageHost final : public Web::PageClient {
AK_MAKE_NONCOPYABLE(PageHost);
AK_MAKE_NONMOVABLE(PageHost);
public:
static NonnullOwnPtr<PageHost> create(ClientConnection& client) { return adopt_own(*new PageHost(client)); }
static NonnullOwnPtr<PageHost> create(ConnectionFromClient& client) { return adopt_own(*new PageHost(client)); }
virtual ~PageHost();
Web::Page& page() { return *m_page; }
@ -65,12 +65,12 @@ private:
virtual String page_did_request_cookie(const URL&, Web::Cookie::Source) override;
virtual void page_did_set_cookie(const URL&, const Web::Cookie::ParsedCookie&, Web::Cookie::Source) override;
explicit PageHost(ClientConnection&);
explicit PageHost(ConnectionFromClient&);
Web::Layout::InitialContainingBlock* layout_root();
void setup_palette();
ClientConnection& m_client;
ConnectionFromClient& m_client;
NonnullOwnPtr<Web::Page> m_page;
RefPtr<Gfx::PaletteImpl> m_palette_impl;
Gfx::IntRect m_screen_rect;

View file

@ -16,7 +16,7 @@
namespace WebContent {
WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, WeakPtr<JS::Interpreter> interpreter, ClientConnection& client)
WebContentConsoleClient::WebContentConsoleClient(JS::Console& console, WeakPtr<JS::Interpreter> interpreter, ConnectionFromClient& client)
: ConsoleClient(console)
, m_client(client)
, m_interpreter(interpreter)

View file

@ -8,7 +8,7 @@
#pragma once
#include "ClientConnection.h"
#include "ConnectionFromClient.h"
#include <LibJS/Console.h>
#include <LibJS/Forward.h>
#include <LibWeb/Forward.h>
@ -18,7 +18,7 @@ namespace WebContent {
class WebContentConsoleClient final : public JS::ConsoleClient {
public:
WebContentConsoleClient(JS::Console&, WeakPtr<JS::Interpreter>, ClientConnection&);
WebContentConsoleClient(JS::Console&, WeakPtr<JS::Interpreter>, ConnectionFromClient&);
void handle_input(String const& js_source);
void send_messages(i32 start_index);
@ -27,7 +27,7 @@ private:
virtual void clear() override;
virtual JS::ThrowCompletionOr<JS::Value> printer(JS::Console::LogLevel log_level, PrinterArguments) override;
ClientConnection& m_client;
ConnectionFromClient& m_client;
WeakPtr<JS::Interpreter> m_interpreter;
JS::Handle<ConsoleGlobalObject> m_console_global_object;

View file

@ -9,7 +9,7 @@
#include <LibCore/System.h>
#include <LibIPC/SingleServer.h>
#include <LibMain/Main.h>
#include <WebContent/ClientConnection.h>
#include <WebContent/ConnectionFromClient.h>
ErrorOr<int> serenity_main(Main::Arguments)
{
@ -22,6 +22,6 @@ ErrorOr<int> serenity_main(Main::Arguments)
TRY(Core::System::unveil("/tmp/portal/websocket", "rw"));
TRY(Core::System::unveil(nullptr, nullptr));
auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebContent::ClientConnection>());
auto client = TRY(IPC::take_over_accepted_client_from_system_server<WebContent::ConnectionFromClient>());
return event_loop.exec();
}