diff --git a/Userland/Libraries/LibIPC/Connection.cpp b/Userland/Libraries/LibIPC/Connection.cpp index d73c333c440..9fb4502d7f7 100644 --- a/Userland/Libraries/LibIPC/Connection.cpp +++ b/Userland/Libraries/LibIPC/Connection.cpp @@ -5,9 +5,11 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include +#include +#include +#include #include -#include +#include #include namespace IPC { @@ -18,6 +20,19 @@ ConnectionBase::ConnectionBase(IPC::Stub& local_stub, NonnullOwnPtron_ready_to_read = [this] { + NonnullRefPtr protect = *this; + // FIXME: Do something about errors. + (void)drain_messages_from_peer(); + handle_messages(); + }; +} + +ConnectionBase::~ConnectionBase() = default; + +bool ConnectionBase::is_open() const +{ + return m_socket->is_open(); } ErrorOr ConnectionBase::post_message(Message const& message) diff --git a/Userland/Libraries/LibIPC/Connection.h b/Userland/Libraries/LibIPC/Connection.h index 25883c245f3..90da1d420fb 100644 --- a/Userland/Libraries/LibIPC/Connection.h +++ b/Userland/Libraries/LibIPC/Connection.h @@ -7,16 +7,11 @@ #pragma once -#include +#include #include -#include -#include -#include -#include -#include +#include #include #include -#include namespace IPC { @@ -24,9 +19,9 @@ class ConnectionBase : public Core::EventReceiver { C_OBJECT_ABSTRACT(ConnectionBase); public: - virtual ~ConnectionBase() override = default; + virtual ~ConnectionBase() override; - bool is_open() const { return m_socket->is_open(); } + [[nodiscard]] bool is_open() const; ErrorOr post_message(Message const&); void shutdown(); @@ -70,12 +65,6 @@ public: Connection(IPC::Stub& local_stub, NonnullOwnPtr socket) : ConnectionBase(local_stub, move(socket), LocalEndpoint::static_magic()) { - m_socket->on_ready_to_read = [this] { - NonnullRefPtr protect = *this; - // FIXME: Do something about errors. - (void)drain_messages_from_peer(); - handle_messages(); - }; } template diff --git a/Userland/Libraries/LibWebView/ViewImplementation.cpp b/Userland/Libraries/LibWebView/ViewImplementation.cpp index 75c6201b5a2..7987a6b83bf 100644 --- a/Userland/Libraries/LibWebView/ViewImplementation.cpp +++ b/Userland/Libraries/LibWebView/ViewImplementation.cpp @@ -8,6 +8,7 @@ #include #include #include +#include #include #include #include diff --git a/Userland/Services/WebWorker/ConnectionFromClient.cpp b/Userland/Services/WebWorker/ConnectionFromClient.cpp index 11e39a42bb4..8a644f3d255 100644 --- a/Userland/Services/WebWorker/ConnectionFromClient.cpp +++ b/Userland/Services/WebWorker/ConnectionFromClient.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include