[GTK][ThreadedCompositor] Add support for threaded compositor.
authoryoon@igalia.com <yoon@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jan 2015 04:29:24 +0000 (04:29 +0000)
committeryoon@igalia.com <yoon@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Jan 2015 04:29:24 +0000 (04:29 +0000)
https://bugs.webkit.org/show_bug.cgi?id=118265

Reviewed by Martin Robinson.

.:

Added the ENABLE_THREADED_COMPOSITOR feature flag to the cmake and
autotools build systems. The feature is disabled by default.
And remove deprecated the WTF_USE_TILED_BACKING_STORE feature flag
from the feature flags.

* Source/cmake/OptionsEfl.cmake:
* Source/cmake/OptionsGTK.cmake:
* Source/cmake/WebKitFeatures.cmake:
* Source/cmakeconfig.h.cmake:

Source/WebCore:

* PlatformGTK.cmake:
Adds CoodinatedGraphics and threaded compositor related classes to
support threaded compositor

* platform/graphics/texmap/coordinated/CoordinatedTile.cpp:
* platform/graphics/texmap/coordinated/CoordinatedTile.h:
This class should be guarded by COORDINATED_GRAPHICS instead of
TILED_BACKING_STORE

Source/WebKit2:

This patch introduces a threaded compositor for WebKitGTK+.
It is disabled as a default because it is a initial implementation.
The threaded compositor can be enabled using --threaded-compositor
option at compile time.

No new tests, this is an experimental feature.

* PlatformGTK.cmake:
Adds CoodinatedGraphics and threaded compositor related classes to
support threaded compositor

* Shared/DrawingAreaInfo.h:
Use DrawingAreaImpl for threaded compositor

* UIProcess/API/gtk/WebKitSettings.cpp:
(_WebKitSettingsPrivate::_WebKitSettingsPrivate):
Modified to use forceCompositingMode when the threaded compositor used.
If we does not set this mode here, it cannot draw the root content layer.

* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp: Added.
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h: Added.
(WebKit::ThreadedCoordinatedLayerTreeHost::rootLayer):
Implements ThreadedCoordinatedLayerTreeHost to use the threaded
compositor. It is basically similar with CoordinatedLayerTreeHost but it uses ThreadedCompositor instead of IPC.

* UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::contentsSizeChanged):
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h:
* WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::create):
(WebKit::DrawingArea::DrawingArea):
* WebProcess/WebPage/DrawingArea.h:
COORDINATED_GRAPHICS_MULTIPROCESS is introduced to classify IPC specific codes
from Coordinated Graphics.
And COORDINATED_GRAPHICS_THREADED is used to guard the threaded
compositor specific codes.

* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::DrawingAreaImpl):
Modified to use forceCompositingMode when the threaded compositor used.
If we does not set this mode here, it will crash because of PageOverlay.
(WebKit::DrawingAreaImpl::mainFrameContentSizeChanged):
(WebKit::DrawingAreaImpl::updateBackingStoreState):
Modified to handle contents / viewport size changes for threaded compositor.
(WebKit::DrawingAreaImpl::attachViewOverlayGraphicsLayer):
Added to support Overlay layer in the threaded compositor.
(WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing):
Push the surface handle for compositing to the threaded compositor.

* WebProcess/WebPage/DrawingAreaImpl.h: Use COORDINATED_GRAPIHCS_THREADED to guard the threaded compositor related codes.
* WebProcess/WebPage/LayerTreeHost.cpp: Ditto.
* WebProcess/WebPage/LayerTreeHost.h: Ditto.
* WebProcess/WebPage/WebPage.cpp: Ditto.
* WebProcess/WebPage/WebPage.h: Ditto.
* WebProcess/WebPage/WebPage.messages.in: Ditto.

* WebProcess/gtk/WebProcessMainGtk.cpp:
    Modified to call XInitThreads to use thread-safe xlib.

Tools:

Added the ENABLE_THREADED_COMPOSITOR feature flag to the cmake and
autotools build systems. The feature is disabled by default.
And remove deprecated the WTF_USE_TILED_BACKING_STORE feature flag
from the feature flags.

* Scripts/webkitperl/FeatureList.pm:

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

35 files changed:
ChangeLog
Source/WebCore/ChangeLog
Source/WebCore/PlatformGTK.cmake
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedTile.h
Source/WebKit2/ChangeLog
Source/WebKit2/PlatformGTK.cmake
Source/WebKit2/Shared/DrawingAreaInfo.h
Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp
Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h
Source/WebKit2/UIProcess/PageClient.h
Source/WebKit2/UIProcess/WebPageProxy.cpp
Source/WebKit2/UIProcess/WebPageProxy.h
Source/WebKit2/UIProcess/WebPageProxy.messages.in
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h [new file with mode: 0644]
Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/DrawingArea.h
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h
Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp
Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/WebPage.h
Source/WebKit2/WebProcess/WebPage/WebPage.messages.in
Source/WebKit2/WebProcess/gtk/WebProcessMainGtk.cpp
Source/cmake/OptionsEfl.cmake
Source/cmake/OptionsGTK.cmake
Source/cmake/WebKitFeatures.cmake
Source/cmakeconfig.h.cmake
Tools/ChangeLog
Tools/Scripts/webkitperl/FeatureList.pm

index d6a1453..a885f35 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,20 @@
+2015-01-07  Gwang Yoon Hwang  <yoon@igalia.com>
+
+        [GTK][ThreadedCompositor] Add support for threaded compositor.
+        https://bugs.webkit.org/show_bug.cgi?id=118265
+
+        Reviewed by Martin Robinson.
+
+        Added the ENABLE_THREADED_COMPOSITOR feature flag to the cmake and
+        autotools build systems. The feature is disabled by default.
+        And remove deprecated the WTF_USE_TILED_BACKING_STORE feature flag
+        from the feature flags.
+
+        * Source/cmake/OptionsEfl.cmake:
+        * Source/cmake/OptionsGTK.cmake:
+        * Source/cmake/WebKitFeatures.cmake:
+        * Source/cmakeconfig.h.cmake:
+
 2014-12-23  Alexey Proskuryakov  <ap@apple.com>
 
         Simplify building with ASan
index b87a41a..3f61f58 100644 (file)
@@ -1,3 +1,19 @@
+2015-01-07  Gwang Yoon Hwang  <yoon@igalia.com>
+
+        [GTK][ThreadedCompositor] Add support for threaded compositor.
+        https://bugs.webkit.org/show_bug.cgi?id=118265
+
+        Reviewed by Martin Robinson.
+
+        * PlatformGTK.cmake:
+        Adds CoodinatedGraphics and threaded compositor related classes to
+        support threaded compositor
+
+        * platform/graphics/texmap/coordinated/CoordinatedTile.cpp:
+        * platform/graphics/texmap/coordinated/CoordinatedTile.h:
+        This class should be guarded by COORDINATED_GRAPHICS instead of
+        TILED_BACKING_STORE
+
 2015-01-07  Daniel Bates  <dabates@apple.com>
 
         [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT
index f2f64ef..ed95299 100644 (file)
@@ -374,6 +374,31 @@ if (ENABLE_TEXTURE_MAPPER)
     )
 endif ()
 
