Title: [176954] trunk/Source/WebKit2
Revision
176954
Author
y...@igalia.com
Date
2014-12-08 10:46:49 -0800 (Mon, 08 Dec 2014)

Log Message

[GTK] Let DrawingArea manages setAcceleratedCompositingWindowId
https://bugs.webkit.org/show_bug.cgi?id=117230

Reviewed by Anders Carlsson.

This is a preparation patch for Threaded Coordinated Graphics.

LayerTreeHostGtk uses a native window handle to make glContext for
accelerated compositing. Therefore it is natural for DrawingArea to take
responsibility for the native window handle. And, in Coordinated
Graphics case, WebPage creates LayerTreeHost before receiving a native
window handle from UIProcess. It means we need a method to pass the
native window handle to already created LayerTreeHost.

This patch uses DrawingAreaProxy::setNativeSurfaceHandleForCompositing
instead of WebCoreProxy::setAcceleratedCompositingWindowId to set window
ID for accelerated compositing.

Also, this patch renames the setAcceleratedCompositingWindowId with a
more generic name, setNativeSurfaceHandleForCompositing.

No new tests. No change in functionality.

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(webkitWebViewBaseCreateWebPage):
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::setNativeSurfaceHandleForCompositing):
* UIProcess/DrawingAreaProxyImpl.h:
* UIProcess/WebPageProxy.h:
* UIProcess/gtk/WebPageProxyGtk.cpp:
(WebKit::WebPageProxy::setAcceleratedCompositingWindowId): Deleted.
* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::nativeSurfaceHandleForCompositing):
* WebProcess/WebPage/DrawingArea.messages.in:
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing):
* WebProcess/WebPage/DrawingAreaImpl.h:
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::glContext):
(WebKit::LayerTreeHostGtk::initialize):
* WebProcess/WebPage/gtk/WebPageGtk.cpp:
(WebKit::WebPage::platformInitialize):
(WebKit::WebPage::setAcceleratedCompositingWindowId): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (176953 => 176954)


--- trunk/Source/WebKit2/ChangeLog	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/ChangeLog	2014-12-08 18:46:49 UTC (rev 176954)
@@ -1,3 +1,51 @@
+2014-12-08  Gwang Yoon Hwang  <y...@igalia.com>
+
+        [GTK] Let DrawingArea manages setAcceleratedCompositingWindowId
+        https://bugs.webkit.org/show_bug.cgi?id=117230
+
+        Reviewed by Anders Carlsson.
+
+        This is a preparation patch for Threaded Coordinated Graphics.
+
+        LayerTreeHostGtk uses a native window handle to make glContext for
+        accelerated compositing. Therefore it is natural for DrawingArea to take
+        responsibility for the native window handle. And, in Coordinated
+        Graphics case, WebPage creates LayerTreeHost before receiving a native
+        window handle from UIProcess. It means we need a method to pass the
+        native window handle to already created LayerTreeHost.
+
+        This patch uses DrawingAreaProxy::setNativeSurfaceHandleForCompositing
+        instead of WebCoreProxy::setAcceleratedCompositingWindowId to set window
+        ID for accelerated compositing.
+
+        Also, this patch renames the setAcceleratedCompositingWindowId with a
+        more generic name, setNativeSurfaceHandleForCompositing.
+
+        No new tests. No change in functionality.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (webkitWebViewBaseCreateWebPage):
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::setNativeSurfaceHandleForCompositing):
+        * UIProcess/DrawingAreaProxyImpl.h:
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/gtk/WebPageProxyGtk.cpp:
+        (WebKit::WebPageProxy::setAcceleratedCompositingWindowId): Deleted.
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::nativeSurfaceHandleForCompositing):
+        * WebProcess/WebPage/DrawingArea.messages.in:
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing):
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
+        (WebKit::LayerTreeHostGtk::glContext):
+        (WebKit::LayerTreeHostGtk::initialize):
+        * WebProcess/WebPage/gtk/WebPageGtk.cpp:
+        (WebKit::WebPage::platformInitialize):
+        (WebKit::WebPage::setAcceleratedCompositingWindowId): Deleted.
+
 2014-12-08  Philippe Normand  <pnorm...@igalia.com>
 
         [GTK] UserMedia Permission Request API

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (176953 => 176954)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp	2014-12-08 18:46:49 UTC (rev 176954)
@@ -1056,8 +1056,10 @@
     priv->inputMethodFilter.setPage(priv->pageProxy.get());
 
 #if USE(TEXTURE_MAPPER_GL) && PLATFORM(X11)
