Skip to content

Commit

Permalink
Stop using CheckedPtr / CheckedRef with refcounted classes in WebKit2
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=266637

Reviewed by Brent Fulgham.

Stop using CheckedPtr / CheckedRef with refcounted classes in WebKit2. Using RefPtr/Ref
or WeakPtr/WeakRef instead.

* Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h:
* Source/WebKit/NetworkProcess/SharedWorker/WebSharedWorker.cpp:
(WebKit::allWorkers):
(WebKit::WebSharedWorker::WebSharedWorker):
* Source/WebKit/NetworkProcess/SharedWorker/WebSharedWorker.h:
* Source/WebKit/NetworkProcess/SharedWorker/WebSharedWorkerServer.cpp:
(WebKit::WebSharedWorkerServer::addContextConnection):
* Source/WebKit/NetworkProcess/SharedWorker/WebSharedWorkerServer.h:
* Source/WebKit/NetworkProcess/SharedWorker/WebSharedWorkerServerToContextConnection.h:
* Source/WebKit/Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::allItems):
* Source/WebKit/Shared/WebBackForwardListItem.h:
* Source/WebKit/UIProcess/API/APIContentWorld.cpp:
(API::sharedWorldNameMap):
(API::sharedWorldIdentifierMap):
(API::ContentWorld::ContentWorld):
(API::ContentWorld::sharedWorldWithName):
* Source/WebKit/UIProcess/API/APIContentWorld.h:
* Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(-[WKBrowsingContextController dealloc]):
(-[WKBrowsingContextController _initWithPageRef:]):
* Source/WebKit/UIProcess/Automation/WebAutomationSession.h:
* Source/WebKit/UIProcess/Cocoa/UIRemoteObjectRegistry.h:
* Source/WebKit/UIProcess/DrawingAreaProxy.cpp:
(WebKit::DrawingAreaProxy::page const):
* Source/WebKit/UIProcess/DrawingAreaProxy.h:
(WebKit::DrawingAreaProxy::page const): Deleted.
* Source/WebKit/UIProcess/Inspector/Agents/InspectorBrowserAgent.h:
* Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.h:
* Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp:
(WebKit::WebInspectorUIProxy::WebInspectorUIProxy):
* Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h:
* Source/WebKit/UIProcess/Inspector/WebPageInspectorAgentBase.h:
* Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h:
* Source/WebKit/UIProcess/Inspector/mac/WKInspectorViewController.mm:
(-[WKInspectorViewController initWithConfiguration:inspectedPage:]):
* Source/WebKit/UIProcess/ProvisionalFrameProxy.h:
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::~ProvisionalPageProxy):
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
* Source/WebKit/UIProcess/SpeechRecognitionPermissionManager.h:
* Source/WebKit/UIProcess/SuspendedPageProxy.cpp:
(WebKit::SuspendedPageProxy::page const):
* Source/WebKit/UIProcess/SuspendedPageProxy.h:
* Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.cpp:
(WebKit::webUserContentControllerProxies):
(WebKit::WebUserContentControllerProxy::WebUserContentControllerProxy):
* Source/WebKit/UIProcess/UserContent/WebUserContentControllerProxy.h:
* Source/WebKit/UIProcess/ViewSnapshotStore.cpp:
(WebKit::ViewSnapshotStore::didAddImageToSnapshot):
(WebKit::ViewSnapshotStore::willRemoveImageFromSnapshot):
* Source/WebKit/UIProcess/ViewSnapshotStore.h:
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::allFrames):
(WebKit::WebFrameProxy::WebFrameProxy):
* Source/WebKit/UIProcess/WebFrameProxy.h:
* Source/WebKit/UIProcess/WebPageGroup.cpp:
(WebKit::WebPageGroup::forEach):
(WebKit::WebPageGroup::WebPageGroup):
* Source/WebKit/UIProcess/WebPageGroup.h:
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::processPools):
* Source/WebKit/UIProcess/WebProcessPool.h:
* Source/WebKit/UIProcess/WebProcessProxy.h:
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp:
(WebKit::allDataStores):
* Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h:
* Source/WebKit/UIProcess/mac/WKImmediateActionController.h:
* Source/WebKit/UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController dismissContentRelativeChildWindows]):
(-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
(-[WKImmediateActionController immediateActionRecognizerWillBeginAnimation:]):
(-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
(-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
(-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
(-[WKImmediateActionController _webHitTestResult]):
(-[WKImmediateActionController _defaultAnimationController]):
(-[WKImmediateActionController _updateImmediateActionItem]):
* Source/WebKit/UIProcess/mac/WKTextFinderClient.mm:
* Source/WebKit/WebProcess/Databases/WebDatabaseProvider.cpp:
(WebKit::databaseProviders):
(WebKit::WebDatabaseProvider::getOrCreate):
* Source/WebKit/WebProcess/Databases/WebDatabaseProvider.h:
* Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.cpp:
(WebKit::InjectedBundleCSSStyleDeclarationHandle::getOrCreate):
* Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleCSSStyleDeclarationHandle.h:
* Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.cpp:
(WebKit::InjectedBundleNodeHandle::getOrCreate):
* Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleNodeHandle.h:
* Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::getOrCreate):
* Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.h:
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundleScriptWorld.cpp:
(WebKit::InjectedBundleScriptWorld::getOrCreate):
(WebKit::InjectedBundleScriptWorld::find):
(WebKit::InjectedBundleScriptWorld::InjectedBundleScriptWorld):
* Source/WebKit/WebProcess/InjectedBundle/InjectedBundleScriptWorld.h:
* Source/WebKit/WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::addURLSchemeTaskProxy):
* Source/WebKit/WebProcess/Network/WebLoaderStrategy.h:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.h:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocket.h:
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.cpp:
(WebKit::LibWebRTCSocketFactory::addSocket):
(WebKit::LibWebRTCSocketFactory::forSocketInGroup):
(WebKit::LibWebRTCSocketFactory::createAsyncDnsResolver):
* Source/WebKit/WebProcess/Network/webrtc/LibWebRTCSocketFactory.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::AXRelayProcessSuspendedNotification::AXRelayProcessSuspendedNotification):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebDataListSuggestionPicker.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebDateTimeChooser.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebGeolocationClient.h:
* Source/WebKit/WebProcess/WebPage/Cocoa/WebRemoteObjectRegistry.h:
* Source/WebKit/WebProcess/WebPage/DrawingArea.h:
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::registerURLSchemeHandler):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebURLSchemeHandlerProxy.h:
* Source/WebKit/WebProcess/WebPage/WebURLSchemeTaskProxy.h:

