LayerPool’d PlatformCALayerRemote/RemoteLayerBackingStore can have stale context...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jun 2014 07:33:58 +0000 (07:33 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 20 Jun 2014 07:33:58 +0000 (07:33 +0000)
https://bugs.webkit.org/show_bug.cgi?id=134050
<rdar://problem/17315114>

Reviewed by Simon Fraser.

* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
(WebKit::PlatformCALayerRemote::layerPool):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
(WebKit::RemoteLayerTreeContext::layerPool):
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::buildTransaction):
Ensure that layers being committed are always in the context that is committing them.
Use a LayerPool per RemoteLayerTreeContext, to avoid moving layers between contexts.

* WebCore.exp.in:
* WebCore.xcodeproj/project.pbxproj:
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::platformReleaseMemory):
Drain all LayerPools upon memory pressure.

* platform/graphics/ca/LayerPool.cpp:
(WebCore::LayerPool::LayerPool):
(WebCore::LayerPool::~LayerPool):
(WebCore::LayerPool::allLayerPools):
(WebCore::LayerPool::sharedPool): Deleted.
* platform/graphics/ca/LayerPool.h:
* platform/graphics/ca/PlatformCALayer.cpp:
(WebCore::PlatformCALayer::createCompatibleLayerWithSize):
Add createCompatibleLayerWithSize, which optionally tries to take said layer from the LayerPool.

(WebCore::PlatformCALayer::moveToLayerPool):
Add moveToLayerPool, which moves the layer to the LayerPool.

(WebCore::PlatformCALayer::layerPool):
The LayerPool for each layer is obtained via PlatformCALayer::layerPool(), which subclasses can override for special behaviors.
The base class uses a global LayerPool.

* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::createTileLayer):
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::removeTiles):

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

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm
Source/WebCore/platform/graphics/ca/LayerPool.cpp
Source/WebCore/platform/graphics/ca/LayerPool.h
Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebCore/platform/graphics/ca/TileController.cpp
Source/WebCore/platform/graphics/ca/TileGrid.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h
Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm

index 14ae62cae317af0ea7346183d18163797b9e4762..484012c1948ce33fca9b5fd07a60fe980e21b061 100644 (file)
@@ -1,3 +1,40 @@
+2014-06-20  Tim Horton  <timothy_horton@apple.com>
+
+        LayerPool’d PlatformCALayerRemote/RemoteLayerBackingStore can have stale context pointers
+        https://bugs.webkit.org/show_bug.cgi?id=134050
+        <rdar://problem/17315114>
+
+        Reviewed by Simon Fraser.
+
+        * WebCore.exp.in:
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
+        (WebCore::MemoryPressureHandler::platformReleaseMemory):
+        Drain all LayerPools upon memory pressure.
+
+        * platform/graphics/ca/LayerPool.cpp:
+        (WebCore::LayerPool::LayerPool):
+        (WebCore::LayerPool::~LayerPool):
+        (WebCore::LayerPool::allLayerPools):
+        (WebCore::LayerPool::sharedPool): Deleted.
+        * platform/graphics/ca/LayerPool.h:
+        * platform/graphics/ca/PlatformCALayer.cpp:
+        (WebCore::PlatformCALayer::createCompatibleLayerWithSize):
+        Add createCompatibleLayerWithSize, which optionally tries to take said layer from the LayerPool.
+
+        (WebCore::PlatformCALayer::moveToLayerPool):
+        Add moveToLayerPool, which moves the layer to the LayerPool.
+
+        (WebCore::PlatformCALayer::layerPool):
+        The LayerPool for each layer is obtained via PlatformCALayer::layerPool(), which subclasses can override for special behaviors.
+        The base class uses a global LayerPool.
+
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/TileController.cpp:
+        (WebCore::TileController::createTileLayer):
+        * platform/graphics/ca/TileGrid.cpp:
+        (WebCore::TileGrid::removeTiles):
+
 2014-06-19  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         [GTK] webkit_dom_document_create_tree_walker impossible to use due to WebKitDOMNodeFilter
index 22a84b73caf4b9b688f8b1e042feb3615a2e8902..9551930b1963f60a52857fe155452a400712f0c6 100644 (file)
@@ -1468,6 +1468,8 @@ __ZN7WebCore9InlineBox14dirtyLineBoxesEv
 __ZN7WebCore9InlineBox14selectionStateEv
 __ZN7WebCore9InlineBox16placeEllipsisBoxEbfffRfRb
 __ZN7WebCore9JSElement6s_infoE
