Thread some references through the remote layer tree code
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jun 2014 00:51:33 +0000 (00:51 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 23 Jun 2014 00:51:33 +0000 (00:51 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134177

Reviewed by Zalan Bujtas.

A first pass at references for never-null things (first pass because I didn't touch the collections).
Things that aren't straightforward reference-threading:

* Shared/mac/RemoteLayerBackingStoreCollection.h:
* Shared/mac/RemoteLayerBackingStoreCollection.mm:
Remove the unimplemented/nonexistant RemoteLayerBackingStoreCollection::create.
Make RemoteLayerBackingStoreCollection constructor not take a context, because m_context is never used.

* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
Factor out grabbing the PlatformLayerID in a few places.

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
Use WebPage::mainFrameView() instead of WebPage::corePage()->mainFrame().view().

* Shared/mac/RemoteLayerTreeTransaction.h:
* Shared/mac/RemoteLayerTreeTransaction.mm:
* WebProcess/WebPage/DrawingArea.cpp:
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/WebPage.cpp:
* WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h:
* WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:om):
* WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
* WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:
* Shared/mac/RemoteLayerBackingStore.mm:
References.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@170274 268f45cc-cd09-0410-ab3c-d52691b4dbfc

22 files changed:
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm
Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.h
Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm
Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h
Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm
Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/DrawingArea.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/mac/GraphicsLayerCARemote.h
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm

index 3ccc7413035ce6ebb8681fe0c2bb9474f5af9163..5e04ded75e9bf8f6fa368386d217e71e92cede80 100644 (file)
@@ -1,3 +1,43 @@
+2014-06-22  Tim Horton  <timothy_horton@apple.com>
+
+        Thread some references through the remote layer tree code
+        https://bugs.webkit.org/show_bug.cgi?id=134177
+
+        Reviewed by Zalan Bujtas.
+
+        A first pass at references for never-null things (first pass because I didn't touch the collections).
+        Things that aren't straightforward reference-threading:
+
+        * Shared/mac/RemoteLayerBackingStoreCollection.h:
+        * Shared/mac/RemoteLayerBackingStoreCollection.mm:
+        Remove the unimplemented/nonexistant RemoteLayerBackingStoreCollection::create.
+        Make RemoteLayerBackingStoreCollection constructor not take a context, because m_context is never used.
+
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+        Factor out grabbing the PlatformLayerID in a few places.
+
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        Use WebPage::mainFrameView() instead of WebPage::corePage()->mainFrame().view().
+
+        * Shared/mac/RemoteLayerTreeTransaction.h:
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        * WebProcess/WebPage/DrawingArea.cpp:
+        * WebProcess/WebPage/DrawingArea.h:
+        * WebProcess/WebPage/WebPage.cpp:
+        * WebProcess/WebPage/mac/GraphicsLayerCARemote.h:
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.h:
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteCustom.mm:om):
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.cpp:
+        * WebProcess/WebPage/mac/PlatformCALayerRemoteTiledBacking.h:
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        References.
+        
 2014-06-22  Anders Carlsson  <andersca@apple.com>
 
         Replace a couple of uses of bind with lambdas
index 81f6f39d802aff39787a1c4b474b55e3366469e3..a3152fd0bcdd9493dde2f7a6bcbfdd319db7d111 100644 (file)
@@ -63,7 +63,7 @@ RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer)
     if (!m_layer)
         return;
     if (RemoteLayerTreeContext* context = m_layer->context())
-        context->backingStoreWasCreated(this);
+        context->backingStoreWasCreated(*this);
 }
 
 RemoteLayerBackingStore::~RemoteLayerBackingStore()
@@ -73,7 +73,7 @@ RemoteLayerBackingStore::~RemoteLayerBackingStore()
     if (!m_layer)
         return;
     if (RemoteLayerTreeContext* context = m_layer->context())
-        context->backingStoreWillBeDestroyed(this);
+        context->backingStoreWillBeDestroyed(*this);
 }
 
 void RemoteLayerBackingStore::ensureBackingStore(FloatSize size, float scale, bool acceleratesDrawing, bool isOpaque)
@@ -204,7 +204,7 @@ bool RemoteLayerBackingStore::display()
     m_lastDisplayTime = std::chrono::steady_clock::now();
 
     if (RemoteLayerTreeContext* context = m_layer->context())
-        context->backingStoreWillBeDisplayed(this);
+        context->backingStoreWillBeDisplayed(*this);
 
     // Make the previous front buffer non-volatile early, so that we can dirty the whole layer if it comes back empty.
     setBufferVolatility(BufferType::Front, false);
index 81d2b107f15dc0db97e613f77ffe00f3a72531d8..d223cb723ac2e4356c2c94a6691e274474d00b44 100644 (file)
@@ -40,14 +40,13 @@ class RemoteLayerBackingStoreCollection {
     WTF_MAKE_NONCOPYABLE(RemoteLayerBackingStoreCollection);
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    static std::unique_ptr<RemoteLayerBackingStoreCollection> create(RemoteLayerTreeContext*);
-    RemoteLayerBackingStoreCollection(RemoteLayerTreeContext*);
+    RemoteLayerBackingStoreCollection();
 
-    void backingStoreWasCreated(RemoteLayerBackingStore*);
-    void backingStoreWillBeDestroyed(RemoteLayerBackingStore*);
+    void backingStoreWasCreated(RemoteLayerBackingStore&);
+    void backingStoreWillBeDestroyed(RemoteLayerBackingStore&);
 
-    void backingStoreWillBeDisplayed(RemoteLayerBackingStore*);
-    void backingStoreBecameUnreachable(RemoteLayerBackingStore*);
+    void backingStoreWillBeDisplayed(RemoteLayerBackingStore&);
+    void backingStoreBecameUnreachable(RemoteLayerBackingStore&);
 
     void willFlushLayers();
     void willCommitLayerTree(RemoteLayerTreeTransaction&);
@@ -65,7 +64,6 @@ private:
     HashSet<RemoteLayerBackingStore*> m_unparentedBackingStore;
     HashSet<RemoteLayerBackingStore*> m_reachableBackingStoreInLatestFlush;
 
-    RemoteLayerTreeContext* m_context;
     WebCore::Timer<RemoteLayerBackingStoreCollection> m_volatilityTimer;
 
     bool m_inLayerFlush;
index d1d9583212c4bb1de64cc6b9ad174b2eff2c6d84..3e6646475741241404450cb97c7a426802fb3783 100644 (file)
@@ -36,9 +36,8 @@ const std::chrono::milliseconds volatilityTimerInterval = 200_ms;
 
 namespace WebKit {
 
-RemoteLayerBackingStoreCollection::RemoteLayerBackingStoreCollection(RemoteLayerTreeContext* context)
-    : m_context(context)
-    , m_volatilityTimer(this, &RemoteLayerBackingStoreCollection::volatilityTimerFired)
+RemoteLayerBackingStoreCollection::RemoteLayerBackingStoreCollection()
+    : m_volatilityTimer(this, &RemoteLayerBackingStoreCollection::volatilityTimerFired)
     , m_inLayerFlush(false)
 {
 }
@@ -72,32 +71,32 @@ void RemoteLayerBackingStoreCollection::didFlushLayers()
     }
 
     for (auto& backingStore : newlyUnreachableBackingStore)
-        backingStoreBecameUnreachable(backingStore);
+        backingStoreBecameUnreachable(*backingStore);
 
     if (!newlyUnreachableBackingStore.isEmpty())
         scheduleVolatilityTimer();
 }
 
