Title: [130072] trunk/Source/WebCore
Revision
130072
Author
ander...@apple.com
Date
2012-10-01 13:44:10 -0700 (Mon, 01 Oct 2012)

Log Message

Would like a way to customize the type of GraphicsLayers created on a per page basis
https://bugs.webkit.org/show_bug.cgi?id=98051

Reviewed by Simon Fraser.

Add a GraphicsLayerFactory abstract class and a new GraphicsLayer::create overload that takes
a factory object. Eventually, all calls to the old GraphicsLayer::create will be replaced with
the new version that takes an optional factory.

* WebCore.xcodeproj/project.pbxproj:
* platform/graphics/GraphicsLayer.h:
(WebCore):
(GraphicsLayer):
* platform/graphics/GraphicsLayerFactory.h: Added.
(WebCore):
(GraphicsLayerFactory):
(WebCore::GraphicsLayerFactory::~GraphicsLayerFactory):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayer::create):
(WebCore):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (130071 => 130072)


--- trunk/Source/WebCore/ChangeLog	2012-10-01 20:23:15 UTC (rev 130071)
+++ trunk/Source/WebCore/ChangeLog	2012-10-01 20:44:10 UTC (rev 130072)
@@ -1,3 +1,26 @@
+2012-10-01  Anders Carlsson  <ander...@apple.com>
+
+        Would like a way to customize the type of GraphicsLayers created on a per page basis
+        https://bugs.webkit.org/show_bug.cgi?id=98051
+
+        Reviewed by Simon Fraser.
+
+        Add a GraphicsLayerFactory abstract class and a new GraphicsLayer::create overload that takes
+        a factory object. Eventually, all calls to the old GraphicsLayer::create will be replaced with
+        the new version that takes an optional factory.
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore):
+        (GraphicsLayer):
+        * platform/graphics/GraphicsLayerFactory.h: Added.
+        (WebCore):
+        (GraphicsLayerFactory):
+        (WebCore::GraphicsLayerFactory::~GraphicsLayerFactory):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayer::create):
+        (WebCore):
+
 2012-10-01  Adam Klein  <ad...@chromium.org>
 
         Consolidate more MutationObserverRegistration logic in Node

Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (130071 => 130072)


--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-10-01 20:23:15 UTC (rev 130071)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj	2012-10-01 20:44:10 UTC (rev 130072)
@@ -547,6 +547,7 @@
 		1ABA76CB11D20E57004C201C /* CSSValueKeywords.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E41EA0391198374900710BC5 /* CSSValueKeywords.cpp */; };
 		1AC2260C0DB69F190089B669 /* JSDOMApplicationCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */; };
 		1AC2260D0DB69F190089B669 /* JSDOMApplicationCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */; };
+		1AC69593161A1E53003732CB /* GraphicsLayerFactory.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AC69592161A1E53003732CB /* GraphicsLayerFactory.h */; };
 		1ACD1B630B029739007E5016 /* DOMCSSStyleDeclarationInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E711440AC5D5340053270F /* DOMCSSStyleDeclarationInternal.h */; };
 		1ACE53DF0A8D18810022947D /* JSDOMParser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */; };
 		1ACE53E00A8D18810022947D /* JSDOMParser.h in Headers */ = {isa = PBXBuildFile; fileRef = 1ACE53DE0A8D18810022947D /* JSDOMParser.h */; };
@@ -7607,6 +7608,7 @@
 		1AB7FC670A8B92EC00D9D37B /* XPathVariableReference.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = XPathVariableReference.h; sourceTree = "<group>"; };
 		1AC2260A0DB69F190089B669 /* JSDOMApplicationCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMApplicationCache.cpp; sourceTree = "<group>"; };
 		1AC2260B0DB69F190089B669 /* JSDOMApplicationCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMApplicationCache.h; sourceTree = "<group>"; };
+		1AC69592161A1E53003732CB /* GraphicsLayerFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsLayerFactory.h; sourceTree = "<group>"; };
 		1ACE53DD0A8D18810022947D /* JSDOMParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSDOMParser.cpp; sourceTree = "<group>"; };
 		1ACE53DE0A8D18810022947D /* JSDOMParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSDOMParser.h; sourceTree = "<group>"; };
 		1ACE53E10A8D18E70022947D /* DOMParser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = DOMParser.cpp; sourceTree = "<group>"; };
@@ -19878,6 +19880,7 @@
 				0F580B090F12A2690051D689 /* GraphicsLayer.cpp */,
 				0F580B0A0F12A2690051D689 /* GraphicsLayer.h */,
 				0F580B0B0F12A2690051D689 /* GraphicsLayerClient.h */,
