Skip to content

Commit

Permalink
Make DrawingAreaProxy ref-counted as it is a MessageReceiver
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=283855

Reviewed by Geoffrey Garen.

* Source/WebKit/Scripts/webkit/messages.py:
(generate_message_handler):
* Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* Source/WebKit/UIProcess/API/gtk/PageClientImpl.h:
* Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* Source/WebKit/UIProcess/API/wpe/PageClientImpl.h:
* Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp:
(WebKit::DrawingAreaProxyCoordinatedGraphics::create):
(WebKit::DrawingAreaProxyCoordinatedGraphics::forceUpdateIfNeeded):
(WebKit::DrawingAreaProxyCoordinatedGraphics::incorporateUpdate):
(WebKit::DrawingAreaProxyCoordinatedGraphics::displayNominalFramesPerSecond):
(WebKit::DrawingAreaProxyCoordinatedGraphics::sizeDidChange):
(WebKit::DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange):
(WebKit::DrawingAreaProxyCoordinatedGraphics::alwaysUseCompositing const):
(WebKit::DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode):
(WebKit::DrawingAreaProxyCoordinatedGraphics::exitAcceleratedCompositingMode):
(WebKit::DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode):
(WebKit::DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing):
* Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.h:
* Source/WebKit/UIProcess/DrawingAreaProxy.cpp:
(WebKit::DrawingAreaProxy::protectedWebPageProxy const):
(WebKit::DrawingAreaProxy::page const):
(WebKit::DrawingAreaProxy::viewExposedRectChangedTimerFired):
* Source/WebKit/UIProcess/DrawingAreaProxy.h:
* Source/WebKit/UIProcess/DrawingAreaProxy.messages.in:
* Source/WebKit/UIProcess/PageClient.h:
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::takeDrawingArea):
* Source/WebKit/UIProcess/ProvisionalPageProxy.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::create):
(WebKit::RemoteLayerTreeDrawingAreaProxy::sizeDidChange):
(WebKit::RemoteLayerTreeDrawingAreaProxy::remotePageProcessDidTerminate):
(WebKit::RemoteLayerTreeDrawingAreaProxy::viewWillStartLiveResize):
(WebKit::RemoteLayerTreeDrawingAreaProxy::viewWillEndLiveResize):
(WebKit::RemoteLayerTreeDrawingAreaProxy::deviceScaleFactorDidChange):
(WebKit::RemoteLayerTreeDrawingAreaProxy::didUpdateGeometry):
(WebKit::RemoteLayerTreeDrawingAreaProxy::sendUpdateGeometry):
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTreeNotTriggered):
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTreeTransaction):
(WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorLocation const):
(WebKit::RemoteLayerTreeDrawingAreaProxy::indicatorScale const):
(WebKit::RemoteLayerTreeDrawingAreaProxy::updateDebugIndicator):
(WebKit::RemoteLayerTreeDrawingAreaProxy::didRefreshDisplay):
(WebKit::RemoteLayerTreeDrawingAreaProxy::windowKindDidChange):
(WebKit::RemoteLayerTreeDrawingAreaProxy::minimumSizeForAutoLayoutDidChange):
(WebKit::RemoteLayerTreeDrawingAreaProxy::sizeToContentAutoSizeMaximumSizeDidChange):
(WebKit::RemoteLayerTreeDrawingAreaProxy::animationsWereAddedToNode):
(WebKit::RemoteLayerTreeDrawingAreaProxy::animationsWereRemovedFromNode):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::setDrawingArea):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.h:
* Source/WebKit/UIProcess/ios/PageClientImplIOS.mm:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* Source/WebKit/UIProcess/ios/WKContentView.h:
* Source/WebKit/UIProcess/ios/WKContentView.mm:
(-[WKContentView _createDrawingAreaProxy:]):
* Source/WebKit/UIProcess/mac/PageClientImplMac.h:
* Source/WebKit/UIProcess/mac/PageClientImplMac.mm:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.h:
* Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::create):
(WebKit::TiledCoreAnimationDrawingAreaProxy::TiledCoreAnimationDrawingAreaProxy):
(WebKit::TiledCoreAnimationDrawingAreaProxy::deviceScaleFactorDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::sizeDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::minimumSizeForAutoLayoutDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::sizeToContentAutoSizeMaximumSizeDidChange):
(WebKit::TiledCoreAnimationDrawingAreaProxy::enterAcceleratedCompositingMode):
(WebKit::TiledCoreAnimationDrawingAreaProxy::updateAcceleratedCompositingMode):
(WebKit::TiledCoreAnimationDrawingAreaProxy::~TiledCoreAnimationDrawingAreaProxy): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::didFirstLayerFlush): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::didUpdateGeometry): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::waitForDidUpdateActivityState): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::willSendUpdateGeometry): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::createFence): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::sendUpdateGeometry): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::adjustTransientZoom): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::commitTransientZoom): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchPresentationCallbacksAfterFlushingLayers): Deleted.
(WebKit::TiledCoreAnimationDrawingAreaProxy::displayNominalFramesPerSecond): Deleted.
* Source/WebKit/UIProcess/mac/WebViewImpl.h:
* Source/WebKit/UIProcess/mac/WebViewImpl.mm:
(WebKit::WebViewImpl::createDrawingAreaProxy):
* Source/WebKit/UIProcess/playstation/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* Source/WebKit/UIProcess/playstation/PageClientImpl.h:
* Source/WebKit/UIProcess/wc/DrawingAreaProxyWC.cpp:
(WebKit::DrawingAreaProxyWC::create):
(WebKit::DrawingAreaProxyWC::sizeDidChange):
(WebKit::DrawingAreaProxyWC::incorporateUpdate):
* Source/WebKit/UIProcess/wc/DrawingAreaProxyWC.h:
* Source/WebKit/UIProcess/win/PageClientImpl.cpp:
(WebKit::PageClientImpl::createDrawingAreaProxy):
* Source/WebKit/UIProcess/win/PageClientImpl.h:

