Title: [157528] trunk/Source
Revision
157528
Author
[email protected]
Date
2013-10-16 14:20:14 -0700 (Wed, 16 Oct 2013)

Log Message

PlatformCALayer constructor should take layer type as an argument
https://bugs.webkit.org/show_bug.cgi?id=122915

Reviewed by Simon Fraser.

No new tests, just a minor refactoring.

* platform/graphics/ca/PlatformCALayer.h:
(WebCore::PlatformCALayer::PlatformCALayer):
Add a LayerType argument.

* platform/graphics/ca/mac/PlatformCALayerMac.mm:
(PlatformCALayerMac::PlatformCALayerMac):
* platform/graphics/ca/win/PlatformCALayerWin.cpp:
(PlatformCALayerWin::PlatformCALayerWin):
Use the new LayerType argument, and early-return in the case where we
are wrapping a custom PlatformLayer.
Drive-by un-indent the switch in the Mac version.

* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(PlatformCALayerRemote::PlatformCALayerRemote):
Use the new LayerType argument.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (157527 => 157528)


--- trunk/Source/WebCore/ChangeLog	2013-10-16 21:19:29 UTC (rev 157527)
+++ trunk/Source/WebCore/ChangeLog	2013-10-16 21:20:14 UTC (rev 157528)
@@ -1,3 +1,24 @@
+2013-10-16  Tim Horton  <[email protected]>
+
+        PlatformCALayer constructor should take layer type as an argument
+        https://bugs.webkit.org/show_bug.cgi?id=122915
+
+        Reviewed by Simon Fraser.
+
+        No new tests, just a minor refactoring.
+
+        * platform/graphics/ca/PlatformCALayer.h:
+        (WebCore::PlatformCALayer::PlatformCALayer):
+        Add a LayerType argument.
+
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm:
+        (PlatformCALayerMac::PlatformCALayerMac):
+        * platform/graphics/ca/win/PlatformCALayerWin.cpp:
+        (PlatformCALayerWin::PlatformCALayerWin):
+        Use the new LayerType argument, and early-return in the case where we
+        are wrapping a custom PlatformLayer.
+        Drive-by un-indent the switch in the Mac version.
+
 2013-10-15  Brady Eidson  <[email protected]>
 
         Flesh out the DatabaseProcess (and launch it!)

Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (157527 => 157528)


--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2013-10-16 21:19:29 UTC (rev 157527)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h	2013-10-16 21:20:14 UTC (rev 157528)
@@ -200,8 +200,9 @@
 #endif
 
 protected:
-    PlatformCALayer(PlatformCALayerClient* owner)
-        : m_owner(owner)
+    PlatformCALayer(LayerType layerType, PlatformCALayerClient* owner)
+        : m_layerType(layerType)
+        , m_owner(owner)
     {
 
     }

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (157527 => 157528)


--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2013-10-16 21:19:29 UTC (rev 157527)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm	2013-10-16 21:20:14 UTC (rev 157528)
@@ -172,47 +172,44 @@
 }
 
 PlatformCALayerMac::PlatformCALayerMac(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
-    : PlatformCALayer(owner)
+    : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS
     if (layer) {
         if ([layer isKindOfClass:getAVPlayerLayerClass()])
             m_layerType = LayerTypeAVPlayerLayer;
-        else
-            m_layerType = LayerTypeCustom;
         m_layer = layer;
-    } else {
-        m_layerType = layerType;
-    
-        Class layerClass = Nil;
-        switch (layerType) {
-            case LayerTypeLayer:
-            case LayerTypeRootLayer:
-                layerClass = [CALayer class];
-                break;
-            case LayerTypeWebLayer:
-                layerClass = [WebLayer class];
-                break;
-            case LayerTypeTransformLayer:
-                layerClass = [CATransformLayer class];
-                break;
-            case LayerTypeWebTiledLayer:
-                layerClass = [WebTiledLayer class];
-                break;
-            case LayerTypeTiledBackingLayer:
-            case LayerTypePageTiledBackingLayer:
-                layerClass = [WebTiledBackingLayer class];
-                break;
-            case LayerTypeAVPlayerLayer:
-                layerClass = getAVPlayerLayerClass();
-                break;
-            case LayerTypeCustom:
-                break;
-        }
+        return;
+    }
 
-        if (layerClass)
-            m_layer = adoptNS([[layerClass alloc] init]);
+    Class layerClass = Nil;
+    switch (layerType) {
+    case LayerTypeLayer:
+    case LayerTypeRootLayer:
+        layerClass = [CALayer class];
+        break;
+    case LayerTypeWebLayer:
+        layerClass = [WebLayer class];
+        break;
+    case LayerTypeTransformLayer:
+        layerClass = [CATransformLayer class];
+        break;
+    case LayerTypeWebTiledLayer:
+        layerClass = [WebTiledLayer class];
+        break;
+    case LayerTypeTiledBackingLayer:
+    case LayerTypePageTiledBackingLayer:
+        layerClass = [WebTiledBackingLayer class];
+        break;
+    case LayerTypeAVPlayerLayer:
+        layerClass = getAVPlayerLayerClass();
+        break;
+    case LayerTypeCustom:
+        break;
     }
+
+    if (layerClass)
+        m_layer = adoptNS([[layerClass alloc] init]);
     
     // Save a pointer to 'this' in the CALayer
     [m_layer.get() setValue:[NSValue valueWithPointer:this] forKey:platformCALayerPointer];

Modified: trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp (157527 => 157528)


--- trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2013-10-16 21:19:29 UTC (rev 157527)
+++ trunk/Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.cpp	2013-10-16 21:20:14 UTC (rev 157528)
@@ -108,24 +108,23 @@
 }
 
 PlatformCALayerWin::PlatformCALayerWin(LayerType layerType, PlatformLayer* layer, PlatformCALayerClient* owner)