+if (ENABLE_THREADED_COMPOSITOR)
+    list(APPEND WebCore_INCLUDE_DIRECTORIES
+        "${WEBCORE_DIR}/page/scrolling/coordinatedgraphics"
+        "${WEBCORE_DIR}/platform/graphics/texmap/coordinated"
+        "${WEBCORE_DIR}/platform/graphics/texmap/threadedcompositor"
+    )
+    list(APPEND WebCore_SOURCES
+        page/scrolling/coordinatedgraphics/ScrollingCoordinatorCoordinatedGraphics.cpp
+        page/scrolling/coordinatedgraphics/ScrollingStateNodeCoordinatedGraphics.cpp
+        page/scrolling/coordinatedgraphics/ScrollingStateScrollingNodeCoordinatedGraphics.cpp
+        page/scrolling/ScrollingStateStickyNode.cpp
+        page/scrolling/ScrollingThread.cpp
+        page/scrolling/ScrollingTreeNode.cpp
+        page/scrolling/ScrollingTreeScrollingNode.cpp
+        platform/graphics/TiledBackingStore.cpp
+        platform/graphics/texmap/coordinated/AreaAllocator.cpp
+        platform/graphics/texmap/coordinated/CompositingCoordinator.cpp
+        platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
+        platform/graphics/texmap/coordinated/CoordinatedImageBacking.cpp
+        platform/graphics/texmap/coordinated/CoordinatedSurface.cpp
+        platform/graphics/texmap/coordinated/CoordinatedTile.cpp
+        platform/graphics/texmap/coordinated/UpdateAtlas.cpp
+    )
+endif ()
+
 if (WTF_USE_EGL)
     list(APPEND WebCore_LIBRARIES
         ${EGL_LIBRARY}
index b24f48d..dd32c23 100644 (file)
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "CoordinatedTile.h"
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS)
 
 #include "GraphicsContext.h"
 #include "ImageBuffer.h"
@@ -141,4 +141,4 @@ void CoordinatedTileBackend::paintCheckerPattern(GraphicsContext*, const FloatRe
 
 } // namespace WebCore
 
-#endif // USE(TILED_BACKING_STORE)
+#endif // USE(COORDINATED_GRAPHICS)
index d845ce5..b79709f 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef CoordinatedTile_h
 #define CoordinatedTile_h
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS)
 
 #include "CoordinatedSurface.h"
 #include "IntRect.h"
@@ -91,6 +91,6 @@ private:
 
 } // namespace WebCore
 
-#endif // USE(TILED_BACKING_STORE)
+#endif // USE(COORDINATED_GRAPHICS)
 
 #endif // CoordinatedTile_h