Canonical link: https://commits.webkit.org/287188@main
  • Loading branch information
cdumez committed Dec 1, 2024
1 parent 944567b commit 5c8281f
Show file tree
Hide file tree
Showing 42 changed files with 331 additions and 170 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ UIProcess/ProvisionalFrameProxy.cpp
UIProcess/ProvisionalPageProxy.cpp
UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm
UIProcess/RemoteLayerTree/RemoteLayerTreeScrollingPerformanceData.mm
UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
UIProcess/RemoteLayerTree/mac/RemoteLayerTreeEventDispatcher.cpp
UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm
Expand Down
10 changes: 3 additions & 7 deletions Source/WebKit/Scripts/webkit/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@

WANTS_DISPATCH_MESSAGE_ATTRIBUTE = 'WantsDispatchMessage'
WANTS_ASYNC_DISPATCH_MESSAGE_ATTRIBUTE = 'WantsAsyncDispatchMessage'
NOT_REFCOUNTED_RECEIVER_ATTRIBUTE = 'NotRefCounted'
NOT_STREAM_ENCODABLE_ATTRIBUTE = 'NotStreamEncodable'
NOT_STREAM_ENCODABLE_REPLY_ATTRIBUTE = 'NotStreamEncodableReply'
STREAM_BATCHED_ATTRIBUTE = 'StreamBatched'
Expand Down Expand Up @@ -1436,8 +1435,7 @@ def collect_message_statements(messages, message_statement_function):
result += generate_enabled_by_for_receiver(receiver, receiver.messages)
assert(not receiver.has_attribute(WANTS_DISPATCH_MESSAGE_ATTRIBUTE))
assert(not receiver.has_attribute(WANTS_ASYNC_DISPATCH_MESSAGE_ATTRIBUTE))
if not receiver.has_attribute(NOT_REFCOUNTED_RECEIVER_ATTRIBUTE):
result.append(' Ref protectedThis { *this };\n')
result.append(' Ref protectedThis { *this };\n')
result += async_message_statements
result += sync_message_statements
if (receiver.superclass):
Expand All @@ -1454,8 +1452,7 @@ def collect_message_statements(messages, message_statement_function):
result.append('{\n')
enable_by_statement = generate_enabled_by_for_receiver(receiver, async_messages)
result += enable_by_statement
if not receiver.has_attribute(NOT_REFCOUNTED_RECEIVER_ATTRIBUTE):
result.append(' Ref protectedThis { *this };\n')
result.append(' Ref protectedThis { *this };\n')
result += async_message_statements
if receiver.has_attribute(WANTS_DISPATCH_MESSAGE_ATTRIBUTE) or receiver.has_attribute(WANTS_ASYNC_DISPATCH_MESSAGE_ATTRIBUTE):
result.append(' if (dispatchMessage(connection, decoder))\n')
Expand All @@ -1474,8 +1471,7 @@ def collect_message_statements(messages, message_statement_function):
result.append('bool %s::didReceiveSyncMessage(IPC::Connection& connection, IPC::Decoder& decoder, UniqueRef<IPC::Encoder>& replyEncoder)\n' % (receiver.name))
result.append('{\n')
result += generate_enabled_by_for_receiver(receiver, sync_messages, 'false')
if not receiver.has_attribute(NOT_REFCOUNTED_RECEIVER_ATTRIBUTE):
result.append(' Ref protectedThis { *this };\n')
result.append(' Ref protectedThis { *this };\n')
result += sync_message_statements
if receiver.has_attribute(WANTS_DISPATCH_MESSAGE_ATTRIBUTE):
result.append(' if (dispatchSyncMessage(connection, decoder, replyEncoder))\n')
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/API/gtk/PageClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ PageClientImpl::PageClientImpl(GtkWidget* viewWidget)
}