+__ZN7WebCore9LayerPoolC1Ev
+__ZN7WebCore9LayerPoolD1Ev
 __ZN7WebCore9PageCache11setCapacityEi
 __ZN7WebCore9PageCache33markPagesForVistedLinkStyleRecalcEv
 __ZN7WebCore9PageCache6removeEPNS_11HistoryItemE
index bdddf1c24175d63d10818fc2d3a010ad4d800282..adc780fa358f1e5f349f9736aa0f7755e8e47e08 100644 (file)
                439046DD12DA25E800AF80A2 /* RenderMathMLMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046C912DA25E800AF80A2 /* RenderMathMLMath.cpp */; };
                439046DE12DA25E800AF80A2 /* RenderMathMLMath.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CA12DA25E800AF80A2 /* RenderMathMLMath.h */; };
                439046DF12DA25E800AF80A2 /* RenderMathMLOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CB12DA25E800AF80A2 /* RenderMathMLOperator.cpp */; };
-               439046E012DA25E800AF80A2 /* RenderMathMLOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */; };
                439046DF12DA25E800BF80A3 /* RenderMathMLRadicalOperator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CB12DA25E800BF80A3 /* RenderMathMLRadicalOperator.cpp */; };
+               439046E012DA25E800AF80A2 /* RenderMathMLOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */; };
                439046E012DA25E800BF80A3 /* RenderMathMLRadicalOperator.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CC12DA25E800BF80A3 /* RenderMathMLRadicalOperator.h */; };
                439046E112DA25E800AF80A2 /* RenderMathMLRoot.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 439046CD12DA25E800AF80A2 /* RenderMathMLRoot.cpp */; };
                439046E212DA25E800AF80A2 /* RenderMathMLRoot.h in Headers */ = {isa = PBXBuildFile; fileRef = 439046CE12DA25E800AF80A2 /* RenderMathMLRoot.h */; };
                7AA3A69B194A64E7001CBD24 /* TileGrid.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA3A697194A64E7001CBD24 /* TileGrid.cpp */; };
                7AA3A69C194A64E7001CBD24 /* TileGrid.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AA3A698194A64E7001CBD24 /* TileGrid.h */; };
                7AA3A69F194B59B6001CBD24 /* LayerPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA3A69D194B59B6001CBD24 /* LayerPool.cpp */; };