index 0974502..4b3df27 100644 (file)
@@ -1,3 +1,75 @@
+2015-01-07  Gwang Yoon Hwang  <yoon@igalia.com>
+
+        [GTK][ThreadedCompositor] Add support for threaded compositor.
+        https://bugs.webkit.org/show_bug.cgi?id=118265
+
+        Reviewed by Martin Robinson.
+
+        This patch introduces a threaded compositor for WebKitGTK+.
+        It is disabled as a default because it is a initial implementation.
+        The threaded compositor can be enabled using --threaded-compositor
+        option at compile time.
+
+        No new tests, this is an experimental feature.
+
+        * PlatformGTK.cmake:
+        Adds CoodinatedGraphics and threaded compositor related classes to
+        support threaded compositor
+
+        * Shared/DrawingAreaInfo.h:
+        Use DrawingAreaImpl for threaded compositor
+
+        * UIProcess/API/gtk/WebKitSettings.cpp:
+        (_WebKitSettingsPrivate::_WebKitSettingsPrivate):
+        Modified to use forceCompositingMode when the threaded compositor used.
+        If we does not set this mode here, it cannot draw the root content layer.
+
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp: Added.
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h: Added.
+        (WebKit::ThreadedCoordinatedLayerTreeHost::rootLayer):
+        Implements ThreadedCoordinatedLayerTreeHost to use the threaded
+        compositor. It is basically similar with CoordinatedLayerTreeHost but it uses ThreadedCompositor instead of IPC.
+
+        * UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::contentsSizeChanged):
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp:
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h:
+        * WebProcess/WebPage/DrawingArea.cpp:
+        (WebKit::DrawingArea::create):
+        (WebKit::DrawingArea::DrawingArea):
+        * WebProcess/WebPage/DrawingArea.h:
+        COORDINATED_GRAPHICS_MULTIPROCESS is introduced to classify IPC specific codes
+        from Coordinated Graphics.
+        And COORDINATED_GRAPHICS_THREADED is used to guard the threaded
+        compositor specific codes.
+
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::DrawingAreaImpl):
+        Modified to use forceCompositingMode when the threaded compositor used.
+        If we does not set this mode here, it will crash because of PageOverlay.
+        (WebKit::DrawingAreaImpl::mainFrameContentSizeChanged):
+        (WebKit::DrawingAreaImpl::updateBackingStoreState):
+        Modified to handle contents / viewport size changes for threaded compositor.
+        (WebKit::DrawingAreaImpl::attachViewOverlayGraphicsLayer):
+        Added to support Overlay layer in the threaded compositor.
+        (WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing):
+        Push the surface handle for compositing to the threaded compositor.
+
+        * WebProcess/WebPage/DrawingAreaImpl.h: Use COORDINATED_GRAPIHCS_THREADED to guard the threaded compositor related codes.
+        * WebProcess/WebPage/LayerTreeHost.cpp: Ditto.
+        * WebProcess/WebPage/LayerTreeHost.h: Ditto.
+        * WebProcess/WebPage/WebPage.cpp: Ditto.
+        * WebProcess/WebPage/WebPage.h: Ditto.
+        * WebProcess/WebPage/WebPage.messages.in: Ditto.
+
+        * WebProcess/gtk/WebProcessMainGtk.cpp:
+            Modified to call XInitThreads to use thread-safe xlib.
+
 2015-01-07  Daniel Bates  <dabates@apple.com>
 
         [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT
index b86205c..babe27d 100644 (file)
@@ -311,7 +311,6 @@ list(APPEND WebKit2_SOURCES
 
     WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp
 
-    WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
     WebProcess/WebPage/gtk/PrinterListGtk.cpp
     WebProcess/WebPage/gtk/WebInspectorUIGtk.cpp
     WebProcess/WebPage/gtk/WebPageGtk.cpp
@@ -742,6 +741,27 @@ list(APPEND PluginProcess_SOURCES
     PluginProcess/EntryPoint/unix/PluginProcessMain.cpp
 )
 
+if (ENABLE_THREADED_COMPOSITOR)
+    list(APPEND WebKit2_SOURCES
+        Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp
+        Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
+        Shared/CoordinatedGraphics/SimpleViewportController.cpp
+        Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
+        Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp
+        WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
+    )
+    list(APPEND WebKit2_INCLUDE_DIRECTORIES
+        "${WEBCORE_DIR}/platform/graphics/texmap/coordinated"
+        "${WEBKIT2_DIR}/Shared/CoordinatedGraphics"
+        "${WEBKIT2_DIR}/Shared/CoordinatedGraphics/threadedcompositor"
+        "${WEBKIT2_DIR}/WebProcess/WebPage/CoordinatedGraphics"
+    )
+else (ENABLE_THREADED_COMPOSITOR)
+    list(APPEND WebKit2_SOURCES
+        WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp
+    )
+endif ()
+
 # Commands for building the built-in injected bundle.
 include_directories(
     "${WEBKIT2_DIR}/Platform"
index 86877aa..1b6da52 100644 (file)
@@ -35,7 +35,7 @@ enum DrawingAreaType {
 #endif
     DrawingAreaTypeRemoteLayerTree,
 #else
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     DrawingAreaTypeCoordinated
 #else
     DrawingAreaTypeImpl,
index d969c5b..76f3b73 100644 (file)
@@ -54,6 +54,10 @@ struct _WebKitSettingsPrivate {
         fantasyFontFamily = preferences->fantasyFontFamily().utf8();
         pictographFontFamily = preferences->pictographFontFamily().utf8();
         defaultCharset = preferences->defaultTextEncodingName().utf8();
+
+#if USE(COORDINATED_GRAPHICS_THREADED)
+        preferences->setForceCompositingMode(true);
+#endif
     }
 
     RefPtr<WebPreferences> preferences;
index d69fa17..0465b69 100644 (file)
@@ -21,7 +21,7 @@
 #ifndef CoordinatedLayerTreeHostProxy_h
 #define CoordinatedLayerTreeHostProxy_h
 
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 
 #include "CoordinatedGraphicsArgumentCoders.h"
 #include "CoordinatedGraphicsScene.h"
@@ -69,6 +69,6 @@ protected:
 
 } // namespace WebKit
 
-#endif // USE(COORDINATED_GRAPHICS)
+#endif // USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 
 #endif // CoordinatedLayerTreeHostProxy_h
index 67cb27e..bd1827b 100644 (file)
@@ -138,12 +138,10 @@ public:
 
     virtual void didCommitLoadForMainFrame(const String& mimeType, bool useCustomContentProvider) = 0;
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     virtual void pageDidRequestScroll(const WebCore::IntPoint&) = 0;
     virtual void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect) = 0;
     virtual void pageTransitionViewportReady() = 0;
-#endif
-#if USE(COORDINATED_GRAPHICS)
     virtual void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&) = 0;
 #endif
 
index bbb8b94..f1d2170 100644 (file)
 #include "RemoteScrollingCoordinatorProxy.h"
 #endif
 
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 #include "CoordinatedLayerTreeHostProxyMessages.h"
 #endif
 
@@ -1372,7 +1372,7 @@ void WebPageProxy::didCommitLayerTree(const RemoteLayerTreeTransaction&)
 }
 #endif
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 void WebPageProxy::commitPageTransitionViewport()
 {
     if (!isValid())
@@ -3280,7 +3280,7 @@ void WebPageProxy::runBeforeUnloadConfirmPanel(const String& message, uint64_t f
     shouldClose = m_uiClient->runBeforeUnloadConfirmPanel(this, message, frame);
 }
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 void WebPageProxy::pageDidRequestScroll(const IntPoint& point)
 {
     m_pageClient.pageDidRequestScroll(point);
@@ -3396,7 +3396,7 @@ void WebPageProxy::handleDownloadRequest(DownloadProxy* download)
     m_pageClient.handleDownloadRequest(download);
 }
 
-#if PLATFORM(EFL)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 void WebPageProxy::didChangeContentSize(const IntSize& size)
 {
     m_pageClient.didChangeContentSize(size);
index ede3322..f39e68a 100644 (file)
@@ -475,7 +475,7 @@ public:
 
     void didCommitLayerTree(const WebKit::RemoteLayerTreeTransaction&);
 
-#if USE(TILED_BACKING_STORE) 
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     void didRenderFrame(const WebCore::IntSize& contentsSize, const WebCore::IntRect& coveredRect);
 #endif
 #if PLATFORM(EFL)
@@ -547,7 +547,7 @@ public:
 #if PLATFORM(GTK)
     PlatformWidget viewWidget();
 #endif
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     void commitPageTransitionViewport();
 #endif
 
@@ -1107,14 +1107,10 @@ private:
     void clearNotifications(const Vector<uint64_t>& notificationIDs);
     void didDestroyNotification(uint64_t notificationID);
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     void pageDidRequestScroll(const WebCore::IntPoint&);
     void pageTransitionViewportReady();
-#endif
-#if USE(COORDINATED_GRAPHICS)
     void didFindZoomableArea(const WebCore::IntPoint&, const WebCore::IntRect&);
-#endif
-#if PLATFORM(EFL)
     void didChangeContentSize(const WebCore::IntSize&);
 #endif
 
index 38a524e..bf9ddae 100644 (file)
@@ -95,15 +95,10 @@ messages -> WebPageProxy {
     HandleInputMethodKeydown() -> (bool handled)
 #endif
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     PageDidRequestScroll(WebCore::IntPoint point)
     PageTransitionViewportReady()
-#endif
-#if USE(COORDINATED_GRAPHICS)
     DidFindZoomableArea(WebCore::IntPoint target, WebCore::IntRect area)
-#endif
-
-#if PLATFORM(EFL)
     DidChangeContentSize(WebCore::IntSize newSize)
 #endif
 
index 4d54bac..e39dc4a 100644 (file)
@@ -520,7 +520,9 @@ void WebChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) con
 #if USE(COORDINATED_GRAPHICS)
     if (m_page->useFixedLayout())
         m_page->drawingArea()->layerTreeHost()->sizeDidChange(size);
+#endif
 
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     m_page->send(Messages::WebPageProxy::DidChangeContentSize(size));
 #endif
 
index 7f3e1ec..8b92f39 100644 (file)
@@ -600,11 +600,13 @@ void CoordinatedDrawingArea::display(UpdateInfo& updateInfo)
     m_displayTimer.stop();
 }
 
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 void CoordinatedDrawingArea::didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder)
 {
     if (m_layerTreeHost)
         m_layerTreeHost->didReceiveCoordinatedLayerTreeHostMessage(connection, decoder);
 }