+				1AC69592161A1E53003732CB /* GraphicsLayerFactory.h */,
 				B2A015940AF6CD53006BCE0E /* GraphicsTypes.cpp */,
 				B2A015950AF6CD53006BCE0E /* GraphicsTypes.h */,
 				77A17A7A12F2890B004E02F6 /* GraphicsTypes3D.h */,
@@ -25504,6 +25507,7 @@
 				FB92DF4B15FED08700994433 /* ClipPathOperation.h in Headers */,
 				4F7B4A6615FF6D6A006B5F22 /* PlatformMemoryInstrumentation.h in Headers */,
 				931D72F615FE695300C4C07E /* LayoutMilestones.h in Headers */,
+				1AC69593161A1E53003732CB /* GraphicsLayerFactory.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (130071 => 130072)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-10-01 20:23:15 UTC (rev 130071)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h	2012-10-01 20:44:10 UTC (rev 130072)
@@ -54,6 +54,7 @@
 
 class FloatPoint3D;
 class GraphicsContext;
+class GraphicsLayerFactory;
 class Image;
 class TextStream;
 class TiledBacking;
@@ -191,6 +192,9 @@
 class GraphicsLayer {
     WTF_MAKE_NONCOPYABLE(GraphicsLayer); WTF_MAKE_FAST_ALLOCATED;
 public:
+    static PassOwnPtr<GraphicsLayer> create(GraphicsLayerFactory*, GraphicsLayerClient*);
+
+    // FIXME: Replace all uses of this create function with the one that takes a GraphicsLayerFactory.
     static PassOwnPtr<GraphicsLayer> create(GraphicsLayerClient*);
     
     virtual ~GraphicsLayer();

Added: trunk/Source/WebCore/platform/graphics/GraphicsLayerFactory.h (0 => 130072)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerFactory.h	                        (rev 0)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerFactory.h	2012-10-01 20:44:10 UTC (rev 130072)
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GraphicsLayerFactory_h
+#define GraphicsLayerFactory_h
+
+#if USE(ACCELERATED_COMPOSITING)
+
+#include <wtf/Forward.h>
+
+namespace WebCore {
+
+class GraphicsLayer;
+class GraphicsLayerClient;
+
+class GraphicsLayerFactory {
+public:
+    virtual ~GraphicsLayerFactory() { }
+
+    virtual PassOwnPtr<GraphicsLayer> createGraphicsLayer(GraphicsLayerClient*) = 0;
+};
+
+} // namespace WebCore
+
+#endif // USE(ACCELERATED_COMPOSITING)
+
+#endif // GraphicsLayerFactory_h

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (130071 => 130072)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-10-01 20:23:15 UTC (rev 130071)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2012-10-01 20:44:10 UTC (rev 130072)
@@ -32,6 +32,7 @@
 #include "Animation.h"
 #include "FloatConversion.h"
 #include "FloatRect.h"
+#include "GraphicsLayerFactory.h"
 #include "PlatformCALayer.h"
 #include "RotateTransformOperation.h"
 #include "ScaleTransformOperation.h"
@@ -255,6 +256,14 @@
 }
 #endif
 
+PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* factory, GraphicsLayerClient* client)
+{
+    if (!factory)
+        return adoptPtr(new GraphicsLayerCA(client));
+
+    return factory->createGraphicsLayer(client);
+}
+
 PassOwnPtr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerClient* client)
 {
     return adoptPtr(new GraphicsLayerCA(client));
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to