// PageClient's pure virtual functions
std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy(WebProcessProxy& webProcessProxy)
Ref<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy(WebProcessProxy& webProcessProxy)
{
return makeUnique<DrawingAreaProxyCoordinatedGraphics>(*webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget)), webProcessProxy);
return DrawingAreaProxyCoordinatedGraphics::create(*webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_viewWidget)), webProcessProxy);
}

#if !USE(GTK4)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/API/gtk/PageClientImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class PageClientImpl : public PageClient

private:
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
Ref<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
void setViewNeedsDisplay(const WebCore::Region&) override;
void requestScroll(const WebCore::FloatPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, WebCore::ScrollIsAnimated) override;
void requestScrollToRect(const WebCore::FloatRect& targetRect, const WebCore::FloatPoint& origin) override;
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/API/wpe/PageClientImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ UnixFileDescriptor PageClientImpl::hostFileDescriptor()
return UnixFileDescriptor { wpe_view_backend_get_renderer_host_fd(m_view.backend()), UnixFileDescriptor::Adopt };
}

std::unique_ptr<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy(WebProcessProxy& webProcessProxy)
Ref<DrawingAreaProxy> PageClientImpl::createDrawingAreaProxy(WebProcessProxy& webProcessProxy)
{
return makeUnique<DrawingAreaProxyCoordinatedGraphics>(m_view.page(), webProcessProxy);
return DrawingAreaProxyCoordinatedGraphics::create(m_view.page(), webProcessProxy);
}

void PageClientImpl::setViewNeedsDisplay(const WebCore::Region&)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/API/wpe/PageClientImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class PageClientImpl final : public PageClient

private:
// PageClient
std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
Ref<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) override;
void setViewNeedsDisplay(const WebCore::Region&) override;
void requestScroll(const WebCore::FloatPoint&, const WebCore::IntPoint&, WebCore::ScrollIsAnimated) override;
WebCore::FloatPoint viewScrollPosition() override;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@ using namespace WebCore;

WTF_MAKE_TZONE_ALLOCATED_IMPL(DrawingAreaProxyCoordinatedGraphics);

Ref<DrawingAreaProxyCoordinatedGraphics> DrawingAreaProxyCoordinatedGraphics::create(WebPageProxy& page, WebProcessProxy& webProcessProxy)
{
return adoptRef(*new DrawingAreaProxyCoordinatedGraphics(page, webProcessProxy));
}

DrawingAreaProxyCoordinatedGraphics::DrawingAreaProxyCoordinatedGraphics(WebPageProxy& webPageProxy, WebProcessProxy& webProcessProxy)
: DrawingAreaProxy(DrawingAreaType::CoordinatedGraphics, webPageProxy, webProcessProxy)
#if !PLATFORM(WPE)
Expand Down Expand Up @@ -102,7 +107,11 @@ bool DrawingAreaProxyCoordinatedGraphics::forceUpdateIfNeeded()
if (m_isWaitingForDidUpdateGeometry)
return false;

if (!protectedWebPageProxy()->isViewVisible())
RefPtr page = m_webPageProxy.get();
if (!page)
return false;

if (!page->isViewVisible())
return false;