+#endif
 
 void CoordinatedDrawingArea::attachViewOverlayGraphicsLayer(WebCore::Frame* frame, WebCore::GraphicsLayer* viewOverlayRootLayer)
 {
index cc63957..14d2b56 100644 (file)
@@ -64,7 +64,9 @@ private:
     virtual void scheduleCompositingLayerFlush() override;
     virtual void scheduleCompositingLayerFlushImmediately() override;
 
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     virtual void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&, IPC::MessageDecoder&);
+#endif
 
     virtual void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
 
diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
new file mode 100644 (file)
index 0000000..04419f1
--- /dev/null
@@ -0,0 +1,300 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+ * Copyright (C) 2012 Company 100, Inc.
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 "ThreadedCoordinatedLayerTreeHost.h"
+
+#if USE(COORDINATED_GRAPHICS_THREADED)
+
+#include "DrawingAreaImpl.h"
+#include "NotImplemented.h"
+#include "ThreadSafeCoordinatedSurface.h"
+#include "WebPage.h"
+#include <WebCore/CoordinatedGraphicsLayer.h>
+#include <WebCore/CoordinatedGraphicsState.h>
+#include <WebCore/Frame.h>
+#include <WebCore/FrameView.h>
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/MainFrame.h>
+#include <WebCore/Page.h>
+#include <wtf/CurrentTime.h>
+
+using namespace WebCore;
+
+namespace WebKit {
+
+PassRefPtr<ThreadedCoordinatedLayerTreeHost> ThreadedCoordinatedLayerTreeHost::create(WebPage* webPage)
+{
+    return adoptRef(new ThreadedCoordinatedLayerTreeHost(webPage));
+}
+
+ThreadedCoordinatedLayerTreeHost::~ThreadedCoordinatedLayerTreeHost()
+{
+}
+
+ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage* webPage)
+    : LayerTreeHost(webPage)
+    , m_forceRepaintAsyncCallbackID(0)
+    , m_contentLayer(nullptr)
+    , m_viewOverlayRootLayer(nullptr)
+    , m_notifyAfterScheduledLayerFlush(false)
+    , m_isSuspended(false)
+    , m_isWaitingForRenderer(false)
+    , m_layerFlushTimer(RunLoop::main(), this, &ThreadedCoordinatedLayerTreeHost::performScheduledLayerFlush)
+    , m_layerFlushSchedulingEnabled(true)
+{
+    m_coordinator = std::make_unique<CompositingCoordinator>(m_webPage->corePage(), this);
+
+    m_coordinator->createRootLayer(m_webPage->size());
+
+    CoordinatedSurface::setFactory(createCoordinatedSurface);
+
+    m_compositor = ThreadedCompositor::create(this);
+    scheduleLayerFlush();
+}
+
+PassRefPtr<CoordinatedSurface> ThreadedCoordinatedLayerTreeHost::createCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags)
+{
+    return ThreadSafeCoordinatedSurface::create(size, flags);
+}
+
+void ThreadedCoordinatedLayerTreeHost::scheduleLayerFlush()
+{
+    if (!m_layerFlushSchedulingEnabled)
+        return;
+
+    if (!m_layerFlushTimer.isActive())
+        m_layerFlushTimer.startOneShot(0);
+}
+
+void ThreadedCoordinatedLayerTreeHost::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
+{
+    if (m_layerFlushSchedulingEnabled == layerFlushingEnabled)
+        return;
+
+    m_layerFlushSchedulingEnabled = layerFlushingEnabled;
+
+    if (m_layerFlushSchedulingEnabled) {
+        scheduleLayerFlush();
+        return;
+    }
+
+    cancelPendingLayerFlush();
+}
+
+void ThreadedCoordinatedLayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
+{
+    m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
+}
+
+void ThreadedCoordinatedLayerTreeHost::setRootCompositingLayer(WebCore::GraphicsLayer* graphicsLayer)
+{
+    m_contentLayer = graphicsLayer;
+    updateRootLayers();
+}
+
+void ThreadedCoordinatedLayerTreeHost::invalidate()
+{
+    notImplemented();
+}
+
+void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const WebCore::IntRect& rect)
+{
+    m_compositor->scrollTo(rect.location());
+    scheduleLayerFlush();
+}
+
+void ThreadedCoordinatedLayerTreeHost::forceRepaint()
+{
+    notImplemented();
+}
+
+bool ThreadedCoordinatedLayerTreeHost::forceRepaintAsync(uint64_t callbackID)
+{
+    // We expect the UI process to not require a new repaint until the previous one has finished.
+    ASSERT(!m_forceRepaintAsyncCallbackID);
+    m_forceRepaintAsyncCallbackID = callbackID;
+    scheduleLayerFlush();
+    return true;
+}
+
+void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const WebCore::IntSize& newSize)
+{
+    m_coordinator->sizeDidChange(newSize);
+    m_compositor->didChangeContentsSize(newSize);
+}
+
+void ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
+{
+    m_coordinator->deviceOrPageScaleFactorChanged();
+}
+
+void ThreadedCoordinatedLayerTreeHost::pauseRendering()
+{
+    m_isSuspended = true;
+}
+
+void ThreadedCoordinatedLayerTreeHost::resumeRendering()
+{
+    m_isSuspended = false;
+    scheduleLayerFlush();
+}
+
+GraphicsLayerFactory* ThreadedCoordinatedLayerTreeHost::graphicsLayerFactory()
+{
+    return m_coordinator.get();
+}
+
+void ThreadedCoordinatedLayerTreeHost::viewportSizeChanged(const WebCore::IntSize& size)
+{
+    m_compositor->didChangeViewportSize(size);
+}
+
+void ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties(const WebCore::ViewportAttributes& attr)
+{
+    m_compositor->didChangeViewportAttribute(attr);
+}
+
+void ThreadedCoordinatedLayerTreeHost::compositorDidFlushLayers()
+{
+    static_cast<DrawingAreaImpl*>(m_webPage->drawingArea())->layerHostDidFlushLayers();
+}
+
+void ThreadedCoordinatedLayerTreeHost::didScaleFactorChanged(float scale, const IntPoint& origin)
+{
+    m_webPage->scalePage(scale, origin);
+}
+
+void ThreadedCoordinatedLayerTreeHost::updateRootLayers()
+{
+    if (!m_contentLayer && !m_viewOverlayRootLayer)
+        return;
+
+    m_coordinator->setRootCompositingLayer(m_contentLayer, m_viewOverlayRootLayer);
+}
+
+void ThreadedCoordinatedLayerTreeHost::setViewOverlayRootLayer(GraphicsLayer* viewOverlayRootLayer)
+{
+    m_viewOverlayRootLayer = viewOverlayRootLayer;
+    updateRootLayers();
+}
+
+#if PLATFORM(GTK)
+void ThreadedCoordinatedLayerTreeHost::setNativeSurfaceHandleForCompositing(uint64_t handle)
+{
+    m_layerTreeContext.contextID = handle;
+    m_compositor->setNativeSurfaceHandleForCompositing(handle);
+}
+#endif
+
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+void ThreadedCoordinatedLayerTreeHost::scheduleAnimation()
+{
+    if (m_isWaitingForRenderer)
+        return;
+
+    if (m_layerFlushTimer.isActive())
+        return;
+
+    m_layerFlushTimer.startOneShot(m_coordinator->nextAnimationServiceTime());
+    scheduleLayerFlush();
+}
+#endif
+
+void ThreadedCoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector, float scale)
+{
+    m_coordinator->setVisibleContentsRect(rect, trajectoryVector);
+    if (m_lastScrollPosition != roundedIntPoint(rect.location())) {
+        m_lastScrollPosition = roundedIntPoint(rect.location());
+
+        if (!m_webPage->corePage()->mainFrame().view()->useFixedLayout())
+            m_webPage->corePage()->mainFrame().view()->notifyScrollPositionChanged(m_lastScrollPosition);
+    }
+
+    if (m_lastScaleFactor != scale) {
+        m_lastScaleFactor = scale;
+        didScaleFactorChanged(m_lastScaleFactor, m_lastScrollPosition);
+    }
+
+    scheduleLayerFlush();
+}
+
+void ThreadedCoordinatedLayerTreeHost::cancelPendingLayerFlush()
+{
+    m_layerFlushTimer.stop();
+}
+
+void ThreadedCoordinatedLayerTreeHost::performScheduledLayerFlush()
+{
+    if (m_isSuspended || m_isWaitingForRenderer)
+        return;
+
+    m_coordinator->syncDisplayState();
+    bool didSync = m_coordinator->flushPendingLayerChanges();
+
+    if (m_notifyAfterScheduledLayerFlush && didSync) {
+        compositorDidFlushLayers();
+        m_notifyAfterScheduledLayerFlush = false;
+    }
+}
+
+void ThreadedCoordinatedLayerTreeHost::purgeBackingStores()
+{
+    m_coordinator->purgeBackingStores();
+}
+
+void ThreadedCoordinatedLayerTreeHost::renderNextFrame()
+{
+    m_isWaitingForRenderer = false;
+    m_coordinator->renderNextFrame();
+    scheduleLayerFlush();
+}
+
+void ThreadedCoordinatedLayerTreeHost::commitScrollOffset(uint32_t layerID, const IntSize& offset)
+{
+    m_coordinator->commitScrollOffset(layerID, offset);
+}
+
+void ThreadedCoordinatedLayerTreeHost::notifyFlushRequired()
+{
+    scheduleLayerFlush();
+}
+
+void ThreadedCoordinatedLayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state)
+{
+    m_isWaitingForRenderer = true;
+    m_compositor->updateSceneState(state);
+}
+
+void ThreadedCoordinatedLayerTreeHost::paintLayerContents(const GraphicsLayer*, GraphicsContext&, const IntRect&)
+{
+}
+
+} // namespace WebKit
+
+#endif // USE(COORDINATED_GRAPHICS)
diff --git a/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h b/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h
new file mode 100644 (file)
index 0000000..6625893
--- /dev/null
@@ -0,0 +1,157 @@
+/*
+ * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
+ * Copyright (C) 2013 Company 100, Inc.
+ * Copyright (C) 2014 Igalia S.L.
+ *
+ * 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 ThreadedCoordinatedLayerTreeHost_h
+#define ThreadedCoordinatedLayerTreeHost_h
+
+#if USE(COORDINATED_GRAPHICS_THREADED)
+
+#include "LayerTreeContext.h"
+#include "LayerTreeHost.h"
+#include "ThreadedCompositor.h"
+#include <WebCore/CompositingCoordinator.h>
+#include <WebCore/FloatPoint.h>
+#include <WebCore/FloatRect.h>
+#include <WebCore/IntPoint.h>
+#include <WebCore/IntRect.h>
+#include <WebCore/IntSize.h>
+#include <WebCore/PageOverlay.h>
+#include <WebCore/Timer.h>
+#include <wtf/OwnPtr.h>
+#include <wtf/RunLoop.h>
+#include <wtf/Threading.h>
+
+namespace WebCore {
+class CoordinatedGraphicsLayerState;
+class CoordinatedGraphicsState;
+class CoordinatedSurface;
+class GraphicsContext;
+class GraphicsLayer;
+class GraphicsLayerFactory;
+class GraphicsLayerFactory;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class ThreadedCoordinatedLayerTreeHost : public LayerTreeHost, public WebCore::CompositingCoordinator::Client, public ThreadedCompositor::Client {
+    WTF_MAKE_NONCOPYABLE(ThreadedCoordinatedLayerTreeHost); WTF_MAKE_FAST_ALLOCATED;
+public:
+    static PassRefPtr<ThreadedCoordinatedLayerTreeHost> create(WebPage*);
+    virtual ~ThreadedCoordinatedLayerTreeHost();
+
+    virtual const LayerTreeContext& layerTreeContext() override { return m_layerTreeContext; };
+
+    virtual void scheduleLayerFlush() override;
+    virtual void setLayerFlushSchedulingEnabled(bool) override;
+    virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool) override;
+    virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
+    virtual void invalidate() override;
+
+    virtual void setNonCompositedContentsNeedDisplay() override { };
+    virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) override { };
+    virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect) override;
+    virtual void forceRepaint() override;
+    virtual bool forceRepaintAsync(uint64_t /*callbackID*/) override;
+    virtual void sizeDidChange(const WebCore::IntSize& newSize) override;
+    virtual void deviceOrPageScaleFactorChanged() override;
+
+    virtual void pauseRendering() override;
+    virtual void resumeRendering() override;
+
+    virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
+    virtual void pageBackgroundTransparencyChanged() override { };
+
+    virtual void viewportSizeChanged(const WebCore::IntSize&) override;
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
+
+#if PLATFORM(GTK)
+    virtual void setNativeSurfaceHandleForCompositing(uint64_t) override;
+#endif
+
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+    virtual void scheduleAnimation() override;
+#endif
+
+    void setViewOverlayRootLayer(WebCore::GraphicsLayer*);
+    static PassRefPtr<WebCore::CoordinatedSurface> createCoordinatedSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags);
+
+protected:
+    explicit ThreadedCoordinatedLayerTreeHost(WebPage*);
+
+private:
+
+    void compositorDidFlushLayers();
+    void didScaleFactorChanged(float scale, const WebCore::IntPoint& origin);
+
+    void updateRootLayers();
+
+    void cancelPendingLayerFlush();
+    void performScheduledLayerFlush();
+
+    WebCore::GraphicsLayer* rootLayer() { return m_coordinator->rootLayer(); }
+
+    // ThreadedCompositor::Client
+    virtual void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint&, float) override;
+    virtual void purgeBackingStores() override;
+    virtual void renderNextFrame() override;
+    virtual void commitScrollOffset(uint32_t layerID, const WebCore::IntSize& offset) override;
+
+    // CompositingCoordinator::Client
+    virtual void didFlushRootLayer(const WebCore::FloatRect&) override { }
+    virtual void notifyFlushRequired() override;
+    virtual void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
+    virtual void paintLayerContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, const WebCore::IntRect& clipRect) override;
+
+    LayerTreeContext m_layerTreeContext;
+    uint64_t m_forceRepaintAsyncCallbackID;
+
+    WebCore::IntPoint m_prevScrollPosition;
+
+    WebCore::GraphicsLayer* m_contentLayer;
+    WebCore::GraphicsLayer* m_viewOverlayRootLayer;
+
+    std::unique_ptr<WebCore::CompositingCoordinator> m_coordinator;
+    RefPtr<ThreadedCompositor> m_compositor;
+
+    bool m_notifyAfterScheduledLayerFlush;
+    bool m_isSuspended;
+    bool m_isWaitingForRenderer;
+
+    float m_lastScaleFactor;
+    WebCore::IntPoint m_lastScrollPosition;
+
+    RunLoop::Timer<ThreadedCoordinatedLayerTreeHost> m_layerFlushTimer;
+    bool m_layerFlushSchedulingEnabled;
+};
+
+} // namespace WebKit
+
+#endif // USE(COORDINATED_GRAPHICS_THREADED)
+
+#endif // ThreadedCoordinatedLayerTreeHost_h
index 6ecd726..e6ced9e 100644 (file)
@@ -39,7 +39,7 @@
 #include "RemoteLayerTreeDrawingArea.h"
 #include "TiledCoreAnimationDrawingArea.h"
 #else
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 #include "CoordinatedDrawingArea.h"
 #else
 #include "DrawingAreaImpl.h"
