1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 06:47:34 +00:00

LibWeb: Make Web::PageClient GC-allocated

This is a first step towards simplifying the ownership model of
Web::Page. Soon Web::Page will store its WebClient as a
NonnullGCPtr to help solve lifetime issues of the client being
destroyed before the page.
This commit is contained in:
Shannon Booth 2023-12-04 21:40:33 +13:00 committed by Andreas Kling
parent 5c0cd0f484
commit 6e6f3a9a8f
11 changed files with 45 additions and 17 deletions

View file

@ -6,6 +6,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibWeb/Bindings/MainThreadVM.h>
#include <LibWeb/HTML/TraversableNavigable.h>
#include <WebContent/ConnectionFromClient.h>
#include <WebContent/PageClient.h>
@ -23,7 +24,7 @@ PageHost::PageHost(ConnectionFromClient& client)
PageClient& PageHost::create_page()
{
m_pages.set(m_next_id, make<PageClient>(*this, m_next_id));
m_pages.set(m_next_id, PageClient::create(Web::Bindings::main_thread_vm(), *this, m_next_id));
++m_next_id;
return *m_pages.get(m_next_id - 1).value();
}