-    if (priv->redirectedWindow)
-        priv->pageProxy->setAcceleratedCompositingWindowId(priv->redirectedWindow->windowID());
+    if (priv->redirectedWindow) {
+        DrawingAreaProxyImpl* drawingArea = static_cast<DrawingAreaProxyImpl*>(priv->pageProxy->drawingArea());
+        drawingArea->setNativeSurfaceHandleForCompositing(priv->redirectedWindow->windowID());
+    }
 #endif
 
 #if HAVE(GTK_SCALE_FACTOR)

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (176953 => 176954)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2014-12-08 18:46:49 UTC (rev 176954)
@@ -300,6 +300,13 @@
     m_webPageProxy.enterAcceleratedCompositingMode(layerTreeContext);
 }
 
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+void DrawingAreaProxyImpl::setNativeSurfaceHandleForCompositing(uint64_t handle)
+{
+    m_webPageProxy.process().send(Messages::DrawingArea::SetNativeSurfaceHandleForCompositing(handle), m_webPageProxy.pageID());
+}
+#endif
+
 void DrawingAreaProxyImpl::exitAcceleratedCompositingMode()
 {
     ASSERT(isInAcceleratedCompositingMode());

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h (176953 => 176954)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h	2014-12-08 18:46:49 UTC (rev 176954)
@@ -48,6 +48,10 @@
 
     bool hasReceivedFirstUpdate() const { return m_hasReceivedFirstUpdate; }
 
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+    void setNativeSurfaceHandleForCompositing(uint64_t);
+#endif
+
 private:
     // DrawingAreaProxy
     virtual void sizeDidChange();

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (176953 => 176954)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h	2014-12-08 18:46:49 UTC (rev 176954)
@@ -854,10 +854,6 @@
     // WebPopupMenuProxy::Client
     virtual NativeWebMouseEvent* currentlyProcessedMouseDownEvent() override;
 
-#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
-    void setAcceleratedCompositingWindowId(uint64_t nativeWindowId);
-#endif
-
     void setSuppressVisibilityUpdates(bool flag) { m_suppressVisibilityUpdates = flag; }
     bool suppressVisibilityUpdates() { return m_suppressVisibilityUpdates; }
 

Modified: trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp (176953 => 176954)


--- trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/UIProcess/gtk/WebPageProxyGtk.cpp	2014-12-08 18:46:49 UTC (rev 176954)
@@ -135,13 +135,6 @@
     webkitWebViewBaseSetInputMethodState(WEBKIT_WEB_VIEW_BASE(viewWidget()), enabled);
 }
 
-#if USE(TEXTURE_MAPPER_GL)
-void WebPageProxy::setAcceleratedCompositingWindowId(uint64_t nativeWindowId)
-{
-    process().send(Messages::WebPage::SetAcceleratedCompositingWindowId(nativeWindowId), m_pageID);
-}
-#endif
-
 #if HAVE(GTK_GESTURES)
 void WebPageProxy::getCenterForZoomGesture(const WebCore::IntPoint& centerInViewCoordinates, WebCore::IntPoint& center)
 {

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (176953 => 176954)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2014-12-08 18:46:49 UTC (rev 176954)
@@ -124,12 +124,20 @@
 
     virtual void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) { }
 
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+    uint64_t nativeSurfaceHandleForCompositing() { return m_nativeSurfaceHandleForCompositing; }
+#endif
+
 protected:
     DrawingArea(DrawingAreaType, WebPage&);
 
     DrawingAreaType m_type;
     WebPage& m_webPage;
 
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+    uint64_t m_nativeSurfaceHandleForCompositing;
+#endif
+
 private:
     // IPC::MessageReceiver.
     virtual void didReceiveMessage(IPC::Connection*, IPC::MessageDecoder&) override;
@@ -151,6 +159,10 @@
 
     virtual void addTransactionCallbackID(uint64_t callbackID) { ASSERT_NOT_REACHED(); }
 #endif