@@ -61,7 +61,7 @@ std::unique_ptr<DrawingArea> DrawingArea::create(WebPage& webPage, const WebPage
     case DrawingAreaTypeRemoteLayerTree:
         return std::make_unique<RemoteLayerTreeDrawingArea>(webPage, parameters);
 #else
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     case DrawingAreaTypeCoordinated:
         return std::make_unique<CoordinatedDrawingArea>(webPage, parameters);
 #else
@@ -77,6 +77,9 @@ std::unique_ptr<DrawingArea> DrawingArea::create(WebPage& webPage, const WebPage
 DrawingArea::DrawingArea(DrawingAreaType type, WebPage& webPage)
     : m_type(type)
     , m_webPage(webPage)
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+    , m_nativeSurfaceHandleForCompositing(0)
+#endif
 {
     WebProcess::shared().addMessageReceiver(Messages::DrawingArea::messageReceiverName(), m_webPage.pageID(), *this);
 }
index eaa85ea..e453869 100644 (file)
@@ -109,7 +109,7 @@ public:
     virtual PassRefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID);
 #endif
 
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     virtual void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&, IPC::MessageDecoder&) = 0;
 #endif
 
index a772bfb..f71182c 100644 (file)
 #include "WebPreferencesKeys.h"
 #include "WebProcess.h"
 #include <WebCore/GraphicsContext.h>