SetForScope inForceUpdate(m_inForceUpdate, true);
Expand All @@ -126,21 +135,27 @@ void DrawingAreaProxyCoordinatedGraphics::incorporateUpdate(UpdateInfo&& updateI
return;
}

RefPtr page = m_webPageProxy.get();
if (!page)
return;

Region damageRegion;
if (updateInfo.scrollRect.isEmpty()) {
for (const auto& rect : updateInfo.updateRects)
damageRegion.unite(rect);
} else
damageRegion = IntRect(IntPoint(), m_webPageProxy->viewSize());
damageRegion = IntRect(IntPoint(), page->viewSize());

m_backingStore->incorporateUpdate(WTFMove(updateInfo));
protectedWebPageProxy()->setViewNeedsDisplay(damageRegion);
page->setViewNeedsDisplay(damageRegion);
}
#endif

#if HAVE(DISPLAY_LINK)
std::optional<WebCore::FramesPerSecond> DrawingAreaProxyCoordinatedGraphics::displayNominalFramesPerSecond()
{
if (!m_webPageProxy)
return std::nullopt;
if (auto displayId = m_webPageProxy->displayID())
return m_webPageProxy->legacyMainFrameProcess().nominalFramesPerSecondForDisplay(displayId.value());
return std::nullopt;
Expand All @@ -149,7 +164,7 @@ std::optional<WebCore::FramesPerSecond> DrawingAreaProxyCoordinatedGraphics::dis

void DrawingAreaProxyCoordinatedGraphics::sizeDidChange()
{
if (!m_webPageProxy->hasRunningProcess())
if (!m_webPageProxy || !m_webPageProxy->hasRunningProcess())
return;

if (m_isWaitingForDidUpdateGeometry)
Expand All @@ -160,7 +175,8 @@ void DrawingAreaProxyCoordinatedGraphics::sizeDidChange()

void DrawingAreaProxyCoordinatedGraphics::deviceScaleFactorDidChange(CompletionHandler<void()>&& completionHandler)
{
send(Messages::DrawingArea::SetDeviceScaleFactor(m_webPageProxy->deviceScaleFactor()));
if (m_webPageProxy)
send(Messages::DrawingArea::SetDeviceScaleFactor(m_webPageProxy->deviceScaleFactor()));
completionHandler();
}

Expand Down Expand Up @@ -227,6 +243,8 @@ void DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode(uint6

bool DrawingAreaProxyCoordinatedGraphics::alwaysUseCompositing() const
{
if (!m_webPageProxy)
return false;
return m_webPageProxy->preferences().acceleratedCompositingEnabled() && m_webPageProxy->preferences().forceCompositingMode();
}

Expand All @@ -237,23 +255,26 @@ void DrawingAreaProxyCoordinatedGraphics::enterAcceleratedCompositingMode(const
m_backingStore = nullptr;
#endif
m_layerTreeContext = layerTreeContext;
protectedWebPageProxy()->enterAcceleratedCompositingMode(layerTreeContext);
if (RefPtr page = m_webPageProxy.get())
page->enterAcceleratedCompositingMode(layerTreeContext);
}

void DrawingAreaProxyCoordinatedGraphics::exitAcceleratedCompositingMode()
{
ASSERT(isInAcceleratedCompositingMode());

m_layerTreeContext = { };
protectedWebPageProxy()->exitAcceleratedCompositingMode();
if (RefPtr page = m_webPageProxy.get())
page->exitAcceleratedCompositingMode();
}

void DrawingAreaProxyCoordinatedGraphics::updateAcceleratedCompositingMode(const LayerTreeContext& layerTreeContext)
{
ASSERT(isInAcceleratedCompositingMode());

m_layerTreeContext = layerTreeContext;
protectedWebPageProxy()->updateAcceleratedCompositingMode(layerTreeContext);
if (RefPtr page = m_webPageProxy.get())
page->updateAcceleratedCompositingMode(layerTreeContext);
}

void DrawingAreaProxyCoordinatedGraphics::sendUpdateGeometry()
Expand Down Expand Up @@ -336,14 +357,14 @@ void DrawingAreaProxyCoordinatedGraphics::DrawingMonitor::stop()

void DrawingAreaProxyCoordinatedGraphics::dispatchAfterEnsuringDrawing(CompletionHandler<void()>&& callbackFunction)
{
auto webPageProxy = protectedWebPageProxy();
if (!webPageProxy->hasRunningProcess()) {
RefPtr webPageProxy = m_webPageProxy.get();
if (!webPageProxy || !webPageProxy->hasRunningProcess()) {
callbackFunction();
return;
}

if (!m_drawingMonitor)
m_drawingMonitor = makeUnique<DrawingAreaProxyCoordinatedGraphics::DrawingMonitor>(webPageProxy);
m_drawingMonitor = makeUnique<DrawingAreaProxyCoordinatedGraphics::DrawingMonitor>(*webPageProxy);
m_drawingMonitor->start(WTFMove(callbackFunction));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@

#include "DrawingAreaProxy.h"
#include "LayerTreeContext.h"
#include <wtf/RefCounted.h>
#include <wtf/RunLoop.h>
#include <wtf/TZoneMalloc.h>

Expand All @@ -42,14 +43,17 @@ class Region;

namespace WebKit {

class DrawingAreaProxyCoordinatedGraphics final : public DrawingAreaProxy {
class DrawingAreaProxyCoordinatedGraphics final : public DrawingAreaProxy, public RefCounted<DrawingAreaProxyCoordinatedGraphics> {
WTF_MAKE_TZONE_ALLOCATED(DrawingAreaProxyCoordinatedGraphics);
WTF_MAKE_NONCOPYABLE(DrawingAreaProxyCoordinatedGraphics);
WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR(DrawingAreaProxyCoordinatedGraphics);
public:
DrawingAreaProxyCoordinatedGraphics(WebPageProxy&, WebProcessProxy&);
static Ref<DrawingAreaProxyCoordinatedGraphics> create(WebPageProxy&, WebProcessProxy&);
virtual ~DrawingAreaProxyCoordinatedGraphics();

void ref() const final { RefCounted::ref(); }
void deref() const final { RefCounted::deref(); }

#if !PLATFORM(WPE)
void paint(PlatformPaintContextPtr, const WebCore::IntRect&, WebCore::Region& unpaintedRegion);
#endif
Expand All @@ -60,6 +64,8 @@ class DrawingAreaProxyCoordinatedGraphics final : public DrawingAreaProxy {
void dispatchAfterEnsuringDrawing(CompletionHandler<void()>&&);

private:
DrawingAreaProxyCoordinatedGraphics(WebPageProxy&, WebProcessProxy&);

// DrawingAreaProxy
void sizeDidChange() override;
void deviceScaleFactorDidChange(CompletionHandler<void()>&&) override;
Expand Down
10 changes: 5 additions & 5 deletions Source/WebKit/UIProcess/DrawingAreaProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ DrawingAreaProxy::DrawingAreaProxy(DrawingAreaType type, WebPageProxy& webPagePr

DrawingAreaProxy::~DrawingAreaProxy() = default;

Ref<WebPageProxy> DrawingAreaProxy::protectedWebPageProxy() const
RefPtr<WebPageProxy> DrawingAreaProxy::protectedWebPageProxy() const
{
return m_webPageProxy.get();
}
Expand Down Expand Up @@ -120,9 +120,9 @@ bool DrawingAreaProxy::setSize(const IntSize& size, const IntSize& scrollDelta)
return true;
}

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

#if PLATFORM(COCOA)
Expand All @@ -144,8 +144,8 @@ void DrawingAreaProxy::didChangeViewExposedRect()

void DrawingAreaProxy::viewExposedRectChangedTimerFired()
{
Ref webPageProxy = m_webPageProxy.get();
if (!webPageProxy->hasRunningProcess())
RefPtr webPageProxy = m_webPageProxy.get();
if (!webPageProxy || !webPageProxy->hasRunningProcess())
return;

auto viewExposedRect = webPageProxy->viewExposedRect();
Expand Down
9 changes: 5 additions & 4 deletions Source/WebKit/UIProcess/DrawingAreaProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include <WebCore/IntSize.h>
#include <WebCore/ProcessIdentifier.h>
#include <stdint.h>
#include <wtf/AbstractRefCounted.h>
#include <wtf/Identified.h>
#include <wtf/Noncopyable.h>
#include <wtf/RunLoop.h>
Expand Down Expand Up @@ -65,7 +66,7 @@ class WebProcessProxy;
struct UpdateInfo;
#endif

class DrawingAreaProxy : public IPC::MessageReceiver, public IPC::MessageSender, public Identified<DrawingAreaIdentifier>, public CanMakeCheckedPtr<DrawingAreaProxy> {
class DrawingAreaProxy : public IPC::MessageReceiver, public IPC::MessageSender, public Identified<DrawingAreaIdentifier>, public AbstractRefCounted, public CanMakeCheckedPtr<DrawingAreaProxy> {
WTF_MAKE_TZONE_ALLOCATED(DrawingAreaProxy);
WTF_MAKE_NONCOPYABLE(DrawingAreaProxy);
WTF_OVERRIDE_DELETE_FOR_CHECKED_PTR(DrawingAreaProxy);
Expand Down Expand Up @@ -129,7 +130,7 @@ class DrawingAreaProxy : public IPC::MessageReceiver, public IPC::MessageSender,
virtual bool shouldCoalesceVisualEditorStateUpdates() const { return false; }
virtual bool shouldSendWheelEventsToEventDispatcher() const { return false; }

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

Expand All @@ -150,11 +151,11 @@ class DrawingAreaProxy : public IPC::MessageReceiver, public IPC::MessageSender,
protected:
DrawingAreaProxy(DrawingAreaType, WebPageProxy&, WebProcessProxy&);

Ref<WebPageProxy> protectedWebPageProxy() const;
RefPtr<WebPageProxy> protectedWebPageProxy() const;
Ref<WebProcessProxy> protectedWebProcessProxy() const;

DrawingAreaType m_type;
WeakRef<WebPageProxy> m_webPageProxy;
WeakPtr<WebPageProxy> m_webPageProxy;
Ref<WebProcessProxy> m_webProcessProxy;

WebCore::IntSize m_size;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/DrawingAreaProxy.messages.in
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

messages -> DrawingAreaProxy NotRefCounted {
messages -> DrawingAreaProxy {
EnterAcceleratedCompositingMode(uint64_t backingStoreStateID, WebKit::LayerTreeContext context)
UpdateAcceleratedCompositingMode(uint64_t backingStoreStateID, WebKit::LayerTreeContext context)
DidFirstLayerFlush(uint64_t backingStoreStateID, WebKit::LayerTreeContext context)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/PageClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ class PageClient : public CanMakeWeakPtr<PageClient> {
void deref() { derefView(); }

// Create a new drawing area proxy for the given page.
virtual std::unique_ptr<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) = 0;
virtual Ref<DrawingAreaProxy> createDrawingAreaProxy(WebProcessProxy&) = 0;

// Tell the view to invalidate the given region. The region is in view coordinates.
virtual void setViewNeedsDisplay(const WebCore::Region&) = 0;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ void ProvisionalPageProxy::processDidTerminate()
page->provisionalProcessDidTerminate();
}

std::unique_ptr<DrawingAreaProxy> ProvisionalPageProxy::takeDrawingArea()
RefPtr<DrawingAreaProxy> ProvisionalPageProxy::takeDrawingArea()
{
return WTFMove(m_drawingArea);
}
Expand Down
4 changes: 2 additions & 2 deletions Source/WebKit/UIProcess/ProvisionalPageProxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ class ProvisionalPageProxy final : public IPC::MessageReceiver, public IPC::Mess
bool isProcessSwappingOnNavigationResponse() const { return m_isProcessSwappingOnNavigationResponse; }

DrawingAreaProxy* drawingArea() const { return m_drawingArea.get(); }
std::unique_ptr<DrawingAreaProxy> takeDrawingArea();
RefPtr<DrawingAreaProxy> takeDrawingArea();

void setNavigation(API::Navigation&);

Expand Down Expand Up @@ -208,7 +208,7 @@ class ProvisionalPageProxy final : public IPC::MessageReceiver, public IPC::Mess
// Keep WebsiteDataStore alive for provisional page load.
RefPtr<WebsiteDataStore> m_websiteDataStore;

std::unique_ptr<DrawingAreaProxy> m_drawingArea;
RefPtr<DrawingAreaProxy> m_drawingArea;
RefPtr<WebFrameProxy> m_mainFrame;
RefPtr<WebsiteDataStore> m_replacedDataStoreForWebArchiveLoad;
WebCore::NavigationIdentifier m_navigationID;
Expand Down
Loading

0 comments on commit 5c8281f

Please sign in to comment.