-void RemoteLayerBackingStoreCollection::backingStoreWasCreated(RemoteLayerBackingStore* backingStore)
+void RemoteLayerBackingStoreCollection::backingStoreWasCreated(RemoteLayerBackingStore& backingStore)
 {
-    m_liveBackingStore.add(backingStore);
+    m_liveBackingStore.add(&backingStore);
 }
 
-void RemoteLayerBackingStoreCollection::backingStoreWillBeDestroyed(RemoteLayerBackingStore* backingStore)
+void RemoteLayerBackingStoreCollection::backingStoreWillBeDestroyed(RemoteLayerBackingStore& backingStore)
 {
-    m_liveBackingStore.remove(backingStore);
-    m_unparentedBackingStore.remove(backingStore);
+    m_liveBackingStore.remove(&backingStore);
+    m_unparentedBackingStore.remove(&backingStore);
 }
 
-void RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed(RemoteLayerBackingStore* backingStore)
+void RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed(RemoteLayerBackingStore& backingStore)
 {
     ASSERT(m_inLayerFlush);
-    m_reachableBackingStoreInLatestFlush.add(backingStore);
+    m_reachableBackingStoreInLatestFlush.add(&backingStore);
 
-    auto backingStoreIter = m_unparentedBackingStore.find(backingStore);
+    auto backingStoreIter = m_unparentedBackingStore.find(&backingStore);
     if (backingStoreIter == m_unparentedBackingStore.end())
         return;
-    m_liveBackingStore.add(backingStore);
+    m_liveBackingStore.add(&backingStore);
     m_unparentedBackingStore.remove(backingStoreIter);
 }
 
@@ -132,23 +131,23 @@ bool RemoteLayerBackingStoreCollection::markBackingStoreVolatile(RemoteLayerBack
     return markBackingStoreVolatileImmediately(backingStore);
 }
 
-void RemoteLayerBackingStoreCollection::backingStoreBecameUnreachable(RemoteLayerBackingStore* backingStore)
+void RemoteLayerBackingStoreCollection::backingStoreBecameUnreachable(RemoteLayerBackingStore& backingStore)
 {
-    ASSERT(backingStore->layer());
+    ASSERT(backingStore.layer());
 
-    auto backingStoreIter = m_liveBackingStore.find(backingStore);
+    auto backingStoreIter = m_liveBackingStore.find(&backingStore);
     if (backingStoreIter == m_liveBackingStore.end())
         return;
-    m_unparentedBackingStore.add(backingStore);
+    m_unparentedBackingStore.add(&backingStore);
     m_liveBackingStore.remove(backingStoreIter);
 
     // If a layer with backing store is removed from the tree, mark it as having changed backing store, so that
     // on the commit which returns it to the tree, we serialize the backing store (despite possibly not painting).
-    backingStore->layer()->properties().notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
+    backingStore.layer()->properties().notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
 
     // This will not succeed in marking all buffers as volatile, because the commit unparenting the layer hasn't
     // made it to the UI process yet. The volatility timer will finish marking the remaining buffers later.
-    markBackingStoreVolatileImmediately(*backingStore);
+    markBackingStoreVolatileImmediately(backingStore);
 }
 
 void RemoteLayerBackingStoreCollection::volatilityTimerFired(WebCore::Timer<RemoteLayerBackingStoreCollection>&)
index 277b33ce38a6f2a8fbf817a00f13af0f0df75b33..43071886a229f243e7bed43a371c920c2251b474 100644 (file)
@@ -162,7 +162,7 @@ public:
 
     WebCore::GraphicsLayer::PlatformLayerID rootLayerID() const { return m_rootLayerID; }
     void setRootLayerID(WebCore::GraphicsLayer::PlatformLayerID);
-    void layerPropertiesChanged(PlatformCALayerRemote*);
+    void layerPropertiesChanged(PlatformCALayerRemote&);
     void setCreatedLayers(Vector<LayerCreationProperties>);
     void setDestroyedLayerIDs(Vector<WebCore::GraphicsLayer::PlatformLayerID>);
     void setLayerIDsWithNewlyUnreachableBackingStore(Vector<WebCore::GraphicsLayer::PlatformLayerID>);
index 60a6440c24d87faafa28979f2ac8a5926849e305..e96eaf0fa460d68f47bee13c8e1f87c4013ed6b9 100644 (file)
@@ -559,9 +559,9 @@ void RemoteLayerTreeTransaction::setRootLayerID(GraphicsLayer::PlatformLayerID r
     m_rootLayerID = rootLayerID;
 }
 
-void RemoteLayerTreeTransaction::layerPropertiesChanged(PlatformCALayerRemote* remoteLayer)
+void RemoteLayerTreeTransaction::layerPropertiesChanged(PlatformCALayerRemote& remoteLayer)
 {
-    m_changedLayers.append(remoteLayer);
+    m_changedLayers.append(&remoteLayer);
 }
 
 void RemoteLayerTreeTransaction::setCreatedLayers(Vector<LayerCreationProperties> createdLayers)