+#include <WebCore/MainFrame.h>
 #include <WebCore/Page.h>
 #include <WebCore/Settings.h>
 
+#if USE(COORDINATED_GRAPHICS_THREADED)
+#include "ThreadedCoordinatedLayerTreeHost.h"
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -63,6 +68,11 @@ DrawingAreaImpl::DrawingAreaImpl(WebPage& webPage, const WebPageCreationParamete
     , m_displayTimer(RunLoop::main(), this, &DrawingAreaImpl::displayTimerFired)
     , m_exitCompositingTimer(RunLoop::main(), this, &DrawingAreaImpl::exitAcceleratedCompositingMode)
 {
+
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    webPage.corePage()->settings().setForceCompositingMode(true);
+#endif
+
     if (webPage.corePage()->settings().acceleratedDrawingEnabled() || webPage.corePage()->settings().forceCompositingMode())
         m_alwaysUseCompositing = true;
 
@@ -220,6 +230,16 @@ void DrawingAreaImpl::setPaintingEnabled(bool paintingEnabled)
     m_isPaintingEnabled = paintingEnabled;
 }
 
+void DrawingAreaImpl::mainFrameContentSizeChanged(const WebCore::IntSize& newSize)
+{
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    if (m_layerTreeHost)
+        m_layerTreeHost->sizeDidChange(newSize);
+#else
+    UNUSED_PARAM(newSize);
+#endif
+}
+
 void DrawingAreaImpl::updatePreferences(const WebPreferencesStore& store)
 {
     m_webPage.corePage()->settings().setForceCompositingMode(store.getBoolValueForKey(WebPreferencesKey::forceCompositingModeKey()));
@@ -322,7 +342,11 @@ void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImme
         m_webPage.scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
 
         if (m_layerTreeHost) {
+#if USE(COORDINATED_GRAPHICS_THREADED)
+            m_layerTreeHost->viewportSizeChanged(m_webPage.size());
+#else
             m_layerTreeHost->sizeDidChange(m_webPage.size());
+#endif
         } else
             m_dirtyRegion = m_webPage.bounds();
     } else {
@@ -643,10 +667,32 @@ void DrawingAreaImpl::display(UpdateInfo& updateInfo)
     m_displayTimer.stop();
 }
 
+void DrawingAreaImpl::attachViewOverlayGraphicsLayer(WebCore::Frame* frame, WebCore::GraphicsLayer* viewOverlayRootLayer)
+{
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    if (!frame->isMainFrame())
+        return;
+
+    if (!m_layerTreeHost)
+        return;
+
+    ThreadedCoordinatedLayerTreeHost* coordinatedLayerTreeHost = static_cast<ThreadedCoordinatedLayerTreeHost*>(m_layerTreeHost.get());
+    coordinatedLayerTreeHost->setViewOverlayRootLayer(viewOverlayRootLayer);
+#else
+    UNUSED_PARAM(frame);
+    UNUSED_PARAM(viewOverlayRootLayer);
+#endif
+}
+
 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
 void DrawingAreaImpl::setNativeSurfaceHandleForCompositing(uint64_t handle)
 {
     m_nativeSurfaceHandleForCompositing = handle;
+
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    if (m_layerTreeHost)
+        m_layerTreeHost->setNativeSurfaceHandleForCompositing(handle);
+#endif
 }
 #endif
 
index a0a68aa..0fbfa7a 100644 (file)
@@ -60,6 +60,7 @@ private:
     virtual bool forceRepaintAsync(uint64_t callbackID);
 
     virtual void setPaintingEnabled(bool);
+    virtual void mainFrameContentSizeChanged(const WebCore::IntSize&) override;
     virtual void updatePreferences(const WebPreferencesStore&) override;
 
     virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
@@ -67,6 +68,8 @@ private:
     virtual void scheduleCompositingLayerFlush() override;
     virtual void scheduleCompositingLayerFlushImmediately() override;
 
+    virtual void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*);
+
 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
     virtual void setNativeSurfaceHandleForCompositing(uint64_t) override;
 #endif
index 593a1ca..0f7c22e 100644 (file)
 #include "config.h"
 #include "LayerTreeHost.h"
 
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 #include "CoordinatedLayerTreeHost.h"
-#endif
-
-#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
+#elif USE(COORDINATED_GRAPHICS_THREADED)
+#include "ThreadedCoordinatedLayerTreeHost.h"
+#elif PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
 #include "LayerTreeHostGtk.h"
 #endif
 
@@ -40,8 +40,10 @@ namespace WebKit {
 
 PassRefPtr<LayerTreeHost> LayerTreeHost::create(WebPage* webPage)
 {
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     return CoordinatedLayerTreeHost::create(webPage);
+#elif USE(COORDINATED_GRAPHICS_THREADED)
+    return ThreadedCoordinatedLayerTreeHost::create(webPage);
 #elif PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
     return LayerTreeHostGtk::create(webPage);
 #else
index f9e1591..810b05a 100644 (file)
@@ -43,6 +43,9 @@ class IntRect;
 class IntSize;
 class GraphicsLayer;
 class GraphicsLayerFactory;
+#if USE(COORDINATED_GRAPHICS_THREADED)
+class ViewportAttributes;
+#endif
 }
 
 namespace WebKit {
@@ -76,10 +79,16 @@ public:
 
     virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; }
 
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     virtual void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&, IPC::MessageDecoder&) = 0;
 #endif
 
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    virtual void setNativeSurfaceHandleForCompositing(uint64_t) = 0;
+    virtual void viewportSizeChanged(const WebCore::IntSize&) = 0;
+    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0;
+#endif
+
 #if USE(COORDINATED_GRAPHICS) && ENABLE(REQUEST_ANIMATION_FRAME)
     virtual void scheduleAnimation() = 0;
 #endif
index 15ce638..0a5a326 100644 (file)
 #include <wtf/RefCountedLeakCounter.h>
 #endif
 
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 #include "CoordinatedLayerTreeHostMessages.h"
 #endif
 
@@ -476,7 +476,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
     WebProcess::shared().addMessageReceiver(Messages::WebPage::messageReceiverName(), m_pageID, *this);
 
     // FIXME: This should be done in the object constructors, and the objects themselves should be message receivers.
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     WebProcess::shared().addMessageReceiver(Messages::CoordinatedLayerTreeHost::messageReceiverName(), m_pageID, *this);
 #endif
 #if ENABLE(INSPECTOR)
@@ -562,7 +562,7 @@ WebPage::~WebPage()
     WebProcess::shared().removeMessageReceiver(Messages::WebPage::messageReceiverName(), m_pageID);
 
     // FIXME: This should be done in the object destructors, and the objects themselves should be message receivers.
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     WebProcess::shared().removeMessageReceiver(Messages::CoordinatedLayerTreeHost::messageReceiverName(), m_pageID);
 #endif
 #if ENABLE(INSPECTOR)
@@ -1311,7 +1311,12 @@ void WebPage::sendViewportAttributesChanged()
     // This also takes care of the relayout.
     setFixedLayoutSize(roundedIntSize(attr.layoutSize));
 
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
+#else
+    if (m_drawingArea->layerTreeHost())
+        m_drawingArea->layerTreeHost()->didChangeViewportProperties(attr);
+#endif
 }
 #endif
 
@@ -1796,7 +1801,11 @@ void WebPage::pageDidScroll()
 #if USE(TILED_BACKING_STORE)
 void WebPage::pageDidRequestScroll(const IntPoint& point)
 {
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     send(Messages::WebPageProxy::PageDidRequestScroll(point));
+#elif USE(COORDINATED_GRAPHICS_THREADED)
+    drawingArea()->scroll(IntRect(point, IntSize()), IntSize());
+#endif
 }
 #endif
 
