- Revision
- 141384
- Author
- [email protected]
- Date
- 2013-01-31 00:29:44 -0800 (Thu, 31 Jan 2013)
Log Message
Coordinated Graphics : Remove WebCoordinatedSurface dependency from CoordinatedSurface
https://bugs.webkit.org/show_bug.cgi?id=108259
Patch by Jae Hyun Park <[email protected]> on 2013-01-31
Reviewed by Noam Rosenthal.
This is a preparation patch for Threaded Coordinated Graphics.
WebCoordinatedSurface dependency should be removed from
CoordinatedSurface so as to share CoordinatedSurface between
WebCoordinatedSurface and CoordinatedSurface of WebKit1, which will be
implemented for Threaded Coordinated Graphics.
This patch introduces CoordinatedSurface::Factory, which is a function
pointer that creates CoordinatedSurfaces. CoordinatedLayerTreeHost sets
static CoordinatedSurface::Factory member variable. Classes that use
CoordinatedSurface, which are CoordinatedImageBacking and UpdateAtlas,
create CoordinatedSurfaces by calling CoordinatedSurface::create, which
will call the function set by CoordinatedLayerTreeHost.
This way, we can remove the WebCoordinatedSurface dependency from
CoordinatedSurface and be able to share the code in Threaded Coordinated
Graphics.
No new tests. No change in behavior.
* CMakeLists.txt:
* Shared/CoordinatedGraphics/CoordinatedSurface.cpp: Added.
(WebKit):
(WebKit::CoordinatedSurface::setFactory):
(WebKit::CoordinatedSurface::create):
* Shared/CoordinatedGraphics/CoordinatedSurface.h:
(CoordinatedSurface):
* Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp:
* Target.pri:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
(WebKit::CoordinatedLayerTreeHost::createCoordinatedSurface):
(WebKit):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
Modified Paths
Added Paths
Diff
Modified: trunk/Source/WebKit2/CMakeLists.txt (141383 => 141384)
--- trunk/Source/WebKit2/CMakeLists.txt 2013-01-31 08:12:20 UTC (rev 141383)
+++ trunk/Source/WebKit2/CMakeLists.txt 2013-01-31 08:29:44 UTC (rev 141384)
@@ -224,6 +224,7 @@
Shared/API/c/WKUserContentURLPattern.cpp
Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp
+ Shared/CoordinatedGraphics/CoordinatedSurface.cpp
Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp
Shared/CoordinatedGraphics/WebCustomFilterProgramProxy.cpp
Modified: trunk/Source/WebKit2/ChangeLog (141383 => 141384)
--- trunk/Source/WebKit2/ChangeLog 2013-01-31 08:12:20 UTC (rev 141383)
+++ trunk/Source/WebKit2/ChangeLog 2013-01-31 08:29:44 UTC (rev 141384)
@@ -1,3 +1,45 @@
+2013-01-31 Jae Hyun Park <[email protected]>
+
+ Coordinated Graphics : Remove WebCoordinatedSurface dependency from CoordinatedSurface
+ https://bugs.webkit.org/show_bug.cgi?id=108259
+
+ Reviewed by Noam Rosenthal.
+
+ This is a preparation patch for Threaded Coordinated Graphics.
+
+ WebCoordinatedSurface dependency should be removed from
+ CoordinatedSurface so as to share CoordinatedSurface between
+ WebCoordinatedSurface and CoordinatedSurface of WebKit1, which will be
+ implemented for Threaded Coordinated Graphics.
+
+ This patch introduces CoordinatedSurface::Factory, which is a function
+ pointer that creates CoordinatedSurfaces. CoordinatedLayerTreeHost sets
+ static CoordinatedSurface::Factory member variable. Classes that use
+ CoordinatedSurface, which are CoordinatedImageBacking and UpdateAtlas,
+ create CoordinatedSurfaces by calling CoordinatedSurface::create, which
+ will call the function set by CoordinatedLayerTreeHost.
+
+ This way, we can remove the WebCoordinatedSurface dependency from
+ CoordinatedSurface and be able to share the code in Threaded Coordinated
+ Graphics.
+
+ No new tests. No change in behavior.
+
+ * CMakeLists.txt:
+ * Shared/CoordinatedGraphics/CoordinatedSurface.cpp: Added.
+ (WebKit):
+ (WebKit::CoordinatedSurface::setFactory):
+ (WebKit::CoordinatedSurface::create):
+ * Shared/CoordinatedGraphics/CoordinatedSurface.h:
+ (CoordinatedSurface):
+ * Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp:
+ * Target.pri:
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+ (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
+ (WebKit::CoordinatedLayerTreeHost::createCoordinatedSurface):
+ (WebKit):
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+
2013-01-30 Tim Horton <[email protected]>
Unreviewed build fix after http://trac.webkit.org/changeset/141372.
Added: trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.cpp (0 => 141384)
--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.cpp (rev 0)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.cpp 2013-01-31 08:29:44 UTC (rev 141384)
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2013 Company 100, 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.
+ */
+
+#include "config.h"
+#include "CoordinatedSurface.h"
+
+#if USE(COORDINATED_GRAPHICS)
+
+namespace WebKit {
+
+CoordinatedSurface::Factory* CoordinatedSurface::s_factory = 0;
+
+void CoordinatedSurface::setFactory(CoordinatedSurface::Factory factory)
+{
+ s_factory = factory;
+}
+
+PassRefPtr<CoordinatedSurface> CoordinatedSurface::create(const WebCore::IntSize& size, Flags flags)
+{
+ ASSERT(s_factory);
+ return s_factory(size, flags);
+}
+
+} // namespace WebKit
+
+#endif // USE(COORDINATED_GRAPHICS)
Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h (141383 => 141384)
--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h 2013-01-31 08:12:20 UTC (rev 141383)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedSurface.h 2013-01-31 08:29:44 UTC (rev 141384)
@@ -42,6 +42,8 @@
};
typedef unsigned Flags;
+ typedef PassRefPtr<CoordinatedSurface> Factory(const WebCore::IntSize&, Flags);
+ static void setFactory(Factory);
static PassRefPtr<CoordinatedSurface> create(const WebCore::IntSize&, Flags);
virtual ~CoordinatedSurface() { }
@@ -58,6 +60,9 @@
protected:
virtual Flags flags() const = 0;
+
+private:
+ static CoordinatedSurface::Factory* s_factory;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp (141383 => 141384)
--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp 2013-01-31 08:12:20 UTC (rev 141383)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp 2013-01-31 08:29:44 UTC (rev 141384)
@@ -68,11 +68,6 @@
return true;
}
-PassRefPtr<CoordinatedSurface> CoordinatedSurface::create(const WebCore::IntSize& size, CoordinatedSurface::Flags flags)
-{
- return WebCoordinatedSurface::create(size, flags);
-}
-
PassRefPtr<WebCoordinatedSurface> WebCoordinatedSurface::create(const IntSize& size, CoordinatedSurface::Flags flags)
{
RefPtr<WebCoordinatedSurface> surface;
Modified: trunk/Source/WebKit2/Target.pri (141383 => 141384)
--- trunk/Source/WebKit2/Target.pri 2013-01-31 08:12:20 UTC (rev 141383)
+++ trunk/Source/WebKit2/Target.pri 2013-01-31 08:29:44 UTC (rev 141384)
@@ -517,6 +517,7 @@
Shared/WebURLResponse.cpp \
Shared/WebWheelEvent.cpp \
Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp \
+ Shared/CoordinatedGraphics/CoordinatedSurface.cpp \
Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp \
Shared/CoordinatedGraphics/WebCustomFilterProgramProxy.cpp \
Shared/qt/ArgumentCodersQt.cpp \
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (141383 => 141384)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2013-01-31 08:12:20 UTC (rev 141383)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2013-01-31 08:29:44 UTC (rev 141384)
@@ -116,6 +116,8 @@
m_rootLayer->addChild(m_nonCompositedContentLayer.get());
+ CoordinatedSurface::setFactory(createCoordinatedSurface);
+
if (m_webPage->hasPageOverlay())
createPageOverlayLayer();
@@ -686,6 +688,11 @@
return adoptPtr(layer);
}
+PassRefPtr<CoordinatedSurface> CoordinatedLayerTreeHost::createCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags)
+{
+ return WebCoordinatedSurface::create(size, flags);
+}
+
float CoordinatedLayerTreeHost::deviceScaleFactor() const
{
return m_webPage->deviceScaleFactor();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (141383 => 141384)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2013-01-31 08:12:20 UTC (rev 141383)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2013-01-31 08:29:44 UTC (rev 141384)
@@ -116,6 +116,8 @@
#endif
virtual void setBackgroundColor(const WebCore::Color&) OVERRIDE;
+ static PassRefPtr<CoordinatedSurface> createCoordinatedSurface(const WebCore::IntSize&, CoordinatedSurface::Flags);
+
protected:
explicit CoordinatedLayerTreeHost(WebPage*);