mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-19 14:40:18 +00:00
WebDriver: Stop using the ancient Core::EventReceiver parent/child API
Before this change, clients were kept alive by making them children of the TCPServer object. This ownership model is going away (and this was the only remaining use of it!) so let's just put the clients in a hash table instead.
This commit is contained in:
parent
045eaa1576
commit
dfe776b722
Notes:
github-actions[bot]
2025-08-11 14:57:31 +00:00
Author: https://github.com/awesomekling
Commit: dfe776b722
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/5817
Reviewed-by: https://github.com/gmta ✅
5 changed files with 24 additions and 12 deletions
|
@ -176,9 +176,8 @@ static JsonValue make_success_response(JsonValue value)
|
|||
return result;
|
||||
}
|
||||
|
||||
Client::Client(NonnullOwnPtr<Core::BufferedTCPSocket> socket, Core::EventReceiver* parent)
|
||||
: Core::EventReceiver(parent)
|
||||
, m_socket(move(socket))
|
||||
Client::Client(NonnullOwnPtr<Core::BufferedTCPSocket> socket)
|
||||
: m_socket(move(socket))
|
||||
{
|
||||
m_socket->on_ready_to_read = [this] {
|
||||
if (auto result = on_ready_to_read(); result.is_error())
|
||||
|
@ -194,7 +193,10 @@ Client::~Client()
|
|||
void Client::die()
|
||||
{
|
||||
// We defer removing this connection to avoid closing its socket while we are inside the on_ready_to_read callback.
|
||||
deferred_invoke([this] { remove_from_parent(); });
|
||||
deferred_invoke([this] {
|
||||
if (on_death)
|
||||
on_death();
|
||||
});
|
||||
}
|
||||
|
||||
ErrorOr<void, Client::WrappedError> Client::on_ready_to_read()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue