Make TileController create the appropriate PlatformCALayer subclasses
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Oct 2013 02:45:08 +0000 (02:45 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Oct 2013 02:45:08 +0000 (02:45 +0000)
https://bugs.webkit.org/show_bug.cgi?id=123418

Reviewed by Simon Fraser.

Add PlatformCALayer::createCompatibleLayer, which is overridden in
each of the subclasses to create a PlatformCALayer instance of the same
subclass. This is used in TileController to make bare PlatformCALayers
of the correct type (Mac, Win, or Remote).

* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::createCompatibleLayer):
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayerWin::createCompatibleLayer):
* platform/graphics/ca/win/PlatformCALayerWin.h:
Add createCompatibleLayer and implement it in the subclasses.

* platform/graphics/ca/mac/TileController.mm:
(WebCore::TileController::TileController):
(WebCore::TileController::tiledScrollingIndicatorLayer):
(WebCore::TileController::createTileLayer):
Make use of createCompatibleLayer when creating PlatformCALayers.

* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(PlatformCALayerRemote::createCompatibleLayer):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
Add createCompatibleLayer and implement it in the subclasses.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/PlatformCALayer.h
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h
Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm
Source/WebCore/platform/graphics/ca/mac/TileController.mm
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp
Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp
Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h

index e31b71c..a808229 100644 (file)
@@ -1,3 +1,30 @@
+2013-10-28  Tim Horton  <timothy_horton@apple.com>
+
+        Make TileController create the appropriate PlatformCALayer subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=123418
+
+        Reviewed by Simon Fraser.
+
+        Add PlatformCALayer::createCompatibleLayer, which is overridden in
+        each of the subclasses to create a PlatformCALayer instance of the same
+        subclass. This is used in TileController to make bare PlatformCALayers
+        of the correct type (Mac, Win, or Remote).
+
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayerMac::createCompatibleLayer):
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        (PlatformCALayerWin::createCompatibleLayer):
+        * platform/graphics/ca/win/PlatformCALayerWin.h:
+        Add createCompatibleLayer and implement it in the subclasses.
+
+        * platform/graphics/ca/mac/TileController.mm:
+        (WebCore::TileController::TileController):
+        (WebCore::TileController::tiledScrollingIndicatorLayer):
+        (WebCore::TileController::createTileLayer):
+        Make use of createCompatibleLayer when creating PlatformCALayers.
+
 2013-10-28  Alexandru Chiculita  <achicu@adobe.com>
 
         Web Inspector: CSS Regions: Add protocol API to expose content nodes addition/removal
index a07f6bc..a9ce3f8 100644 (file)
@@ -198,6 +198,8 @@ public:
 #endif // NDEBUG
 #endif // PLATFORM(WIN)
 
+    virtual PassRefPtr<PlatformCALayer> createCompatibleLayer(LayerType, PlatformCALayerClient*) const = 0;
+
 protected:
     PlatformCALayer(LayerType layerType, PlatformCALayerClient* owner)
         : m_layerType(layerType)
index b1ed85d..87f21c0 100644 (file)
@@ -139,6 +139,8 @@ public:
 
     virtual PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient* owner) const OVERRIDE;
 
+    virtual PassRefPtr<PlatformCALayer> createCompatibleLayer(PlatformCALayer::LayerType, PlatformCALayerClient*) const OVERRIDE;
+
 private:
     PlatformCALayerMac(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
 
index 954a739..776f1f3 100644 (file)
@@ -729,4 +729,9 @@ AVPlayerLayer *PlatformCALayerMac::playerLayer() const
     return (AVPlayerLayer *)m_layer.get();
 }
 
+PassRefPtr<PlatformCALayer> PlatformCALayerMac::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
+{
+    return PlatformCALayerMac::create(layerType, client);
+}
+
 #endif // USE(ACCELERATED_COMPOSITING)
index 9160b32..b2691ee 100644 (file)
@@ -28,7 +28,6 @@
 
 #import "IntRect.h"
 #import "PlatformCALayer.h"
-#import "PlatformCALayerMac.h"
 #import "Region.h"
 #import "LayerPool.h"
 #import "WebLayer.h"
@@ -70,7 +69,7 @@ TileController::TileController(PlatformCALayer* rootPlatformLayer)
     , m_tileDebugBorderWidth(0)
     , m_indicatorMode(ThreadedScrollingIndication)
 {
-    m_tileContainerLayer = PlatformCALayerMac::create(PlatformCALayer::LayerTypeLayer, nullptr);
+    m_tileContainerLayer = m_tileCacheLayer->createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr);
 #ifndef NDEBUG
     m_tileContainerLayer->setName("TileController Container Layer");
 #endif