-               7AA3A6A0194B59B6001CBD24 /* LayerPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AA3A69E194B59B6001CBD24 /* LayerPool.h */; };
+               7AA3A6A0194B59B6001CBD24 /* LayerPool.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AA3A69E194B59B6001CBD24 /* LayerPool.h */; settings = {ATTRIBUTES = (Private, ); }; };
                7AA3A6A3194B5C22001CBD24 /* TileCoverageMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AA3A6A1194B5C22001CBD24 /* TileCoverageMap.cpp */; };
                7AA3A6A4194B5C22001CBD24 /* TileCoverageMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 7AA3A6A2194B5C22001CBD24 /* TileCoverageMap.h */; };
                7AABA25914BC613300AA9A11 /* DOMEditor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7AABA25714BC613300AA9A11 /* DOMEditor.cpp */; };
                439046C912DA25E800AF80A2 /* RenderMathMLMath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLMath.cpp; path = mathml/RenderMathMLMath.cpp; sourceTree = "<group>"; };
                439046CA12DA25E800AF80A2 /* RenderMathMLMath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLMath.h; path = mathml/RenderMathMLMath.h; sourceTree = "<group>"; };
                439046CB12DA25E800AF80A2 /* RenderMathMLOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLOperator.cpp; path = mathml/RenderMathMLOperator.cpp; sourceTree = "<group>"; };
-               439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLOperator.h; path = mathml/RenderMathMLOperator.h; sourceTree = "<group>"; };
                439046CB12DA25E800BF80A3 /* RenderMathMLRadicalOperator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLRadicalOperator.cpp; path = mathml/RenderMathMLRadicalOperator.cpp; sourceTree = "<group>"; };
+               439046CC12DA25E800AF80A2 /* RenderMathMLOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLOperator.h; path = mathml/RenderMathMLOperator.h; sourceTree = "<group>"; };
                439046CC12DA25E800BF80A3 /* RenderMathMLRadicalOperator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLRadicalOperator.h; path = mathml/RenderMathMLRadicalOperator.h; sourceTree = "<group>"; };
                439046CD12DA25E800AF80A2 /* RenderMathMLRoot.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RenderMathMLRoot.cpp; path = mathml/RenderMathMLRoot.cpp; sourceTree = "<group>"; };
                439046CE12DA25E800AF80A2 /* RenderMathMLRoot.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RenderMathMLRoot.h; path = mathml/RenderMathMLRoot.h; sourceTree = "<group>"; };
index 7150aafd632ea14a851cfb3a8cfc960b09dbc796..50a4e0230199ca0501d8d3ba97e459a2fe4a94e6 100644 (file)
@@ -48,8 +48,9 @@ namespace WebCore {
 void MemoryPressureHandler::platformReleaseMemory(bool)
 {
     {
-        ReliefLogger log("Drain LayerPool");
-        LayerPool::sharedPool()->drain();
+        ReliefLogger log("Drain LayerPools");
+        for (auto& pool : LayerPool::allLayerPools())
+            pool->drain();
     }
 #if USE(IOSURFACE)
     {
index 29b6f7ceca4c7769844a7bd5e8489ca1d96f95ac..b49bd49f6a9b7b0369b92f716558d8ad89e18f75 100644 (file)
@@ -28,6 +28,7 @@
 
 #include "Logging.h"
 #include <wtf/CurrentTime.h>
+#include <wtf/NeverDestroyed.h>
 
 namespace WebCore {
 
@@ -39,12 +40,18 @@ LayerPool::LayerPool()
     , m_pruneTimer(this, &LayerPool::pruneTimerFired)
     , m_lastAddTime(0)
 {
+    allLayerPools().add(this);
 }
 
-LayerPool* LayerPool::sharedPool()
+LayerPool::~LayerPool()
 {
-    static LayerPool* sharedPool = new LayerPool;
-    return sharedPool;
+    allLayerPools().remove(this);
+}
+
+HashSet<LayerPool*>& LayerPool::allLayerPools()
+{
+    static NeverDestroyed<HashSet<LayerPool*>> allLayerPools;
+    return allLayerPools.get();
 }
 
 unsigned LayerPool::backingStoreBytesForSize(const IntSize& size)
index 1d3f0fc3214886504f1886f7f661222d4b13f31b..c3b9b5a3d419aa229b7944a0cd94a34ac4e4713e 100644 (file)
@@ -41,7 +41,10 @@ namespace WebCore {
 class LayerPool {
     WTF_MAKE_NONCOPYABLE(LayerPool);
 public:
-    static LayerPool* sharedPool();
+    LayerPool();
+    ~LayerPool();
+
+    static HashSet<LayerPool*>& allLayerPools();
     
     void addLayer(const RefPtr<PlatformCALayer>&);
     RefPtr<PlatformCALayer> takeLayerWithSize(const IntSize&);
@@ -52,8 +55,6 @@ public:
     unsigned capacity() const { return m_maxBytesForPool; }
 
 private:
-    LayerPool();
-
     typedef Deque<RefPtr<PlatformCALayer>> LayerList;
 
     unsigned decayedCapacity() const;
index 9ef82022ad774b94b78fae00ffc0ddc6801e7e72..d4ecc3191be1ada5f6cc871c5d591d8dd616d037 100644 (file)
@@ -24,6 +24,7 @@
  */
 
 #include "config.h"
+#include "LayerPool.h"
 #include "PlatformCALayer.h"
 #include <wtf/StringExtras.h>
 
@@ -91,6 +92,33 @@ void PlatformCALayer::drawRepaintIndicator(CGContextRef context, PlatformCALayer
     CGContextRestoreGState(context);
 }
 
+PassRefPtr<PlatformCALayer> PlatformCALayer::createCompatibleLayerOrTakeFromPool(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client, IntSize size)
+{
+    RefPtr<PlatformCALayer> layer;
+
+    if ((layer = layerPool().takeLayerWithSize(size))) {
+        layer->setOwner(client);
+        return layer.release();
+    }
+
+    layer = createCompatibleLayer(layerType, client);
+    layer->setBounds(FloatRect(FloatPoint(), size));
+    
+    return layer.release();
+}
+
+void PlatformCALayer::moveToLayerPool()
+{
+    ASSERT(!superlayer());
+    layerPool().addLayer(this);
+}
+
+LayerPool& PlatformCALayer::layerPool()
+{
+    static LayerPool* sharedPool = new LayerPool;
+    return *sharedPool;
+}
+
 }
 
 #endif // USE(CA)
index 2df2fa74c653a850852c6c08d8ee05e884b82376..8e874e1a9e241d43666e1bd862a2b16f0a9371c6 100644 (file)
@@ -46,6 +46,7 @@ typedef struct CGContext *CGContextRef;
 
 namespace WebCore {
 
+class LayerPool;
 class PlatformCALayer;
 class PlatformCAAnimation;
 
@@ -223,6 +224,7 @@ public:
 #endif
 
     virtual PassRefPtr<PlatformCALayer> createCompatibleLayer(LayerType, PlatformCALayerClient*) const = 0;
+    PassRefPtr<PlatformCALayer> createCompatibleLayerOrTakeFromPool(LayerType layerType, PlatformCALayerClient* client, IntSize);
 
 #if PLATFORM(COCOA)
     virtual void enumerateRectsBeingDrawn(CGContextRef, void (^block)(CGRect)) = 0;
@@ -243,9 +245,13 @@ public:
     static void drawRepaintIndicator(CGContextRef, PlatformCALayer*, int repaintCount, CGColorRef customBackgroundColor);
     static CGRect frameForLayer(const PlatformLayer*);
 
+    void moveToLayerPool();
+
 protected:
     PlatformCALayer(LayerType, PlatformCALayerClient* owner);
 
+    virtual LayerPool& layerPool();
+
     const LayerType m_layerType;
     const GraphicsLayer::PlatformLayerID m_layerID;
     RetainPtr<PlatformLayer> m_layer;
index 2e00cb82bb9b33ff96b6a445ee236a07135b8209..f793db69df6c05d7cd91e289a062579eca24b381 100644 (file)
@@ -27,7 +27,6 @@
 #include "TileController.h"
 
 #include "IntRect.h"
-#include "LayerPool.h"
 #include "PlatformCALayer.h"
 #include "Region.h"
 #include "TileCoverageMap.h"
@@ -490,15 +489,9 @@ int TileController::rightMarginWidth() const
 
 RefPtr<PlatformCALayer> TileController::createTileLayer(const IntRect& tileRect, TileGrid& grid)
 {
-    RefPtr<PlatformCALayer> layer = LayerPool::sharedPool()->takeLayerWithSize(tileRect.size());
-
-    if (layer)
-        layer->setOwner(&grid);
-    else
-        layer = m_tileCacheLayer->createCompatibleLayer(PlatformCALayer::LayerTypeTiledBackingTileLayer, &grid);
+    RefPtr<PlatformCALayer> layer = m_tileCacheLayer->createCompatibleLayerOrTakeFromPool(PlatformCALayer::LayerTypeTiledBackingTileLayer, &grid, tileRect.size());
 
     layer->setAnchorPoint(FloatPoint3D());
-    layer->setBounds(FloatRect(FloatPoint(), tileRect.size()));
     layer->setPosition(tileRect.location());
     layer->setBorderColor(m_tileDebugBorderColor);
     layer->setBorderWidth(m_tileDebugBorderWidth);
index 23eb25d4c9d92aabd22e318d95e55ff937438d2d..337e1c949ee8a99839440d5e9f48605ad5e67ec2 100644 (file)
@@ -264,7 +264,7 @@ void TileGrid::removeTiles(Vector<TileGrid::TileIndex>& toRemove)
         TileInfo tileInfo = m_tiles.take(toRemove[i]);
         tileInfo.layer->removeFromSuperlayer();
         m_tileRepaintCounts.remove(tileInfo.layer.get());
-        LayerPool::sharedPool()->addLayer(tileInfo.layer);
+        tileInfo.layer->moveToLayerPool();
     }
 }
 
index face6fb4bc3705b3f2dfe26c9442c1068bb8ec48..12a7cd940d79b86c8afcceaa3b23d92fd067319f 100644 (file)
@@ -1,3 +1,22 @@
+2014-06-20  Tim Horton  <timothy_horton@apple.com>
+
+        LayerPool’d PlatformCALayerRemote/RemoteLayerBackingStore can have stale context pointers
+        https://bugs.webkit.org/show_bug.cgi?id=134050
+        <rdar://problem/17315114>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::recursiveBuildTransaction):
+        (WebKit::PlatformCALayerRemote::layerPool):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+        (WebKit::RemoteLayerTreeContext::layerPool):
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::buildTransaction):
+        Ensure that layers being committed are always in the context that is committing them.
+        Use a LayerPool per RemoteLayerTreeContext, to avoid moving layers between contexts.
+
 2014-06-20  Tim Horton  <timothy_horton@apple.com>
 
         WKContentViewInteraction isn't cleaned up when the Web Content process crashes
index e8e2b7464375654a428d4a73e0505b2cfbe30e06..c8a44a1dcc416f1ddcda2d043d24c9ede79ed01f 100644 (file)
@@ -117,9 +117,10 @@ PlatformCALayerRemote::~PlatformCALayerRemote()
         m_context->layerWillBeDestroyed(this);
 }
 