@@ -2370,7 +2379,7 @@ void WebPage::didStartPageTransition()
 
 void WebPage::didCompletePageTransition()
 {
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     // m_mainFrame can be null since r170163.
     if (m_mainFrame && m_mainFrame->coreFrame()->view()->delegatesScrolling()) {
         // Wait until the UI process sent us the visible rect it wants rendered.
@@ -3534,7 +3543,7 @@ bool WebPage::windowAndWebPageAreFocused() const
 
 void WebPage::didReceiveMessage(IPC::Connection& connection, IPC::MessageDecoder& decoder)
 {
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     if (decoder.messageReceiverName() == Messages::CoordinatedLayerTreeHost::messageReceiverName()) {
         if (m_drawingArea)
             m_drawingArea->didReceiveCoordinatedLayerTreeHostMessage(connection, decoder);
@@ -4021,7 +4030,7 @@ bool WebPage::canHandleRequest(const WebCore::ResourceRequest& request)
     return platformCanHandleRequest(request);
 }
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 void WebPage::commitPageTransitionViewport()
 {
     m_drawingArea->setLayerTreeStateIsFrozen(false);
index ca99f33..144f5d1 100644 (file)
@@ -587,7 +587,7 @@ public:
     void setThemePath(const String&);
 #endif
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     void commitPageTransitionViewport();
 #endif
 
@@ -1023,7 +1023,7 @@ private:
     void hideFindUI();
     void countStringMatches(const String&, uint32_t findOptions, uint32_t maxMatchCount);
 
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     void findZoomableAreaForPoint(const WebCore::IntPoint&, const WebCore::IntSize& area);
 #endif
 
index 0db1530..6a8a59b 100644 (file)
@@ -315,7 +315,7 @@ messages -> WebPage LegacyReceiver {
     SetThemePath(String themePath)
 #endif
 
-#if USE(TILED_BACKING_STORE)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     CommitPageTransitionViewport()
 #endif
 
@@ -381,7 +381,7 @@ messages -> WebPage LegacyReceiver {
     SetComposition(String compositionString, Vector<WebCore::CompositionUnderline> underlines, uint64_t cursorPosition)
     CancelComposition()
 #endif
-#if USE(COORDINATED_GRAPHICS)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
     FindZoomableAreaForPoint(WebCore::IntPoint point, WebCore::IntSize area)
 #endif
 
index 58ea68f..e2b785b 100644 (file)
 #include <libintl.h>
 #include <libsoup/soup.h>
 
+#if PLATFORM(X11)
+#include <X11/Xlib.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -47,6 +51,9 @@ public:
             sleep(30);
 #endif
 
+#if USE(COORDINATED_GRAPHICS_THREADED) && PLATFORM(X11)
+        XInitThreads();
+#endif
         gtk_init(nullptr, nullptr);
 
         bindtextdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
index cb04500..1351890 100644 (file)
@@ -118,7 +118,6 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_TIMING ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEBGL ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XHR_TIMEOUT ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(WTF_USE_TILED_BACKING_STORE ON)
 
 if (ENABLE_LLINT_C_LOOP)
     message(STATUS "Force enabling LLINT C LOOP.")
@@ -208,6 +207,8 @@ if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
 endif ()
 
 add_definitions(-DWTF_USE_COORDINATED_GRAPHICS=1)
+add_definitions(-DWTF_USE_COORDINATED_GRAPHICS_MULTIPROCESS=1)
+add_definitions(-DWTF_USE_TILED_BACKING_STORE=1)
 
 add_definitions(-DWTF_USE_TEXTURE_MAPPER=1)
 
index 54cb003..c0a8ad5 100644 (file)
@@ -172,7 +172,7 @@ WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_AUDIO ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_WEB_TIMING ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_XHR_TIMEOUT ON)
 WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_NETWORK_PROCESS ON)
-WEBKIT_OPTION_DEFAULT_PORT_VALUE(WTF_USE_TILED_BACKING_STORE OFF)
+WEBKIT_OPTION_DEFAULT_PORT_VALUE(ENABLE_THREADED_COMPOSITOR OFF)
 WEBKIT_OPTION_END()
 
 if (LIBNOTIFY_FOUND)
@@ -329,6 +329,12 @@ if (OPENGL_FOUND AND (GLX_FOUND OR EGL_FOUND))
     if (GLX_FOUND)
         add_definitions(-DWTF_USE_GLX=1)
     endif ()
+
+    if (ENABLE_THREADED_COMPOSITOR)
+        add_definitions(-DWTF_USE_TILED_BACKING_STORE=1)
+        add_definitions(-DWTF_USE_COORDINATED_GRAPHICS=1)
+        add_definitions(-DWTF_USE_COORDINATED_GRAPHICS_THREADED=1)
+    endif ()
 endif ()
 
 if (ENABLE_GAMEPAD_DEPRECATED)
index cac9999..1e30c2f 100644 (file)
@@ -149,7 +149,7 @@ macro(WEBKIT_OPTION_BEGIN)
     WEBKIT_OPTION_DEFINE(ENABLE_XHR_TIMEOUT "Toggle XHR timeout support" OFF)
     WEBKIT_OPTION_DEFINE(ENABLE_XSLT "Toggle XSLT support" ON)
     WEBKIT_OPTION_DEFINE(USE_SYSTEM_MALLOC "Toggle system allocator instead of TCmalloc" OFF)
-    WEBKIT_OPTION_DEFINE(WTF_USE_TILED_BACKING_STORE "Toggle Tiled Backing Store support" OFF)
+    WEBKIT_OPTION_DEFINE(ENABLE_THREADED_COMPOSITOR "Toggle threaded compositor support" OFF)
 
     WEBKIT_OPTION_DEPEND(ENABLE_ENCRYPTED_MEDIA_V2 ENABLE_VIDEO)
     WEBKIT_OPTION_DEPEND(ENABLE_MEDIA_CONTROLS_SCRIPT ENABLE_VIDEO)
index 00d5f31..43098aa 100644 (file)
 #cmakedefine01 ENABLE_XSLT
 #cmakedefine01 USE_SYSTEM_MALLOC
 #cmakedefine01 WTF_USE_GEOCLUE2
-#cmakedefine01 WTF_USE_TILED_BACKING_STORE
 #cmakedefine01 HAVE_LLVM
 #cmakedefine01 HAVE_GTK_UNIX_PRINTING
 #cmakedefine01 WTF_CPU_ARM64_CORTEXA53
index c69147f..4548df5 100644 (file)
@@ -1,3 +1,17 @@
+2015-01-07  Gwang Yoon Hwang  <yoon@igalia.com>
+
+        [GTK][ThreadedCompositor] Add support for threaded compositor.
+        https://bugs.webkit.org/show_bug.cgi?id=118265
+
+        Reviewed by Martin Robinson.
+
+        Added the ENABLE_THREADED_COMPOSITOR feature flag to the cmake and
+        autotools build systems. The feature is disabled by default.
+        And remove deprecated the WTF_USE_TILED_BACKING_STORE feature flag
+        from the feature flags.
+
+        * Scripts/webkitperl/FeatureList.pm:
+
 2015-01-07  Daniel Bates  <dabates@apple.com>
 
         [iOS] Make WebKit2 build with public iOS SDK and more build fixes for DRT
index 51dd8be..463248d 100644 (file)
@@ -128,7 +128,7 @@ my (
     $systemMallocSupport,
     $templateElementSupport,
     $textAutosizingSupport,
-    $tiledBackingStoreSupport,
+    $threadedCompositorSupport,
     $threadedHTMLParserSupport,
     $touchEventsSupport,
     $touchSliderSupport,
@@ -383,6 +383,9 @@ my @features = (
     { option => "template-element", desc => "Toggle HTMLTemplateElement support",
       define => "ENABLE_TEMPLATE_ELEMENT", default => 1, value => \$templateElementSupport },
 
+    { option => "threaded-compositor", desc => "Toggle threaded compositor support",
+      define => "ENABLE_THREADED_COMPOSITOR", default => 0, value => \$threadedCompositorSupport },
+
     { option => "text-autosizing", desc => "Toggle Text Autosizing support",
       define => "ENABLE_TEXT_AUTOSIZING", default => 0, value => \$textAutosizingSupport },