Canonical link: https://commits.webkit.org/272284@main
  • Loading branch information
cdumez committed Dec 19, 2023
1 parent 6ac5fdd commit 1d60d45
Show file tree
Hide file tree
Showing 74 changed files with 184 additions and 183 deletions.
2 changes: 0 additions & 2 deletions Source/WebKit/NetworkProcess/NetworkConnectionToWebProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ class NetworkConnectionToWebProcess
#endif
#if HAVE(COOKIE_CHANGE_LISTENER_API)
, public WebCore::CookieChangeObserver
#else
, public CanMakeCheckedPtr
#endif
, public IPC::Connection::Client {
public:
Expand Down
8 changes: 4 additions & 4 deletions Source/WebKit/NetworkProcess/SharedWorker/WebSharedWorker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@

#include "WebSharedWorkerServer.h"
#include "WebSharedWorkerServerToContextConnection.h"
#include <wtf/CheckedPtr.h>
#include <wtf/HashMap.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/RunLoop.h>
#include <wtf/WeakRef.h>

namespace WebKit {

static HashMap<WebCore::SharedWorkerIdentifier, CheckedPtr<WebSharedWorker>>& allWorkers()
static HashMap<WebCore::SharedWorkerIdentifier, WeakRef<WebSharedWorker>>& allWorkers()
{
ASSERT(RunLoop::isMain());
static NeverDestroyed<HashMap<WebCore::SharedWorkerIdentifier, CheckedPtr<WebSharedWorker>>> allWorkers;
static NeverDestroyed<HashMap<WebCore::SharedWorkerIdentifier, WeakRef<WebSharedWorker>>> allWorkers;
return allWorkers;
}

Expand All @@ -49,7 +49,7 @@ WebSharedWorker::WebSharedWorker(WebSharedWorkerServer& server, const WebCore::S
, m_workerOptions(workerOptions)
{
ASSERT(!allWorkers().contains(m_identifier));
allWorkers().add(m_identifier, this);
allWorkers().add(m_identifier, *this);
}

WebSharedWorker::~WebSharedWorker()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ namespace WebKit {
class WebSharedWorkerServer;
class WebSharedWorkerServerToContextConnection;

class WebSharedWorker : public CanMakeWeakPtr<WebSharedWorker>, public CanMakeCheckedPtr {
class WebSharedWorker : public CanMakeWeakPtr<WebSharedWorker> {
WTF_MAKE_FAST_ALLOCATED;
public:
WebSharedWorker(WebSharedWorkerServer&, const WebCore::SharedWorkerKey&, const WebCore::WorkerOptions&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ void WebSharedWorkerServer::addContextConnection(WebSharedWorkerServerToContextC

ASSERT(!m_contextConnections.contains(contextConnection.registrableDomain()));

m_contextConnections.add(contextConnection.registrableDomain(), &contextConnection);
m_contextConnections.add(contextConnection.registrableDomain(), contextConnection);

contextConnectionCreated(contextConnection);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class WebSharedWorkerServer : public CanMakeWeakPtr<WebSharedWorkerServer> {

NetworkSession& m_session;
HashMap<WebCore::ProcessIdentifier, std::unique_ptr<WebSharedWorkerServerConnection>> m_connections;
HashMap<WebCore::RegistrableDomain, CheckedPtr<WebSharedWorkerServerToContextConnection>> m_contextConnections;
HashMap<WebCore::RegistrableDomain, WeakRef<WebSharedWorkerServerToContextConnection>> m_contextConnections;
HashSet<WebCore::RegistrableDomain> m_pendingContextConnectionDomains;
HashMap<WebCore::SharedWorkerKey, std::unique_ptr<WebSharedWorker>> m_sharedWorkers;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class NetworkConnectionToWebProcess;
class WebSharedWorker;
class WebSharedWorkerServer;

class WebSharedWorkerServerToContextConnection final : public IPC::MessageSender, public IPC::MessageReceiver, public CanMakeCheckedPtr {
class WebSharedWorkerServerToContextConnection final : public IPC::MessageSender, public IPC::MessageReceiver {
WTF_MAKE_FAST_ALLOCATED;
public:
WebSharedWorkerServerToContextConnection(NetworkConnectionToWebProcess&, const WebCore::RegistrableDomain&, WebSharedWorkerServer&);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ void NetworkMDNSRegister::registerMDNSName(WebCore::ScriptExecutionContextIdenti
}

auto identifier = PendingRegistrationRequestIdentifier::generate();
CheckedRef connection = m_connection;
Ref connection = m_connection.get();
auto pendingRequest = makeUnique<PendingRegistrationRequest>(connection.get(), WTFMove(name), sessionID(), WTFMove(completionHandler));
auto addResult = pendingRegistrationRequestMap().add(identifier, WTFMove(pendingRequest));
DNSRecordRef record { nullptr };
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/NetworkProcess/webrtc/NetworkMDNSRegister.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class NetworkMDNSRegister {

PAL::SessionID sessionID() const;

CheckedRef<NetworkConnectionToWebProcess> m_connection;
WeakRef<NetworkConnectionToWebProcess> m_connection;
#if ENABLE_MDNS
struct DNSServiceDeallocator;
HashMap<WebCore::ScriptExecutionContextIdentifier, std::unique_ptr<_DNSServiceRef_t, DNSServiceDeallocator>> m_services;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/Shared/WebBackForwardListItem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ WebBackForwardListItem::~WebBackForwardListItem()
removeFromBackForwardCache();
}

HashMap<BackForwardItemIdentifier, CheckedRef<WebBackForwardListItem>>& WebBackForwardListItem::allItems()
HashMap<BackForwardItemIdentifier, WeakRef<WebBackForwardListItem>>& WebBackForwardListItem::allItems()
{
RELEASE_ASSERT(RunLoop::isMain());
static NeverDestroyed<HashMap<BackForwardItemIdentifier, CheckedRef<WebBackForwardListItem>>> items;
static NeverDestroyed<HashMap<BackForwardItemIdentifier, WeakRef<WebBackForwardListItem>>> items;
return items;
}

Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/Shared/WebBackForwardListItem.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ class SuspendedPageProxy;
class WebBackForwardCache;
class WebBackForwardCacheEntry;

class WebBackForwardListItem : public API::ObjectImpl<API::Object::Type::BackForwardListItem>, public CanMakeWeakPtr<WebBackForwardListItem>, public CanMakeCheckedPtr {
class WebBackForwardListItem : public API::ObjectImpl<API::Object::Type::BackForwardListItem>, public CanMakeWeakPtr<WebBackForwardListItem> {
public:
static Ref<WebBackForwardListItem> create(BackForwardListItemState&&, WebPageProxyIdentifier);
virtual ~WebBackForwardListItem();

static WebBackForwardListItem* itemForID(const WebCore::BackForwardItemIdentifier&);
static HashMap<WebCore::BackForwardItemIdentifier, CheckedRef<WebBackForwardListItem>>& allItems();
static HashMap<WebCore::BackForwardItemIdentifier, WeakRef<WebBackForwardListItem>>& allItems();

const WebCore::BackForwardItemIdentifier& itemID() const { return m_itemState.identifier; }
const BackForwardListItemState& itemState() { return m_itemState; }
Expand Down
25 changes: 12 additions & 13 deletions Source/WebKit/UIProcess/API/APIContentWorld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@

#include "ContentWorldShared.h"
#include "WebUserContentControllerProxy.h"
#include <wtf/CheckedPtr.h>
#include <wtf/HashMap.h>
#include <wtf/WeakRef.h>
#include <wtf/text/StringHash.h>

namespace API {

static HashMap<WTF::String, CheckedPtr<ContentWorld>>& sharedWorldNameMap()
static HashMap<WTF::String, WeakRef<ContentWorld>>& sharedWorldNameMap()
{
static NeverDestroyed<HashMap<WTF::String, CheckedPtr<ContentWorld>>> sharedMap;
static NeverDestroyed<HashMap<WTF::String, WeakRef<ContentWorld>>> sharedMap;
return sharedMap;
}

static HashMap<WebKit::ContentWorldIdentifier, CheckedPtr<ContentWorld>>& sharedWorldIdentifierMap()
static HashMap<WebKit::ContentWorldIdentifier, WeakRef<ContentWorld>>& sharedWorldIdentifierMap()
{
static NeverDestroyed<HashMap<WebKit::ContentWorldIdentifier, CheckedPtr<ContentWorld>>> sharedMap;
static NeverDestroyed<HashMap<WebKit::ContentWorldIdentifier, WeakRef<ContentWorld>>> sharedMap;
return sharedMap;
}

Expand All @@ -63,7 +63,7 @@ ContentWorld::ContentWorld(const WTF::String& name)
});

m_identifier = WebKit::ContentWorldIdentifier::generate();
auto addResult = sharedWorldIdentifierMap().add(m_identifier, this);
auto addResult = sharedWorldIdentifierMap().add(m_identifier, *this);
ASSERT_UNUSED(addResult, addResult.isNewEntry);
}

Expand All @@ -75,13 +75,12 @@ ContentWorld::ContentWorld(WebKit::ContentWorldIdentifier identifier)

Ref<ContentWorld> ContentWorld::sharedWorldWithName(const WTF::String& name)
{
auto result = sharedWorldNameMap().add(name, nullptr);
if (result.isNewEntry) {
result.iterator->value = new ContentWorld(name);
return adoptRef(*result.iterator->value.get());
}

return *result.iterator->value;
RefPtr<ContentWorld> newContentWorld;
auto result = sharedWorldNameMap().ensure(name, [&] {
newContentWorld = adoptRef(*new ContentWorld(name));
return WeakRef { *newContentWorld };
});
return newContentWorld ? newContentWorld.releaseNonNull() : Ref { result.iterator->value.get() };
}

ContentWorld& ContentWorld::pageContentWorld()
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/API/APIContentWorld.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@

#include "APIObject.h"
#include "ContentWorldShared.h"
#include <wtf/CheckedRef.h>
#include <wtf/WeakHashSet.h>
#include <wtf/WeakPtr.h>
#include <wtf/text/WTFString.h>

namespace WebKit {
Expand All @@ -37,7 +37,7 @@ class WebUserContentControllerProxy;

namespace API {

class ContentWorld final : public API::ObjectImpl<API::Object::Type::ContentWorld>, public CanMakeCheckedPtr {
class ContentWorld final : public API::ObjectImpl<API::Object::Type::ContentWorld>, public CanMakeWeakPtr<ContentWorld> {
public:
static ContentWorld* worldForIdentifier(WebKit::ContentWorldIdentifier);
static Ref<ContentWorld> sharedWorldWithName(const WTF::String&);
Expand Down
12 changes: 6 additions & 6 deletions Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ @implementation WKBrowsingContextController {
}

ALLOW_DEPRECATED_DECLARATIONS_BEGIN
static HashMap<CheckedPtr<WebKit::WebPageProxy>, __unsafe_unretained WKBrowsingContextController *>& browsingContextControllerMap()
static HashMap<WeakRef<WebKit::WebPageProxy>, __unsafe_unretained WKBrowsingContextController *>& browsingContextControllerMap()
{
static NeverDestroyed<HashMap<CheckedPtr<WebKit::WebPageProxy>, __unsafe_unretained WKBrowsingContextController *>> browsingContextControllerMap;
static NeverDestroyed<HashMap<WeakRef<WebKit::WebPageProxy>, __unsafe_unretained WKBrowsingContextController *>> browsingContextControllerMap;
return browsingContextControllerMap;
}
ALLOW_DEPRECATED_DECLARATIONS_END
Expand All @@ -99,8 +99,8 @@ - (void)dealloc
if (WebCoreObjCScheduleDeallocateOnMainRunLoop(WKBrowsingContextController.class, self))
return;

ASSERT(browsingContextControllerMap().get(_page.get()) == self);
browsingContextControllerMap().remove(_page.get());
ASSERT(browsingContextControllerMap().get(*_page) == self);
browsingContextControllerMap().remove(*_page);

_page->pageLoadState().removeObserver(*_pageLoadStateObserver);

Expand Down Expand Up @@ -626,8 +626,8 @@ - (instancetype)_initWithPageRef:(WKPageRef)pageRef
_pageLoadStateObserver = makeUnique<WebKit::PageLoadStateObserver>(self);
_page->pageLoadState().addObserver(*_pageLoadStateObserver);

ASSERT(!browsingContextControllerMap().contains(_page.get()));
browsingContextControllerMap().set(_page.get(), self);
ASSERT(!browsingContextControllerMap().contains(*_page));
browsingContextControllerMap().set(*_page, self);

return self;
}
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/Automation/WebAutomationSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ class WebAutomationSession final : public API::ObjectImpl<API::Object::Type::Aut
std::optional<unichar> charCodeIgnoringModifiersForVirtualKey(Inspector::Protocol::Automation::VirtualKey) const;
#endif

CheckedPtr<WebProcessPool> m_processPool;
WeakPtr<WebProcessPool> m_processPool;

std::unique_ptr<API::AutomationSessionClient> m_client;
String m_sessionIdentifier { "Untitled Session"_s };
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/Cocoa/UIRemoteObjectRegistry.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#pragma once

#include "RemoteObjectRegistry.h"
#include <wtf/CheckedRef.h>
#include <wtf/WeakRef.h>

namespace WebKit {

Expand All @@ -45,7 +45,7 @@ class UIRemoteObjectRegistry final : public RemoteObjectRegistry {
uint64_t messageDestinationID() final;
std::unique_ptr<ProcessThrottler::BackgroundActivity> backgroundActivity(ASCIILiteral) final;

CheckedRef<WebPageProxy> m_page;
WeakRef<WebPageProxy> m_page;
};

} // namespace WebKit
5 changes: 5 additions & 0 deletions Source/WebKit/UIProcess/DrawingAreaProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ bool DrawingAreaProxy::setSize(const IntSize& size, const IntSize& scrollDelta)
return true;
}

WebPageProxy& DrawingAreaProxy::page() const
{
return m_webPageProxy;
}

#if PLATFORM(COCOA)
MachSendRight DrawingAreaProxy::createFence()
{
Expand Down
6 changes: 3 additions & 3 deletions Source/WebKit/UIProcess/DrawingAreaProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@
#include <WebCore/IntRect.h>
#include <WebCore/IntSize.h>
#include <stdint.h>
#include <wtf/CheckedRef.h>
#include <wtf/Noncopyable.h>
#include <wtf/RunLoop.h>
#include <wtf/TypeCasts.h>
#include <wtf/WeakRef.h>

#if PLATFORM(COCOA)
namespace WTF {
Expand Down Expand Up @@ -124,7 +124,7 @@ class DrawingAreaProxy : public IPC::MessageReceiver, public IPC::MessageSender
virtual bool shouldCoalesceVisualEditorStateUpdates() const { return false; }
virtual bool shouldSendWheelEventsToEventDispatcher() const { return false; }

WebPageProxy& page() const { return m_webPageProxy; }
WebPageProxy& page() const;
virtual void viewWillStartLiveResize() { };
virtual void viewWillEndLiveResize() { };

Expand All @@ -147,7 +147,7 @@ class DrawingAreaProxy : public IPC::MessageReceiver, public IPC::MessageSender

DrawingAreaType m_type;
DrawingAreaIdentifier m_identifier;
CheckedRef<WebPageProxy> m_webPageProxy;
WeakRef<WebPageProxy> m_webPageProxy;
Ref<WebProcessProxy> m_webProcessProxy;

WebCore::IntSize m_size;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
#include "WebPageInspectorAgentBase.h"
#include <JavaScriptCore/InspectorBackendDispatchers.h>
#include <JavaScriptCore/InspectorFrontendDispatchers.h>
#include <wtf/CheckedRef.h>
#include <wtf/Forward.h>
#include <wtf/WeakRef.h>

namespace WebKit {

Expand Down Expand Up @@ -57,7 +57,7 @@ class InspectorBrowserAgent final : public InspectorAgentBase, public Inspector:
private:
std::unique_ptr<Inspector::BrowserFrontendDispatcher> m_frontendDispatcher;
RefPtr<Inspector::BrowserBackendDispatcher> m_backendDispatcher;
CheckedRef<WebPageProxy> m_inspectedPage;
WeakRef<WebPageProxy> m_inspectedPage;
};

} // namespace WebKit
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/Inspector/RemoteWebInspectorUIProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
#include <WebCore/Color.h>
#include <WebCore/FloatRect.h>
#include <WebCore/InspectorFrontendClient.h>
#include <wtf/CheckedPtr.h>
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/RetainPtr.h>
#include <wtf/WeakPtr.h>
#include <wtf/text/WTFString.h>

#if PLATFORM(MAC)
Expand Down Expand Up @@ -167,7 +167,7 @@ class RemoteWebInspectorUIProxy : public RefCounted<RemoteWebInspectorUIProxy>,
void platformShowCertificate(const WebCore::CertificateInfo&);

CheckedPtr<RemoteWebInspectorUIProxyClient> m_client;
CheckedPtr<WebPageProxy> m_inspectorPage;
WeakPtr<WebPageProxy> m_inspectorPage;

#if ENABLE(INSPECTOR_EXTENSIONS)
RefPtr<WebInspectorUIExtensionControllerProxy> m_extensionController;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const unsigned WebInspectorUIProxy::initialWindowWidth = 1000;
const unsigned WebInspectorUIProxy::initialWindowHeight = 650;

WebInspectorUIProxy::WebInspectorUIProxy(WebPageProxy& inspectedPage)
: m_inspectedPage(&inspectedPage)
: m_inspectedPage(inspectedPage)
, m_inspectorClient(makeUnique<API::InspectorClient>())
, m_inspectedPageIdentifier(inspectedPage.identifier())
#if PLATFORM(MAC)
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ class WebInspectorUIProxy
void windowReceivedMessage(HWND, UINT, WPARAM, LPARAM) override;
#endif

CheckedPtr<WebPageProxy> m_inspectedPage;
CheckedPtr<WebPageProxy> m_inspectorPage;
WeakPtr<WebPageProxy> m_inspectedPage;
WeakPtr<WebPageProxy> m_inspectorPage;
std::unique_ptr<API::InspectorClient> m_inspectorClient;
WebPageProxyIdentifier m_inspectedPageIdentifier;

Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/Inspector/WebPageInspectorAgentBase.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#pragma once

#include <JavaScriptCore/InspectorAgentBase.h>
#include <wtf/CheckedPtr.h>
#include <wtf/WeakRef.h>
#include <wtf/text/WTFString.h>

namespace Inspector {
Expand All @@ -42,7 +42,7 @@ class WebPageProxy;
struct WebPageAgentContext {
Inspector::FrontendRouter& frontendRouter;
Inspector::BackendDispatcher& backendDispatcher;
CheckedRef<WebPageProxy> inspectedPage;
WeakRef<WebPageProxy> inspectedPage;
};

class InspectorAgentBase : public Inspector::InspectorAgentBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class WebPageInspectorController {
Ref<Inspector::BackendDispatcher> m_backendDispatcher;
Inspector::AgentRegistry m_agents;

CheckedRef<WebPageProxy> m_inspectedPage;
WeakRef<WebPageProxy> m_inspectedPage;

Inspector::InspectorTargetAgent* m_targetAgent { nullptr };
HashMap<String, std::unique_ptr<InspectorTargetProxy>> m_targets;
Expand Down
Loading

0 comments on commit 1d60d45

Please sign in to comment.