+
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+    virtual void setNativeSurfaceHandleForCompositing(uint64_t) = 0;
+#endif
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in (176953 => 176954)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.messages.in	2014-12-08 18:46:49 UTC (rev 176954)
@@ -39,4 +39,8 @@
     
     AddTransactionCallbackID(uint64_t callbackID)
 #endif
+
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+    SetNativeSurfaceHandleForCompositing(uint64_t handle)
+#endif
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (176953 => 176954)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2014-12-08 18:46:49 UTC (rev 176954)
@@ -643,4 +643,11 @@
     m_displayTimer.stop();
 }
 
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+void DrawingAreaImpl::setNativeSurfaceHandleForCompositing(uint64_t handle)
+{
+    m_nativeSurfaceHandleForCompositing = handle;
+}
+#endif
+
 } // namespace WebKit

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h (176953 => 176954)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h	2014-12-08 18:46:49 UTC (rev 176954)
@@ -67,6 +67,10 @@
     virtual void scheduleCompositingLayerFlush() override;
     virtual void scheduleCompositingLayerFlushImmediately() override;
 
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+    virtual void setNativeSurfaceHandleForCompositing(uint64_t) override;
+#endif
+
     // IPC message handlers.
     virtual void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
     virtual void didUpdate();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (176953 => 176954)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2014-12-08 18:46:49 UTC (rev 176954)
@@ -650,11 +650,7 @@
     void confirmComposition(const String& compositionString);
     void setComposition(const WTF::String& compositionString, const WTF::Vector<WebCore::CompositionUnderline>& underlines, uint64_t cursorPosition);
     void cancelComposition();
-#elif PLATFORM(GTK)
-#if USE(TEXTURE_MAPPER_GL)
-    void setAcceleratedCompositingWindowId(uint64_t nativeWindowHandle);
 #endif
-#endif
 
 #if HAVE(ACCESSIBILITY) && (PLATFORM(GTK) || PLATFORM(EFL))
     void updateAccessibilityTree();

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (176953 => 176954)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2014-12-08 18:46:49 UTC (rev 176954)
@@ -393,10 +393,6 @@
     WillStartUserTriggeredZooming();
 #endif
 
-#if PLATFORM(GTK) && USE(TEXTURE_MAPPER_GL)
-    SetAcceleratedCompositingWindowId(uint64_t nativeWindowHandle)
-#endif
-  
     SetScrollPinningBehavior(uint32_t pinning)
 
     GetBytecodeProfile(uint64_t callbackID)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp (176953 => 176954)


--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp	2014-12-08 18:46:49 UTC (rev 176954)
@@ -82,7 +82,7 @@
     if (m_context)
         return m_context.get();
 
-    uint64_t windowHandle = m_webPage->nativeWindowHandle();
+    uint64_t windowHandle = m_webPage->drawingArea()->nativeSurfaceHandleForCompositing();
     if (!windowHandle)
         return 0;
 
@@ -112,7 +112,7 @@
     m_rootLayer->addChild(m_nonCompositedContentLayer.get());
     m_nonCompositedContentLayer->setNeedsDisplay();
 
-    m_layerTreeContext.contextID = m_webPage->nativeWindowHandle();
+    m_layerTreeContext.contextID = m_webPage->drawingArea()->nativeSurfaceHandleForCompositing();
 
     GLContext* context = glContext();
     if (!context)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp (176953 => 176954)


--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp	2014-12-08 18:42:12 UTC (rev 176953)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/WebPageGtk.cpp	2014-12-08 18:46:49 UTC (rev 176954)
@@ -61,10 +61,6 @@
     GUniquePtr<gchar> plugID(atk_plug_get_id(ATK_PLUG(m_accessibilityObject.get())));
     send(Messages::WebPageProxy::BindAccessibilityTree(String(plugID.get())));
 #endif
-
-#if USE(TEXTURE_MAPPER_GL)
-    m_nativeWindowHandle = 0;
-#endif
 }
 
 void WebPage::platformDetach()
@@ -167,12 +163,6 @@
     return 0;
 }
 
-#if USE(TEXTURE_MAPPER_GL)
-void WebPage::setAcceleratedCompositingWindowId(uint64_t nativeWindowHandle)
-{
-    m_nativeWindowHandle = nativeWindowHandle;
-}
-#endif
 
 String WebPage::platformUserAgent(const URL& url) const
 {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to