-void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeTransaction& transaction)
+void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeContext& context, RemoteLayerTreeTransaction& transaction)
 {
     ASSERT(!m_properties.backingStore || owner());
+    ASSERT_WITH_SECURITY_IMPLICATION(&context == m_context);
     
     if (m_properties.backingStore && (!owner() || !owner()->platformCALayerDrawsContent())) {
         m_properties.backingStore = nullptr;
@@ -148,11 +149,11 @@ void PlatformCALayerRemote::recursiveBuildTransaction(RemoteLayerTreeTransaction
     for (size_t i = 0; i < m_children.size(); ++i) {
         PlatformCALayerRemote* child = toPlatformCALayerRemote(m_children[i].get());
         ASSERT(child->superlayer() == this);
-        child->recursiveBuildTransaction(transaction);
+        child->recursiveBuildTransaction(context, transaction);
     }
 
     if (m_maskLayer)
-        m_maskLayer->recursiveBuildTransaction(transaction);
+        m_maskLayer->recursiveBuildTransaction(context, transaction);
 }
 
 void PlatformCALayerRemote::didCommit()
@@ -657,4 +658,9 @@ uint32_t PlatformCALayerRemote::hostingContextID()
     return 0;
 }
 
+LayerPool& PlatformCALayerRemote::layerPool()
+{
+    return m_context->layerPool();
+}
+
 } // namespace WebKit
index be389cd8273429bd8ecc96e968c4b8d5f99b8626..74ae3c30b9f539aeeb9357f4de073fa97a106190 100644 (file)
 #include <WebCore/PlatformLayer.h>
 #include <WebCore/TileController.h>
 
+namespace WebCore {
+class LayerPool;
+}
+
 namespace WebKit {
 
 class RemoteLayerTreeContext;
@@ -45,7 +49,7 @@ public:
 
     virtual PlatformLayer* platformLayer() const override { return nullptr; }
 
-    void recursiveBuildTransaction(RemoteLayerTreeTransaction&);
+    void recursiveBuildTransaction(RemoteLayerTreeContext&, RemoteLayerTreeTransaction&);
 
     virtual void setNeedsDisplay(const WebCore::FloatRect* dirtyRect = 0) override;
 
@@ -175,6 +179,8 @@ private:
 
     bool requiresCustomAppearanceUpdateOnBoundsChange() const;
 
+    virtual WebCore::LayerPool& layerPool() override;
+
     RemoteLayerTreeTransaction::LayerProperties m_properties;
     WebCore::PlatformCALayerList m_children;
     PlatformCALayerRemote* m_superlayer;
index 0a3bf07ae925ab626c605b145454016afdac7c76..d1f4341b583c3892475f53984bdc8d8105f02383 100644 (file)
@@ -31,6 +31,7 @@
 #include "RemoteLayerTreeTransaction.h"
 #include "WebPage.h"
 #include <WebCore/GraphicsLayerFactory.h>
+#include <WebCore/LayerPool.h>
 #include <WebCore/PlatformCALayer.h>
 #include <wtf/Vector.h>
 
@@ -52,6 +53,8 @@ public:
     void backingStoreWillBeDestroyed(RemoteLayerBackingStore*);
     void backingStoreWillBeDisplayed(RemoteLayerBackingStore*);
 
+    WebCore::LayerPool& layerPool() { return m_layerPool; }
+
     LayerHostingMode layerHostingMode() const { return m_webPage->layerHostingMode(); }
 
     void buildTransaction(RemoteLayerTreeTransaction&, WebCore::PlatformCALayer& rootLayer);
@@ -80,6 +83,8 @@ private:
     RemoteLayerBackingStoreCollection m_backingStoreCollection;
     
     RemoteLayerTreeTransaction* m_currentTransaction;
+
+    WebCore::LayerPool m_layerPool;
 };
 
 } // namespace WebKit
index 6ab2a147451b6d5c616b80ddff30b1441ae5c5d3..93a7762f74c48825910a8bdff2de05c36bbcb6ea 100644 (file)
@@ -103,7 +103,7 @@ void RemoteLayerTreeContext::buildTransaction(RemoteLayerTreeTransaction& transa
     transaction.setRootLayerID(rootLayerRemote.layerID());
 
     m_currentTransaction = &transaction;
-    rootLayerRemote.recursiveBuildTransaction(transaction);
+    rootLayerRemote.recursiveBuildTransaction(*this, transaction);
     m_currentTransaction = nullptr;
 
     transaction.setCreatedLayers(std::move(m_createdLayers));