@@ -894,14 +893,14 @@ IntRect TileController::tileCoverageRect() const
 PlatformCALayer* TileController::tiledScrollingIndicatorLayer()
 {
     if (!m_tiledScrollingIndicatorLayer) {
-        m_tiledScrollingIndicatorLayer = PlatformCALayerMac::create(PlatformCALayer::LayerTypeSimpleLayer, this);
+        m_tiledScrollingIndicatorLayer = m_tileCacheLayer->createCompatibleLayer(PlatformCALayer::LayerTypeSimpleLayer, this);
         m_tiledScrollingIndicatorLayer->setOpacity(0.75);
         m_tiledScrollingIndicatorLayer->setAnchorPoint(FloatPoint3D());
         m_tiledScrollingIndicatorLayer->setBorderColor(Color::black);
         m_tiledScrollingIndicatorLayer->setBorderWidth(1);
         m_tiledScrollingIndicatorLayer->setPosition(FloatPoint(2, 2));
 
-        m_visibleRectIndicatorLayer = PlatformCALayerMac::create(PlatformCALayer::LayerTypeLayer, nullptr);
+        m_visibleRectIndicatorLayer = m_tileCacheLayer->createCompatibleLayer(PlatformCALayer::LayerTypeLayer, nullptr);
         m_visibleRectIndicatorLayer->setBorderWidth(2);
         m_visibleRectIndicatorLayer->setAnchorPoint(FloatPoint3D());
         m_visibleRectIndicatorLayer->setBorderColor(Color(255, 0, 0));
@@ -933,7 +932,7 @@ RefPtr<PlatformCALayer> TileController::createTileLayer(const IntRect& tileRect)
         m_tileRepaintCounts.remove(layer.get());
         layer->setOwner(this);
     } else
-        layer = PlatformCALayerMac::create(PlatformCALayer::LayerTypeTiledBackingTileLayer, this);
+        layer = m_tileCacheLayer->createCompatibleLayer(PlatformCALayer::LayerTypeTiledBackingTileLayer, this);
 
     layer->setAnchorPoint(FloatPoint3D());
     layer->setBounds(FloatRect(FloatPoint(), tileRect.size()));
index 4453f3d..8cc2d88 100644 (file)
@@ -670,4 +670,9 @@ void PlatformCALayerWin::printTree() const
 }
 #endif // #ifndef NDEBUG
 
+PassRefPtr<PlatformCALayer> PlatformCALayerWin::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
+{
+    return PlatformCALayerWin::create(layerType, client);
+}
+
 #endif // USE(ACCELERATED_COMPOSITING)
index 63ea100..88b2e4f 100644 (file)
@@ -140,6 +140,8 @@ public:
 
     virtual PassRefPtr<PlatformCALayer> clone(PlatformCALayerClient* owner) const OVERRIDE;
 
+    virtual PassRefPtr<PlatformCALayer> createCompatibleLayer(PlatformCALayer::LayerType, PlatformCALayerClient*) const OVERRIDE;
+
 private:
     PlatformCALayerWin(LayerType, PlatformLayer*, PlatformCALayerClient* owner);
 
index 485121c..42c5583 100644 (file)
@@ -1,3 +1,15 @@
+2013-10-28  Tim Horton  <timothy_horton@apple.com>
+
+        Make TileController create the appropriate PlatformCALayer subclasses
+        https://bugs.webkit.org/show_bug.cgi?id=123418
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (PlatformCALayerRemote::createCompatibleLayer):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        Add createCompatibleLayer and implement it in the subclasses.
+
 2013-10-28  Benjamin Poulain  <benjamin@webkit.org>
 
         Rename applyPageScaleFactorInCompositor to delegatesPageScaling
index 818bd75..5d0c6e2 100644 (file)
@@ -477,4 +477,9 @@ AVPlayerLayer* PlatformCALayerRemote::playerLayer() const
     return nullptr;
 }
 
+PassRefPtr<PlatformCALayer> PlatformCALayerRemote::createCompatibleLayer(PlatformCALayer::LayerType layerType, PlatformCALayerClient* client) const
+{
+    return PlatformCALayerRemote::create(layerType, client, m_context);
+}
+
 #endif // USE(ACCELERATED_COMPOSITING)
index 09e08c7..58f2980 100644 (file)
@@ -143,6 +143,8 @@ public:
 
     virtual PassRefPtr<WebCore::PlatformCALayer> clone(WebCore::PlatformCALayerClient* owner) const OVERRIDE;
 
+    virtual PassRefPtr<PlatformCALayer> createCompatibleLayer(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient*) const OVERRIDE;
+
 private:
     PlatformCALayerRemote(WebCore::PlatformCALayer::LayerType, WebCore::PlatformCALayerClient* owner, RemoteLayerTreeContext* context);