-    : PlatformCALayer(owner)
+    : PlatformCALayer(layer ? LayerTypeCustom : layerType, owner)
 {
     if (layer) {
-        m_layerType = LayerTypeCustom;
         m_layer = layer;
-    } else {
-        m_layerType = layerType;
-        ASSERT((layerType != LayerTypeTiledBackingLayer) && (layerType != LayerTypePageTiledBackingLayer));
-        m_layer = adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));
+        return;
+    }
 
-        // Create the PlatformCALayerWinInternal object and point to it in the userdata.
-        PlatformCALayerWinInternal* intern = new PlatformCALayerWinInternal(this);
-        CACFLayerSetUserData(m_layer.get(), intern);
+    ASSERT((layerType != LayerTypeTiledBackingLayer) && (layerType != LayerTypePageTiledBackingLayer));
+    m_layer = adoptCF(CACFLayerCreate(toCACFLayerType(layerType)));
 
-        // Set the display callback
-        CACFLayerSetDisplayCallback(m_layer.get(), displayCallback);
-        CACFLayerSetLayoutCallback(m_layer.get(), layoutSublayersProc);    
-    }
+    // Create the PlatformCALayerWinInternal object and point to it in the userdata.
+    PlatformCALayerWinInternal* intern = new PlatformCALayerWinInternal(this);
+    CACFLayerSetUserData(m_layer.get(), intern);
+
+    // Set the display callback
+    CACFLayerSetDisplayCallback(m_layer.get(), displayCallback);
+    CACFLayerSetLayoutCallback(m_layer.get(), layoutSublayersProc);
 }
 
 PlatformCALayerWin::~PlatformCALayerWin()

Modified: trunk/Source/WebKit2/ChangeLog (157527 => 157528)


--- trunk/Source/WebKit2/ChangeLog	2013-10-16 21:19:29 UTC (rev 157527)
+++ trunk/Source/WebKit2/ChangeLog	2013-10-16 21:20:14 UTC (rev 157528)
@@ -1,5 +1,16 @@
 2013-10-16  Tim Horton  <[email protected]>
 
+        PlatformCALayer constructor should take layer type as an argument
+        https://bugs.webkit.org/show_bug.cgi?id=122915
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (PlatformCALayerRemote::PlatformCALayerRemote):
+        Use the new LayerType argument.
+
+2013-10-16  Tim Horton  <[email protected]>
+
         Remote Layer Tree: Use a default instead of an environment variable
         https://bugs.webkit.org/show_bug.cgi?id=122913
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (157527 => 157528)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2013-10-16 21:19:29 UTC (rev 157527)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2013-10-16 21:20:14 UTC (rev 157528)
@@ -54,12 +54,10 @@
 }
 
 PlatformCALayerRemote::PlatformCALayerRemote(LayerType layerType, PlatformCALayerClient* owner, RemoteLayerTreeContext* context)
-    : PlatformCALayer(owner)
+    : PlatformCALayer(layerType, owner)
     , m_layerID(generateLayerID())
     , m_context(context)
 {
-    m_layerType = layerType;
-
     m_context->layerWasCreated(this, layerType);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to