index 898af7139bb605b0503daf7254e635201fae7984..8c8e3cb440f44d7ecb4a3bfa907aee25edbe2dd7 100644 (file)
@@ -47,7 +47,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-std::unique_ptr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPageCreationParameters& parameters)
+std::unique_ptr<DrawingArea> DrawingArea::create(WebPage& webPage, const WebPageCreationParameters& parameters)
 {
     switch (parameters.drawingAreaType) {
 #if PLATFORM(COCOA)
@@ -71,7 +71,7 @@ std::unique_ptr<DrawingArea> DrawingArea::create(WebPage* webPage, const WebPage
     return nullptr;
 }
 
-DrawingArea::DrawingArea(DrawingAreaType type, WebPage* webPage)
+DrawingArea::DrawingArea(DrawingAreaType type, WebPage& webPage)
     : m_type(type)
     , m_webPage(webPage)
 {
index 8d0dd137ef3ce4b6a7ab0f1be0ace391c115ded4..cef12a3006751ecb7a333a988659b4b9344c7210 100644 (file)
@@ -60,7 +60,7 @@ class DrawingArea {
     WTF_MAKE_NONCOPYABLE(DrawingArea);
 
 public:
-    static std::unique_ptr<DrawingArea> create(WebPage*, const WebPageCreationParameters&);
+    static std::unique_ptr<DrawingArea> create(WebPage&, const WebPageCreationParameters&);
     virtual ~DrawingArea();
     
     DrawingAreaType type() const { return m_type; }
@@ -118,10 +118,10 @@ public:
     virtual void setLayerHostingMode(LayerHostingMode) { }
 
 protected:
-    DrawingArea(DrawingAreaType, WebPage*);
+    DrawingArea(DrawingAreaType, WebPage&);
 
     DrawingAreaType m_type;
-    WebPage* m_webPage;
+    WebPage& m_webPage;
 
 private:
     // Message handlers.
index a0734f2c77ccdb849a51f3d1206cf635b889e50d..660ad4fee4da72cf43423b18f4b494dfb4bd801c 100644 (file)
@@ -354,7 +354,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
 
     m_page = std::make_unique<Page>(pageClients);
 
-    m_drawingArea = DrawingArea::create(this, parameters);
+    m_drawingArea = DrawingArea::create(*this, parameters);
     m_drawingArea->setPaintingEnabled(false);
     m_pageOverlayController.initialize();
 
index 734afa963ed404cd740900ff3825b2ad7e1cf907..c878534f3de7f95efa3e1b392165960215467cf2 100644 (file)
@@ -35,7 +35,7 @@ class RemoteLayerTreeContext;
 
 class GraphicsLayerCARemote final : public WebCore::GraphicsLayerCA {
 public:
-    GraphicsLayerCARemote(WebCore::GraphicsLayerClient& client, RemoteLayerTreeContext* context)
+    GraphicsLayerCARemote(WebCore::GraphicsLayerClient& client, RemoteLayerTreeContext& context)
         : GraphicsLayerCA(client)
         , m_context(context)
     {
@@ -57,7 +57,7 @@ private:
     // PlatformCALayerRemote can't currently proxy directly composited image contents, so opt out of this optimization.
     virtual bool shouldDirectlyCompositeImage(WebCore::Image*) const override { return false; }
     
-    RemoteLayerTreeContext* m_context;
+    RemoteLayerTreeContext& m_context;
 };
 
 GRAPHICSLAYER_TYPE_CASTS(GraphicsLayerCARemote, isGraphicsLayerCARemote());
index c8a44a1dcc416f1ddcda2d043d24c9ede79ed01f..c4084c31b5c5f146054efde3dbaca5e6f73f9495 100644 (file)
@@ -45,7 +45,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
 {
     RefPtr<PlatformCALayerRemote> layer;
 
@@ -54,53 +54,53 @@ PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(LayerType layerT
     else
         layer = adoptRef(new PlatformCALayerRemote(layerType, owner, context));
 
-    context->layerWasCreated(layer.get(), layerType);
+    context.layerWasCreated(*layer, layerType);
 
     return layer.release();
 }
 
-PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(PlatformLayer *platformLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
 {
     RefPtr<PlatformCALayerRemote> layer = adoptRef(new PlatformCALayerRemoteCustom(static_cast<PlatformLayer*>(platformLayer), owner, context));
 
-    context->layerWasCreated(layer.get(), LayerTypeCustom);
+    context.layerWasCreated(*layer, LayerTypeCustom);
 
     return layer.release();
 }
 
-PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(const PlatformCALayerRemote& other, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PassRefPtr<PlatformCALayerRemote> PlatformCALayerRemote::create(const PlatformCALayerRemote& other, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
 {
     RefPtr<PlatformCALayerRemote> layer = adoptRef(new PlatformCALayerRemote(other, owner, context));
 
-    context->layerWasCreated(layer.get(), other.layerType());
+    context.layerWasCreated(*layer, other.layerType());
 
     return layer.release();
 }
 
-PlatformCALayerRemote::PlatformCALayerRemote(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PlatformCALayerRemote::PlatformCALayerRemote(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
     : PlatformCALayer(layerType, owner)
     , m_superlayer(nullptr)
     , m_maskLayer(nullptr)
     , m_acceleratesDrawing(false)
-    , m_context(context)
+    , m_context(&context)
 {
     if (owner)
         m_properties.contentsScale = owner->platformCALayerDeviceScaleFactor();
 }
 
-PlatformCALayerRemote::PlatformCALayerRemote(const PlatformCALayerRemote& other, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PlatformCALayerRemote::PlatformCALayerRemote(const PlatformCALayerRemote& other, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
     : PlatformCALayer(other.layerType(), owner)
     , m_properties(other.m_properties)
     , m_superlayer(nullptr)
     , m_maskLayer(nullptr)
     , m_acceleratesDrawing(other.acceleratesDrawing())
-    , m_context(context)
+    , m_context(&context)
 {
 }
 
 PassRefPtr<PlatformCALayer> PlatformCALayerRemote::clone(PlatformCALayerClient* client) const
 {
-    RefPtr<PlatformCALayerRemote> clone = PlatformCALayerRemote::create(*this, client, m_context);
+    RefPtr<PlatformCALayerRemote> clone = PlatformCALayerRemote::create(*this, client, *m_context);
 
     clone->m_properties.notePropertiesChanged(static_cast<RemoteLayerTreeTransaction::LayerChange>(m_properties.everChangedProperties & ~RemoteLayerTreeTransaction::BackingStoreChanged));
 
@@ -114,7 +114,7 @@ PlatformCALayerRemote::~PlatformCALayerRemote()
         toPlatformCALayerRemote(layer.get())->m_superlayer = nullptr;
 
     if (m_context)
-        m_context->layerWillBeDestroyed(this);
+        m_context->layerWillBeDestroyed(*this);
 }
 
 void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeContext& context, RemoteLayerTreeTransaction& transaction)
@@ -143,7 +143,7 @@ void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeContext& co
             return;
         }
 
-        transaction.layerPropertiesChanged(this);
+        transaction.layerPropertiesChanged(*this);
     }
 
     for (size_t i = 0; i < m_children.size(); ++i) {
@@ -199,7 +199,7 @@ void PlatformCALayerRemote::copyContentsFromLayer(PlatformCALayer* layer)
     ASSERT(m_properties.clonedLayerID == layer->layerID());
     
     if (!m_properties.changedProperties)
-        m_context->layerPropertyChangedWhileBuildingTransaction(this);
+        m_context->layerPropertyChangedWhileBuildingTransaction(*this);
 
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ClonedContentsChanged);
 }
@@ -306,7 +306,7 @@ void PlatformCALayerRemote::addAnimationForKey(const String& key, PlatformCAAnim
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnimationsChanged);
 
     if (m_context)
-        m_context->willStartAnimationOnLayer(this);
+        m_context->willStartAnimationOnLayer(*this);
 }
 
 void PlatformCALayerRemote::removeAnimationForKey(const String& key)
@@ -644,7 +644,7 @@ void PlatformCALayerRemote::updateCustomBehavior(GraphicsLayer::CustomBehavior c
 
 PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
 {
-    return PlatformCALayerRemote::create(layerType, client, m_context);
+    return PlatformCALayerRemote::create(layerType, client, *m_context);
 }
 
 void PlatformCALayerRemote::enumerateRectsBeingDrawn(CGContextRef context, void (^block)(CGRect))
index 74ae3c30b9f539aeeb9357f4de073fa97a106190..aedfad1a2f0fb7a211b0526fe1d8f363a82d0b78 100644 (file)
@@ -41,9 +41,9 @@ class RemoteLayerTreeContext;
 
 class PlatformCALayerRemote : public WebCore::PlatformCALayer {
 public:
-    static PassRefPtr<PlatformCALayerRemote> create(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
-    static PassRefPtr<PlatformCALayerRemote> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
-    static PassRefPtr<PlatformCALayerRemote> create(const PlatformCALayerRemote&, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
+    static PassRefPtr<PlatformCALayerRemote> create(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+    static PassRefPtr<PlatformCALayerRemote> create(PlatformLayer *, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
+    static PassRefPtr<PlatformCALayerRemote> create(const PlatformCALayerRemote&, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
 
     virtual ~PlatformCALayerRemote();
 
@@ -168,8 +168,8 @@ public:
     RemoteLayerTreeContext* context() const { return m_context; }
 
 protected:
-    PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context);
-    PlatformCALayerRemote(const PlatformCALayerRemote&, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext*);
+    PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext& context);
+    PlatformCALayerRemote(const PlatformCALayerRemote&, WebCore::PlatformCALayerClient*, RemoteLayerTreeContext&);
 
 private:
     virtual bool isPlatformCALayerRemote() const override { return true; }
index 4036a3711cde1bd3ac4c385654f85ad8265710b8..d706097a069b61e5ef8714fa5d9010afe8fc2ed0 100644 (file)
@@ -44,7 +44,7 @@ public:
     virtual void setNeedsDisplay(const WebCore::FloatRect* dirtyRect = 0) override;
 
 private:
-    PlatformCALayerRemoteCustom(PlatformLayer*, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext*);
+    PlatformCALayerRemoteCustom(PlatformLayer*, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext&);
 
     std::unique_ptr<LayerHostingContext> m_layerHostingContext;
     RetainPtr<PlatformLayer> m_platformLayer;
index 67741221128f51cef83421ecbcb2eb10c2365e6a..80b3e325f71a7f863c45a37fdbd5d4b1d840b26a 100644 (file)
@@ -41,10 +41,10 @@ using namespace WebCore;
 namespace WebKit {
 
 static NSString * const platformCALayerPointer = @"WKPlatformCALayer";
-PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom(PlatformLayer* customLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PlatformCALayerRemoteCustom::PlatformCALayerRemoteCustom(PlatformLayer* customLayer, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
     : PlatformCALayerRemote(LayerTypeCustom, owner, context)
 {
-    switch (context->layerHostingMode()) {
+    switch (context.layerHostingMode()) {
     case LayerHostingMode::InProcess:
         m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
         break;
index fe625e17bce6f0b018bc6b19e57ededa263d6840..88eb1d10d11bcdbee9e11eec6e36c2c34b316989 100644 (file)
@@ -36,7 +36,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-PlatformCALayerRemoteTiledBacking::PlatformCALayerRemoteTiledBacking(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
+PlatformCALayerRemoteTiledBacking::PlatformCALayerRemoteTiledBacking(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext& context)
     : PlatformCALayerRemote(layerType, owner, context)
 {
     m_tileController = TileController::create(this);
index da9da42d23ddfaa30a560fab04e9ef7807013d76..fa3e45cf7c9880a6ab60c738032fa1d16418e709 100644 (file)
@@ -36,7 +36,7 @@ public:
     virtual ~PlatformCALayerRemoteTiledBacking();
 
 private:
-    PlatformCALayerRemoteTiledBacking(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext*);
+    PlatformCALayerRemoteTiledBacking(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext&);
 
     virtual WebCore::TiledBacking* tiledBacking() override { return m_tileController.get(); }
 
index d1f4341b583c3892475f53984bdc8d8105f02383..2f8fb776a79f6310ef83b346d8fe8d4e59df6bcc 100644 (file)
@@ -43,28 +43,28 @@ class WebPage;
 // FIXME: This class doesn't do much now. Roll into RemoteLayerTreeDrawingArea?
 class RemoteLayerTreeContext : public WebCore::GraphicsLayerFactory {
 public:
-    explicit RemoteLayerTreeContext(WebPage*);
+    explicit RemoteLayerTreeContext(WebPage&);
     ~RemoteLayerTreeContext();
 
-    void layerWasCreated(PlatformCALayerRemote*, WebCore::PlatformCALayer::LayerType);
-    void layerWillBeDestroyed(PlatformCALayerRemote*);
+    void layerWasCreated(PlatformCALayerRemote&, WebCore::PlatformCALayer::LayerType);
+    void layerWillBeDestroyed(PlatformCALayerRemote&);
 
-    void backingStoreWasCreated(RemoteLayerBackingStore*);
-    void backingStoreWillBeDestroyed(RemoteLayerBackingStore*);
-    void backingStoreWillBeDisplayed(RemoteLayerBackingStore*);
+    void backingStoreWasCreated(RemoteLayerBackingStore&);
+    void backingStoreWillBeDestroyed(RemoteLayerBackingStore&);
+    void backingStoreWillBeDisplayed(RemoteLayerBackingStore&);
 
     WebCore::LayerPool& layerPool() { return m_layerPool; }
 
-    LayerHostingMode layerHostingMode() const { return m_webPage->layerHostingMode(); }
+    LayerHostingMode layerHostingMode() const { return m_webPage.layerHostingMode(); }
 
     void buildTransaction(RemoteLayerTreeTransaction&, WebCore::PlatformCALayer& rootLayer);
 
-    void layerPropertyChangedWhileBuildingTransaction(PlatformCALayerRemote*);
+    void layerPropertyChangedWhileBuildingTransaction(PlatformCALayerRemote&);
 
     // From the UI process
     void animationDidStart(WebCore::GraphicsLayer::PlatformLayerID, const String& key, double startTime);
 
-    void willStartAnimationOnLayer(PlatformCALayerRemote*);
+    void willStartAnimationOnLayer(PlatformCALayerRemote&);
 
     RemoteLayerBackingStoreCollection& backingStoreCollection() { return m_backingStoreCollection; }
 
@@ -72,7 +72,7 @@ private:
     // WebCore::GraphicsLayerFactory
     virtual std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayerClient&) override;
 
-    WebPage* m_webPage;
+    WebPage& m_webPage;
 
     Vector<RemoteLayerTreeTransaction::LayerCreationProperties> m_createdLayers;
     Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayers;
index 93a7762f74c48825910a8bdff2de05c36bbcb6ea..60cfcfc1971ef9ea8c8c54325528f44665e3bc21 100644 (file)
@@ -41,9 +41,8 @@ using namespace WebCore;
 
 namespace WebKit {
 
-RemoteLayerTreeContext::RemoteLayerTreeContext(WebPage* webPage)
+RemoteLayerTreeContext::RemoteLayerTreeContext(WebPage& webPage)
     : m_webPage(webPage)
-    , m_backingStoreCollection(this)
     , m_currentTransaction(nullptr)
 {
 }
@@ -54,47 +53,51 @@ RemoteLayerTreeContext::~RemoteLayerTreeContext()
         layer->clearContext();
 }
 
-void RemoteLayerTreeContext::layerWasCreated(PlatformCALayerRemote* layer, PlatformCALayer::LayerType type)
+void RemoteLayerTreeContext::layerWasCreated(PlatformCALayerRemote& layer, PlatformCALayer::LayerType type)
 {
+    GraphicsLayer::PlatformLayerID layerID = layer.layerID();
+
     RemoteLayerTreeTransaction::LayerCreationProperties creationProperties;
-    creationProperties.layerID = layer->layerID();
+    creationProperties.layerID = layerID;
     creationProperties.type = type;
 
     if (type == PlatformCALayer::LayerTypeCustom)
-        creationProperties.hostingContextID = layer->hostingContextID();
+        creationProperties.hostingContextID = layer.hostingContextID();
 
     m_createdLayers.append(creationProperties);
-    m_liveLayers.add(layer->layerID(), layer);
+    m_liveLayers.add(layerID, &layer);
 }
 
-void RemoteLayerTreeContext::layerWillBeDestroyed(PlatformCALayerRemote* layer)
+void RemoteLayerTreeContext::layerWillBeDestroyed(PlatformCALayerRemote& layer)
 {
-    m_liveLayers.remove(layer->layerID());
+    GraphicsLayer::PlatformLayerID layerID = layer.layerID();
+
+    m_liveLayers.remove(layerID);
 
-    ASSERT(!m_destroyedLayers.contains(layer->layerID()));
-    m_destroyedLayers.append(layer->layerID());
+    ASSERT(!m_destroyedLayers.contains(layerID));
+    m_destroyedLayers.append(layerID);
     
-    m_layersAwaitingAnimationStart.remove(layer->layerID());
+    m_layersAwaitingAnimationStart.remove(layerID);
 }
 
-void RemoteLayerTreeContext::backingStoreWasCreated(RemoteLayerBackingStore* backingStore)
+void RemoteLayerTreeContext::backingStoreWasCreated(RemoteLayerBackingStore& backingStore)
 {
     m_backingStoreCollection.backingStoreWasCreated(backingStore);
 }
 
-void RemoteLayerTreeContext::backingStoreWillBeDestroyed(RemoteLayerBackingStore* backingStore)
+void RemoteLayerTreeContext::backingStoreWillBeDestroyed(RemoteLayerBackingStore& backingStore)
 {
     m_backingStoreCollection.backingStoreWillBeDestroyed(backingStore);
 }
 
-void RemoteLayerTreeContext::backingStoreWillBeDisplayed(RemoteLayerBackingStore* backingStore)
+void RemoteLayerTreeContext::backingStoreWillBeDisplayed(RemoteLayerBackingStore& backingStore)
 {
     m_backingStoreCollection.backingStoreWillBeDisplayed(backingStore);
 }
 
 std::unique_ptr<GraphicsLayer> RemoteLayerTreeContext::createGraphicsLayer(GraphicsLayerClient& client)
 {
-    return std::make_unique<GraphicsLayerCARemote>(client, this);
+    return std::make_unique<GraphicsLayerCARemote>(client, *this);
 }
 
 void RemoteLayerTreeContext::buildTransaction(RemoteLayerTreeTransaction& transaction, PlatformCALayer& rootLayer)
@@ -110,15 +113,15 @@ void RemoteLayerTreeContext::buildTransaction(RemoteLayerTreeTransaction& transa
     transaction.setDestroyedLayerIDs(std::move(m_destroyedLayers));
 }
 
-void RemoteLayerTreeContext::layerPropertyChangedWhileBuildingTransaction(PlatformCALayerRemote* layer)
+void RemoteLayerTreeContext::layerPropertyChangedWhileBuildingTransaction(PlatformCALayerRemote& layer)
 {
     if (m_currentTransaction)
         m_currentTransaction->layerPropertiesChanged(layer);
 }
 
-void RemoteLayerTreeContext::willStartAnimationOnLayer(PlatformCALayerRemote* layer)
+void RemoteLayerTreeContext::willStartAnimationOnLayer(PlatformCALayerRemote& layer)
 {
-    m_layersAwaitingAnimationStart.add(layer->layerID(), layer);
+    m_layersAwaitingAnimationStart.add(layer.layerID(), &layer);
 }
 
 void RemoteLayerTreeContext::animationDidStart(WebCore::GraphicsLayer::PlatformLayerID layerID, const String& key, double startTime)
index 2069797a571d53ba0aa5224697c7d2383bea7794..ab7d16e4c01bb691f8998adad01e9793105ce559 100644 (file)
@@ -50,7 +50,7 @@ class RemoteLayerTreeDisplayRefreshMonitor;
 class RemoteLayerTreeDrawingArea : public DrawingArea, public WebCore::GraphicsLayerClient {
     friend class RemoteLayerTreeDisplayRefreshMonitor;
 public:
-    RemoteLayerTreeDrawingArea(WebPage*, const WebPageCreationParameters&);
+    RemoteLayerTreeDrawingArea(WebPage&, const WebPageCreationParameters&);
     virtual ~RemoteLayerTreeDrawingArea();
 
 private:
index 57607cbb3225cc10938570566c5e08f6c5ffd0f7..761714a5a637b2ba15c957338cb2e54b5a72afb0 100644 (file)
@@ -50,7 +50,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea(WebPage* webPage, const WebPageCreationParameters&)
+RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea(WebPage& webPage, const WebPageCreationParameters&)
     : DrawingArea(DrawingAreaTypeRemoteLayerTree, webPage)
     , m_remoteLayerTreeContext(std::make_unique<RemoteLayerTreeContext>(webPage))
     , m_rootLayer(GraphicsLayer::create(graphicsLayerFactory(), *this))
@@ -64,9 +64,9 @@ RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea(WebPage* webPage, const W
     , m_displayRefreshMonitorsToNotify(nullptr)
     , m_currentTransactionID(0)
 {
-    webPage->corePage()->settings().setForceCompositingMode(true);
+    webPage.corePage()->settings().setForceCompositingMode(true);
 #if PLATFORM(IOS)
-    webPage->corePage()->settings().setDelegatesPageScaling(true);
+    webPage.corePage()->settings().setDelegatesPageScaling(true);
 #endif
 
     m_commitQueue = dispatch_queue_create("com.apple.WebKit.WebContent.RemoteLayerTreeDrawingArea.CommitQueue", nullptr);
@@ -115,7 +115,7 @@ void RemoteLayerTreeDrawingArea::setRootCompositingLayer(GraphicsLayer* rootLaye
     Vector<GraphicsLayer *> children;
     if (rootLayer) {
         children.append(rootLayer);
-        children.append(m_webPage->pageOverlayController().viewOverlayRootLayer());
+        children.append(m_webPage.pageOverlayController().viewOverlayRootLayer());
     }
     m_rootLayer->setChildren(children);
 }
@@ -123,11 +123,11 @@ void RemoteLayerTreeDrawingArea::setRootCompositingLayer(GraphicsLayer* rootLaye
 void RemoteLayerTreeDrawingArea::updateGeometry(const IntSize& viewSize, const IntSize& layerPosition)
 {
     m_viewSize = viewSize;
-    m_webPage->setSize(viewSize);
+    m_webPage.setSize(viewSize);
 
     scheduleCompositingLayerFlush();
 
-    m_webPage->send(Messages::DrawingAreaProxy::DidUpdateGeometry());
+    m_webPage.send(Messages::DrawingAreaProxy::DidUpdateGeometry());
 }
 
 bool RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView(const FrameView* frameView)
@@ -137,7 +137,7 @@ bool RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView(const FrameVi
 
 void RemoteLayerTreeDrawingArea::updatePreferences(const WebPreferencesStore&)
 {
-    Settings& settings = m_webPage->corePage()->settings();
+    Settings& settings = m_webPage.corePage()->settings();
 
     // Fixed position elements need to be composited and create stacking contexts
     // in order to be scrolled by the ScrollingCoordinator.
@@ -150,7 +150,7 @@ void RemoteLayerTreeDrawingArea::updatePreferences(const WebPreferencesStore&)
 #if PLATFORM(IOS)
 void RemoteLayerTreeDrawingArea::setDeviceScaleFactor(float deviceScaleFactor)
 {
-    m_webPage->setDeviceScaleFactor(deviceScaleFactor);
+    m_webPage.setDeviceScaleFactor(deviceScaleFactor);
 }
 #endif
 
@@ -172,7 +172,7 @@ void RemoteLayerTreeDrawingArea::forceRepaint()
     if (m_isFlushingSuspended)
         return;
 
-    for (Frame* frame = &m_webPage->corePage()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_webPage.corePage()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         FrameView* frameView = frame->view();
         if (!frameView || !frameView->tiledBacking())
             continue;
@@ -197,7 +197,7 @@ void RemoteLayerTreeDrawingArea::setExposedRect(const FloatRect& exposedRect)
 #if PLATFORM(IOS)
 void RemoteLayerTreeDrawingArea::setExposedContentRect(const FloatRect& exposedContentRect)
 {
-    FrameView* frameView = m_webPage->corePage()->mainFrame().view();
+    FrameView* frameView = m_webPage.mainFrameView();
     if (!frameView)
         return;
 
@@ -208,7 +208,7 @@ void RemoteLayerTreeDrawingArea::setExposedContentRect(const FloatRect& exposedC
 
 void RemoteLayerTreeDrawingArea::updateScrolledExposedRect()
 {
-    FrameView* frameView = m_webPage->corePage()->mainFrame().view();
+    FrameView* frameView = m_webPage.mainFrameView();
     if (!frameView)
         return;
 
@@ -224,13 +224,13 @@ void RemoteLayerTreeDrawingArea::updateScrolledExposedRect()
     frameView->setExposedRect(m_scrolledExposedRect);
     frameView->adjustTiledBackingCoverage();
 
-    m_webPage->pageOverlayController().didChangeExposedRect();
+    m_webPage.pageOverlayController().didChangeExposedRect();
 }
 
 TiledBacking* RemoteLayerTreeDrawingArea::mainFrameTiledBacking() const
 {
-    FrameView* frameView = m_webPage->corePage()->mainFrame().view();
-    return frameView ? frameView->tiledBacking() : 0;
+    FrameView* frameView = m_webPage.mainFrameView();
+    return frameView ? frameView->tiledBacking() : nullptr;
 }
 
 void RemoteLayerTreeDrawingArea::scheduleCompositingLayerFlush()
@@ -266,12 +266,12 @@ void RemoteLayerTreeDrawingArea::flushLayers()
     RemoteLayerBackingStoreCollection& backingStoreCollection = m_remoteLayerTreeContext->backingStoreCollection();
     backingStoreCollection.willFlushLayers();
 
-    m_webPage->layoutIfNeeded();
+    m_webPage.layoutIfNeeded();
 
     FloatRect visibleRect(FloatPoint(), m_viewSize);
     visibleRect.intersect(m_scrolledExposedRect);
-    m_webPage->pageOverlayController().flushPageOverlayLayers(visibleRect);
-    m_webPage->corePage()->mainFrame().view()->flushCompositingStateIncludingSubframes();
+    m_webPage.pageOverlayController().flushPageOverlayLayers(visibleRect);
+    m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
     m_rootLayer->flushCompositingStateForThisLayerOnly();
 
     // FIXME: Minimize these transactions if nothing changed.
@@ -279,20 +279,20 @@ void RemoteLayerTreeDrawingArea::flushLayers()
     layerTransaction.setTransactionID(takeNextTransactionID());
     m_remoteLayerTreeContext->buildTransaction(layerTransaction, *toGraphicsLayerCARemote(m_rootLayer.get())->platformCALayer());
     backingStoreCollection.willCommitLayerTree(layerTransaction);
-    m_webPage->willCommitLayerTree(layerTransaction);
+    m_webPage.willCommitLayerTree(layerTransaction);
 
     RemoteScrollingCoordinatorTransaction scrollingTransaction;
 #if ENABLE(ASYNC_SCROLLING)
-    if (m_webPage->scrollingCoordinator())
-        toRemoteScrollingCoordinator(m_webPage->scrollingCoordinator())->buildTransaction(scrollingTransaction);
+    if (m_webPage.scrollingCoordinator())
+        toRemoteScrollingCoordinator(m_webPage.scrollingCoordinator())->buildTransaction(scrollingTransaction);
 #endif
 
     m_waitingForBackingStoreSwap = true;
 
-    m_webPage->send(Messages::RemoteLayerTreeDrawingAreaProxy::WillCommitLayerTree(layerTransaction.transactionID()));
+    m_webPage.send(Messages::RemoteLayerTreeDrawingAreaProxy::WillCommitLayerTree(layerTransaction.transactionID()));
 
     Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree message(layerTransaction, scrollingTransaction);
-    auto commitEncoder = std::make_unique<IPC::MessageEncoder>(Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree::receiverName(), Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree::name(), m_webPage->pageID());
+    auto commitEncoder = std::make_unique<IPC::MessageEncoder>(Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree::receiverName(), Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree::name(), m_webPage.pageID());
     commitEncoder->encode(message.arguments());
 
     // FIXME: Move all backing store flushing management to RemoteLayerBackingStoreCollection.
@@ -350,7 +350,7 @@ void RemoteLayerTreeDrawingArea::didUpdate()
 void RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged(const IntSize& contentsSize)
 {
     m_rootLayer->setSize(contentsSize);
-    m_webPage->pageOverlayController().didChangeDocumentSize();
+    m_webPage.pageOverlayController().didChangeDocumentSize();
 }
 
 PassRefPtr<RemoteLayerTreeDrawingArea::BackingStoreFlusher> RemoteLayerTreeDrawingArea::BackingStoreFlusher::create(IPC::Connection* connection, std::unique_ptr<IPC::MessageEncoder> encoder, Vector<RetainPtr<CGContextRef>> contextsToFlush)
index d01db59205d5c64564d6e3270cdac631ff88939a..8c1cfd88cbf2ca7cff6b2de0d77014d60f3e7e50 100644 (file)
@@ -51,7 +51,7 @@ class LayerHostingContext;
 
 class TiledCoreAnimationDrawingArea : public DrawingArea, WebCore::LayerFlushSchedulerClient {
 public:
-    TiledCoreAnimationDrawingArea(WebPage*, const WebPageCreationParameters&);
+    TiledCoreAnimationDrawingArea(WebPage&, const WebPageCreationParameters&);
     virtual ~TiledCoreAnimationDrawingArea();
 
     virtual void viewStateDidChange(WebCore::ViewState::Flags changed) override;
index ea0ac6673ea6fd0c63bd185758bc10eeb2ce078e..0bc60a7b383ec4f3b5f1b3ee48ff0afffad4fe14 100644 (file)
@@ -67,7 +67,7 @@ using namespace WebCore;
 
 namespace WebKit {
 
-TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, const WebPageCreationParameters& parameters)
+TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage& webPage, const WebPageCreationParameters& parameters)
     : DrawingArea(DrawingAreaTypeTiledCoreAnimation, webPage)
     , m_layerTreeStateIsFrozen(false)
     , m_layerFlushScheduler(this)
@@ -76,10 +76,10 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c
     , m_scrolledExposedRect(FloatRect::infiniteRect())
     , m_transientZoomScale(1)
 {
-    m_webPage->corePage()->settings().setForceCompositingMode(true);
+    m_webPage.corePage()->settings().setForceCompositingMode(true);
 
     m_hostingLayer = [CALayer layer];
-    [m_hostingLayer setFrame:m_webPage->bounds()];
+    [m_hostingLayer setFrame:m_webPage.bounds()];
     [m_hostingLayer setOpaque:YES];
     [m_hostingLayer setGeometryFlipped:YES];
 
@@ -88,7 +88,7 @@ TiledCoreAnimationDrawingArea::TiledCoreAnimationDrawingArea(WebPage* webPage, c
 
     LayerTreeContext layerTreeContext;
     layerTreeContext.contextID = m_layerHostingContext->contextID();
-    m_webPage->send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(0, layerTreeContext));
+    m_webPage.send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(0, layerTreeContext));
 }
 
 TiledCoreAnimationDrawingArea::~TiledCoreAnimationDrawingArea()
@@ -126,7 +126,7 @@ void TiledCoreAnimationDrawingArea::forceRepaint()
     if (m_layerTreeStateIsFrozen)
         return;
 
-    for (Frame* frame = &m_webPage->corePage()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+    for (Frame* frame = &m_webPage.corePage()->mainFrame(); frame; frame = frame->tree().traverseNext()) {
         FrameView* frameView = frame->view();
         if (!frameView || !frameView->tiledBacking())
             continue;
@@ -145,8 +145,8 @@ bool TiledCoreAnimationDrawingArea::forceRepaintAsync(uint64_t callbackID)
         return false;
 
     dispatchAfterEnsuringUpdatedScrollPosition([this, callbackID] {
-        m_webPage->drawingArea()->forceRepaint();
-        m_webPage->send(Messages::WebPageProxy::VoidCallback(callbackID));
+        m_webPage.drawingArea()->forceRepaint();
+        m_webPage.send(Messages::WebPageProxy::VoidCallback(callbackID));
     });
     return true;
 }
@@ -175,11 +175,11 @@ void TiledCoreAnimationDrawingArea::scheduleCompositingLayerFlush()
 
 void TiledCoreAnimationDrawingArea::updatePreferences(const WebPreferencesStore&)
 {
-    Settings& settings = m_webPage->corePage()->settings();
+    Settings& settings = m_webPage.corePage()->settings();
 
 #if ENABLE(ASYNC_SCROLLING)
-    if (AsyncScrollingCoordinator* scrollingCoordinator = toAsyncScrollingCoordinator(m_webPage->corePage()->scrollingCoordinator())) {
-        bool scrollingPerformanceLoggingEnabled = m_webPage->scrollingPerformanceLoggingEnabled();
+    if (AsyncScrollingCoordinator* scrollingCoordinator = toAsyncScrollingCoordinator(m_webPage.corePage()->scrollingCoordinator())) {
+        bool scrollingPerformanceLoggingEnabled = m_webPage.scrollingPerformanceLoggingEnabled();
         ScrollingThread::dispatch(bind(&ScrollingTree::setScrollingPerformanceLoggingEnabled, scrollingCoordinator->scrollingTree(), scrollingPerformanceLoggingEnabled));
     }
 #endif
@@ -200,15 +200,15 @@ void TiledCoreAnimationDrawingArea::updatePreferences(const WebPreferencesStore&
 
 void TiledCoreAnimationDrawingArea::mainFrameContentSizeChanged(const IntSize& size)
 {
-    m_webPage->pageOverlayController().didChangeDocumentSize();
+    m_webPage.pageOverlayController().didChangeDocumentSize();
 }
 
 void TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded()
 {
-    if (!m_webPage->minimumLayoutSize().width())
+    if (!m_webPage.minimumLayoutSize().width())
         return;
 
-    FrameView* frameView = m_webPage->mainFrameView();
+    FrameView* frameView = m_webPage.mainFrameView();
     if (!frameView)
         return;
 
@@ -220,19 +220,19 @@ void TiledCoreAnimationDrawingArea::updateIntrinsicContentSizeIfNeeded()
         return;
 
     m_lastSentIntrinsicContentSize = contentSize;
-    m_webPage->send(Messages::DrawingAreaProxy::IntrinsicContentSizeDidChange(contentSize));
+    m_webPage.send(Messages::DrawingAreaProxy::IntrinsicContentSizeDidChange(contentSize));
 }
 
 void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(std::function<void ()> function)
 {
 #if ENABLE(ASYNC_SCROLLING)
-    if (!m_webPage->corePage()->scrollingCoordinator()) {
+    if (!m_webPage.corePage()->scrollingCoordinator()) {
         function();
         return;
     }
 
-    m_webPage->ref();
-    m_webPage->corePage()->scrollingCoordinator()->commitTreeStateIfNeeded();
+    m_webPage.ref();
+    m_webPage.corePage()->scrollingCoordinator()->commitTreeStateIfNeeded();
 
     if (!m_layerTreeStateIsFrozen)
         m_layerFlushScheduler.suspend();
@@ -240,7 +240,7 @@ void TiledCoreAnimationDrawingArea::dispatchAfterEnsuringUpdatedScrollPosition(s
     // It is possible for the drawing area to be destroyed before the bound block
     // is invoked, so grab a reference to the web page here so we can access the drawing area through it.
     // (The web page is already kept alive by dispatchAfterEnsuringUpdatedScrollPosition).
-    WebPage* webPage = m_webPage;
+    WebPage* webPage = &m_webPage;
 
     ScrollingThread::dispatchBarrier([this, webPage, function] {
         DrawingArea* drawingArea = webPage->drawingArea();
@@ -266,7 +266,7 @@ bool TiledCoreAnimationDrawingArea::flushLayers()
     // This gets called outside of the normal event loop so wrap in an autorelease pool
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
 
-    m_webPage->layoutIfNeeded();
+    m_webPage.layoutIfNeeded();
 
     updateIntrinsicContentSizeIfNeeded();
 
@@ -277,11 +277,11 @@ bool TiledCoreAnimationDrawingArea::flushLayers()
 
     FloatRect visibleRect = [m_hostingLayer frame];
     visibleRect.intersect(m_scrolledExposedRect);
-    m_webPage->pageOverlayController().flushPageOverlayLayers(visibleRect);
+    m_webPage.pageOverlayController().flushPageOverlayLayers(visibleRect);
 
-    bool returnValue = m_webPage->corePage()->mainFrame().view()->flushCompositingStateIncludingSubframes();
+    bool returnValue = m_webPage.mainFrameView()->flushCompositingStateIncludingSubframes();
 #if ENABLE(ASYNC_SCROLLING)
-    if (ScrollingCoordinator* scrollingCoordinator = m_webPage->corePage()->scrollingCoordinator())
+    if (ScrollingCoordinator* scrollingCoordinator = m_webPage.corePage()->scrollingCoordinator())
         scrollingCoordinator->commitTreeStateIfNeeded();
 #endif
 
@@ -297,7 +297,7 @@ bool TiledCoreAnimationDrawingArea::flushLayers()
 void TiledCoreAnimationDrawingArea::viewStateDidChange(ViewState::Flags changed)
 {
     if (changed & ViewState::IsVisible) {
-        if (m_webPage->isVisible())
+        if (m_webPage.isVisible())
             resumePainting();
         else
             suspendPainting();
@@ -334,7 +334,7 @@ void TiledCoreAnimationDrawingArea::setExposedRect(const FloatRect& exposedRect)
 
 void TiledCoreAnimationDrawingArea::updateScrolledExposedRect()
 {
-    FrameView* frameView = m_webPage->corePage()->mainFrame().view();
+    FrameView* frameView = m_webPage.mainFrameView();
     if (!frameView)
         return;
 
@@ -350,7 +350,7 @@ void TiledCoreAnimationDrawingArea::updateScrolledExposedRect()
     frameView->setExposedRect(m_scrolledExposedRect);
     frameView->adjustTiledBackingCoverage();
 
-    m_webPage->pageOverlayController().didChangeExposedRect();
+    m_webPage.pageOverlayController().didChangeExposedRect();
 }
 
 void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, const IntSize& layerPosition)
@@ -360,17 +360,17 @@ void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, cons
     IntSize size = viewSize;
     IntSize contentSize = IntSize(-1, -1);
 
-    if (!m_webPage->minimumLayoutSize().width() || m_webPage->autoSizingShouldExpandToViewHeight())
-        m_webPage->setSize(size);
+    if (!m_webPage.minimumLayoutSize().width() || m_webPage.autoSizingShouldExpandToViewHeight())
+        m_webPage.setSize(size);
 
-    FrameView* frameView = m_webPage->mainFrameView();
+    FrameView* frameView = m_webPage.mainFrameView();
 
-    if (m_webPage->autoSizingShouldExpandToViewHeight() && frameView)
+    if (m_webPage.autoSizingShouldExpandToViewHeight() && frameView)
         frameView->setAutoSizeFixedMinimumHeight(viewSize.height());
 
-    m_webPage->layoutIfNeeded();
+    m_webPage.layoutIfNeeded();
 
-    if (m_webPage->minimumLayoutSize().width() && frameView) {
+    if (m_webPage.minimumLayoutSize().width() && frameView) {
         contentSize = frameView->autoSizingIntrinsicContentSize();
         size = contentSize;
     }
@@ -388,14 +388,14 @@ void TiledCoreAnimationDrawingArea::updateGeometry(const IntSize& viewSize, cons
     [CATransaction flush];
     [CATransaction synchronize];
 
-    m_webPage->send(Messages::DrawingAreaProxy::DidUpdateGeometry());
+    m_webPage.send(Messages::DrawingAreaProxy::DidUpdateGeometry());
 
     m_inUpdateGeometry = false;
 }
 
 void TiledCoreAnimationDrawingArea::setDeviceScaleFactor(float deviceScaleFactor)
 {
-    m_webPage->setDeviceScaleFactor(deviceScaleFactor);
+    m_webPage.setDeviceScaleFactor(deviceScaleFactor);
 }
 
 void TiledCoreAnimationDrawingArea::setLayerHostingMode(LayerHostingMode)
@@ -405,7 +405,7 @@ void TiledCoreAnimationDrawingArea::setLayerHostingMode(LayerHostingMode)
     // Finally, inform the UIProcess that the context has changed.
     LayerTreeContext layerTreeContext;
     layerTreeContext.contextID = m_layerHostingContext->contextID();
-    m_webPage->send(Messages::DrawingAreaProxy::UpdateAcceleratedCompositingMode(0, layerTreeContext));
+    m_webPage.send(Messages::DrawingAreaProxy::UpdateAcceleratedCompositingMode(0, layerTreeContext));
 }
 
 void TiledCoreAnimationDrawingArea::setColorSpace(const ColorSpaceData& colorSpace)
@@ -425,7 +425,7 @@ void TiledCoreAnimationDrawingArea::updateLayerHostingContext()
     }
 
     // Create a new context and set it up.
-    switch (m_webPage->layerHostingMode()) {
+    switch (m_webPage.layerHostingMode()) {
     case LayerHostingMode::InProcess:
         m_layerHostingContext = LayerHostingContext::createForPort(WebProcess::shared().compositingRenderServerPort());
         break;
@@ -450,7 +450,7 @@ void TiledCoreAnimationDrawingArea::setRootCompositingLayer(CALayer *layer)
     [CATransaction begin];
     [CATransaction setDisableActions:YES];
 
-    [m_hostingLayer setSublayers:layer ? @[ layer, m_webPage->pageOverlayController().viewOverlayRootLayer()->platformLayer() ] : @[ ]];
+    [m_hostingLayer setSublayers:layer ? @[ layer, m_webPage.pageOverlayController().viewOverlayRootLayer()->platformLayer() ] : @[ ]];
 
     bool hadRootLayer = !!m_rootLayer;
     m_rootLayer = layer;
@@ -459,15 +459,15 @@ void TiledCoreAnimationDrawingArea::setRootCompositingLayer(CALayer *layer)
     if (hadRootLayer != !!layer)
         m_layerHostingContext->setRootLayer(layer ? m_hostingLayer.get() : 0);
 
-    updateDebugInfoLayer(m_webPage->corePage()->settings().showTiledScrollingIndicator());
+    updateDebugInfoLayer(m_webPage.corePage()->settings().showTiledScrollingIndicator());
 
     [CATransaction commit];
 }
 
 TiledBacking* TiledCoreAnimationDrawingArea::mainFrameTiledBacking() const
 {
-    FrameView* frameView = m_webPage->corePage()->mainFrame().view();
-    return frameView ? frameView->tiledBacking() : 0;
+    FrameView* frameView = m_webPage.mainFrameView();
+    return frameView ? frameView->tiledBacking() : nullptr;
 }
 
 void TiledCoreAnimationDrawingArea::updateDebugInfoLayer(bool showLayer)
@@ -497,7 +497,7 @@ bool TiledCoreAnimationDrawingArea::shouldUseTiledBackingForFrameView(const Fram
 
 PlatformCALayer* TiledCoreAnimationDrawingArea::layerForTransientZoom() const
 {
-    RenderLayerBacking* renderViewBacking = m_webPage->mainFrameView()->renderView()->layer()->backing();
+    RenderLayerBacking* renderViewBacking = m_webPage.mainFrameView()->renderView()->layer()->backing();
 
     if (GraphicsLayer* contentsContainmentLayer = renderViewBacking->contentsContainmentLayer())
         return toGraphicsLayerCA(contentsContainmentLayer)->platformCALayer();
@@ -507,7 +507,7 @@ PlatformCALayer* TiledCoreAnimationDrawingArea::layerForTransientZoom() const
 
 PlatformCALayer* TiledCoreAnimationDrawingArea::shadowLayerForTransientZoom() const
 {
-    RenderLayerCompositor& renderLayerCompositor = m_webPage->mainFrameView()->renderView()->compositor();
+    RenderLayerCompositor& renderLayerCompositor = m_webPage.mainFrameView()->renderView()->compositor();
 
     if (GraphicsLayer* shadowGraphicsLayer = renderLayerCompositor.layerForContentShadow())
         return toGraphicsLayerCA(shadowGraphicsLayer)->platformCALayer();
@@ -532,7 +532,7 @@ void TiledCoreAnimationDrawingArea::applyTransientZoomToLayers(double scale, Flo
     zoomLayer->setPosition(FloatPoint3D());
 
     if (PlatformCALayer* shadowLayer = shadowLayerForTransientZoom()) {
-        RenderView* renderView = m_webPage->mainFrameView()->renderView();
+        RenderView* renderView = m_webPage.mainFrameView()->renderView();
         FloatRect shadowBounds = FloatRect(FloatPoint(), toFloatSize(renderView->layoutOverflowRect().maxXMaxYCorner()));
         shadowBounds.scale(scale);
 
@@ -548,11 +548,11 @@ void TiledCoreAnimationDrawingArea::adjustTransientZoom(double scale, FloatPoint
 {
     applyTransientZoomToLayers(scale, origin);
 
-    double currentPageScale = m_webPage->pageScaleFactor();
+    double currentPageScale = m_webPage.pageScaleFactor();
     if (scale > currentPageScale)
         return;
 
-    FrameView* frameView = m_webPage->mainFrameView();
+    FrameView* frameView = m_webPage.mainFrameView();
     FloatRect tileCoverageRect = frameView->visibleContentRectIncludingScrollbars();
     tileCoverageRect.moveBy(-origin);
     tileCoverageRect.scale(currentPageScale / scale);
@@ -574,7 +574,7 @@ static RetainPtr<CABasicAnimation> transientZoomSnapAnimationForKeyPath(String k
 
 void TiledCoreAnimationDrawingArea::commitTransientZoom(double scale, FloatPoint origin)
 {
-    FrameView* frameView = m_webPage->mainFrameView();
+    FrameView* frameView = m_webPage.mainFrameView();
     FloatRect visibleContentRect = frameView->visibleContentRectIncludingScrollbars();
 
     FloatPoint constrainedOrigin = visibleContentRect.location();
@@ -650,16 +650,16 @@ void TiledCoreAnimationDrawingArea::applyTransientZoomToPage(double scale, Float
     layerForTransientZoom()->setTransform(finalTransform);
 
     if (PlatformCALayer* shadowLayer = shadowLayerForTransientZoom()) {
-        RenderView* renderView = m_webPage->mainFrameView()->renderView();
+        RenderView* renderView = m_webPage.mainFrameView()->renderView();
         IntRect overflowRect = renderView->pixelSnappedLayoutOverflowRect();
         shadowLayer->setBounds(IntRect(IntPoint(), toIntSize(overflowRect.maxXMaxYCorner())));
         shadowLayer->setPosition(shadowLayer->bounds().center());
     }
 
     FloatPoint unscrolledOrigin(origin);
-    FloatRect unobscuredContentRect = m_webPage->mainFrameView()->unobscuredContentRectIncludingScrollbars();
+    FloatRect unobscuredContentRect = m_webPage.mainFrameView()->unobscuredContentRectIncludingScrollbars();
     unscrolledOrigin.moveBy(-unobscuredContentRect.location());
-    m_webPage->scalePage(scale, roundedIntPoint(-unscrolledOrigin));
+    m_webPage.scalePage(scale, roundedIntPoint(-unscrolledOrigin));
     m_transientZoomScale = 1;
     flushLayers();
 }