Title: [211350] trunk/Source/WebKit2
Revision
211350
Author
carlo...@webkit.org
Date
2017-01-29 02:06:30 -0800 (Sun, 29 Jan 2017)

Log Message

[Coordinated Graphics] WebPage shouldn't use the layerTreeHost directly
https://bugs.webkit.org/show_bug.cgi?id=167494

Reviewed by Michael Catanzaro.

In Coordinated Graphics we have a couple of methods that the WebPage uses directly from the layer tree host,
instead of using the drawing area interface. This patch adds DrawingArea::didChangeViewportAttributes and
DrawingArea::deviceOrPageScaleFactorChanged and renames LayerTreeHost::didChangeViewportProperties as
LayerTreeHost::didChangeViewportAttributes for consistency.

* Shared/CoordinatedGraphics/SimpleViewportController.cpp:
(WebKit::SimpleViewportController::didChangeViewportAttributes): Receive an rvalue reference to avoid copies.
* Shared/CoordinatedGraphics/SimpleViewportController.h:
* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
(WebKit::AcceleratedDrawingArea::didChangeViewportAttributes): Forward it to the layer tree host if any.
(WebKit::AcceleratedDrawingArea::deviceOrPageScaleFactorChanged): Ditto.
* WebProcess/WebPage/AcceleratedDrawingArea.h:
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
(WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
(WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties): Deleted.
* WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
* WebProcess/WebPage/DrawingArea.h:
* WebProcess/WebPage/LayerTreeHost.h:
(WebKit::LayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
(WebKit::LayerTreeHost::didChangeViewportProperties): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::sendViewportAttributesChanged): Use the drawing area.
(WebKit::WebPage::scalePage): Ditto
(WebKit::WebPage::setDeviceScaleFactor): Ditto.
(WebKit::WebPage::viewportPropertiesDidChange): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (211349 => 211350)


--- trunk/Source/WebKit2/ChangeLog	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/ChangeLog	2017-01-29 10:06:30 UTC (rev 211350)
@@ -1,3 +1,36 @@
+2017-01-29  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [Coordinated Graphics] WebPage shouldn't use the layerTreeHost directly
+        https://bugs.webkit.org/show_bug.cgi?id=167494
+
+        Reviewed by Michael Catanzaro.
+
+        In Coordinated Graphics we have a couple of methods that the WebPage uses directly from the layer tree host,
+        instead of using the drawing area interface. This patch adds DrawingArea::didChangeViewportAttributes and
+        DrawingArea::deviceOrPageScaleFactorChanged and renames LayerTreeHost::didChangeViewportProperties as
+        LayerTreeHost::didChangeViewportAttributes for consistency.
+
+        * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
+        (WebKit::SimpleViewportController::didChangeViewportAttributes): Receive an rvalue reference to avoid copies.
+        * Shared/CoordinatedGraphics/SimpleViewportController.h:
+        * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
+        (WebKit::AcceleratedDrawingArea::didChangeViewportAttributes): Forward it to the layer tree host if any.
+        (WebKit::AcceleratedDrawingArea::deviceOrPageScaleFactorChanged): Ditto.
+        * WebProcess/WebPage/AcceleratedDrawingArea.h:
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
+        (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
+        (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties): Deleted.
+        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
+        * WebProcess/WebPage/DrawingArea.h:
+        * WebProcess/WebPage/LayerTreeHost.h:
+        (WebKit::LayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
+        (WebKit::LayerTreeHost::didChangeViewportProperties): Deleted.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::sendViewportAttributesChanged): Use the drawing area.
+        (WebKit::WebPage::scalePage): Ditto
+        (WebKit::WebPage::setDeviceScaleFactor): Ditto.
+        (WebKit::WebPage::viewportPropertiesDidChange): Ditto.
+
 2017-01-28  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [Threaded Compositor] Crash when detaching the CoordinatedGraphicsScene

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp (211349 => 211350)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp	2017-01-29 10:06:30 UTC (rev 211350)
@@ -57,7 +57,7 @@
     }
 }
 
-void SimpleViewportController::didChangeViewportAttributes(const ViewportAttributes& newAttributes)
+void SimpleViewportController::didChangeViewportAttributes(ViewportAttributes&& newAttributes)
 {
     if (newAttributes.layoutSize.isEmpty()) {
         resetViewportToDefaultState();
@@ -66,7 +66,7 @@
 
     m_hasViewportAttribute = true;
 
-    m_rawAttributes = newAttributes;
+    m_rawAttributes = WTFMove(newAttributes);
     m_allowsUserScaling = m_rawAttributes.userScalable;
     m_initiallyFitToViewport = m_rawAttributes.initialScale < 0;
 

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h (211349 => 211350)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h	2017-01-29 10:06:30 UTC (rev 211350)
@@ -41,7 +41,7 @@
 
     void didChangeViewportSize(const WebCore::IntSize&);
     void didChangeContentsSize(const WebCore::IntSize&);
-    void didChangeViewportAttributes(const WebCore::ViewportAttributes&);
+    void didChangeViewportAttributes(WebCore::ViewportAttributes&&);
     void didScroll(const WebCore::IntPoint&);
 
     WebCore::FloatRect visibleContentsRect() const;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp (211349 => 211350)


--- trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp	2017-01-29 10:06:30 UTC (rev 211350)
@@ -371,6 +371,22 @@
 }
 #endif
 
+#if USE(COORDINATED_GRAPHICS_THREADED)
+void AcceleratedDrawingArea::didChangeViewportAttributes(ViewportAttributes&& attrs)
+{
+    if (m_layerTreeHost)
+        m_layerTreeHost->didChangeViewportAttributes(WTFMove(attrs));
+}
+#endif
+
+#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
+void AcceleratedDrawingArea::deviceOrPageScaleFactorChanged()
+{
+    if (m_layerTreeHost)
+        m_layerTreeHost->deviceOrPageScaleFactorChanged();
+}
+#endif
+
 void AcceleratedDrawingArea::activityStateDidChange(ActivityState::Flags changed, bool, const Vector<uint64_t>&)
 {
     if (changed & ActivityState::IsVisible) {

Modified: trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h (211349 => 211350)


--- trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h	2017-01-29 10:06:30 UTC (rev 211350)
@@ -73,6 +73,14 @@
 
     void layerHostDidFlushLayers() override;
 
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    void didChangeViewportAttributes(WebCore::ViewportAttributes&&) override;
+#endif
+
+#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
+    void deviceOrPageScaleFactorChanged() override;
+#endif
+
     // IPC message handlers.
     void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset) override;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (211349 => 211350)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp	2017-01-29 10:06:30 UTC (rev 211350)
@@ -139,9 +139,9 @@
     didChangeViewport();
 }
 
-void ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties(const ViewportAttributes& attr)
+void ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes(ViewportAttributes&& attr)
 {
-    m_viewportController.didChangeViewportAttributes(attr);
+    m_viewportController.didChangeViewportAttributes(WTFMove(attr));
     didChangeViewport();
 }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h (211349 => 211350)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h	2017-01-29 10:06:30 UTC (rev 211350)
@@ -59,7 +59,7 @@
     void pageBackgroundTransparencyChanged() override;
 
     void contentsSizeChanged(const WebCore::IntSize&) override;
-    void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
+    void didChangeViewportAttributes(WebCore::ViewportAttributes&&) override;
 
     void invalidate() override;
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (211349 => 211350)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2017-01-29 10:06:30 UTC (rev 211350)
@@ -52,6 +52,7 @@
 class GraphicsLayer;
 class GraphicsLayerFactory;
 class MachSendRight;
+struct ViewportAttributes;
 }
 
 namespace WebKit {
@@ -140,6 +141,14 @@
 
     virtual void layerHostDidFlushLayers() { };
 
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    virtual void didChangeViewportAttributes(WebCore::ViewportAttributes&&) = 0;
+#endif
+
+#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
+    virtual void deviceOrPageScaleFactorChanged() = 0;
+#endif
+
 protected:
     DrawingArea(DrawingAreaType, WebPage&);
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h (211349 => 211350)


--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2017-01-29 10:06:30 UTC (rev 211350)
@@ -71,7 +71,6 @@
     virtual void forceRepaint() = 0;
     virtual bool forceRepaintAsync(uint64_t /*callbackID*/) { return false; }
     virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
-    virtual void deviceOrPageScaleFactorChanged() = 0;
     virtual void pageBackgroundTransparencyChanged() = 0;
 
     virtual void pauseRendering();
@@ -85,7 +84,7 @@
 
 #if USE(COORDINATED_GRAPHICS_THREADED)
     virtual void contentsSizeChanged(const WebCore::IntSize&) { };
-    virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) { };
+    virtual void didChangeViewportAttributes(WebCore::ViewportAttributes&&) { };
 #endif
 
 #if USE(COORDINATED_GRAPHICS)
@@ -96,6 +95,10 @@
     virtual void setNativeSurfaceHandleForCompositing(uint64_t) { };
 #endif
 
+#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
+    virtual void deviceOrPageScaleFactorChanged() = 0;
+#endif
+
     virtual void setViewOverlayRootLayer(WebCore::GraphicsLayer* viewOverlayRootLayer) { m_viewOverlayRootLayer = viewOverlayRootLayer; }
 
 protected:

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (211349 => 211350)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-01-29 07:30:39 UTC (rev 211349)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2017-01-29 10:06:30 UTC (rev 211350)
@@ -237,10 +237,6 @@
 #include <wtf/RefCountedLeakCounter.h>
 #endif
 
-#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
-#include "LayerTreeHost.h"
-#endif
-
 #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
 #include "CoordinatedLayerTreeHostMessages.h"
 #endif
@@ -1429,8 +1425,7 @@
     setFixedLayoutSize(roundedIntSize(attr.layoutSize));
 
 #if USE(COORDINATED_GRAPHICS_THREADED)
-    if (m_drawingArea->layerTreeHost())
-        m_drawingArea->layerTreeHost()->didChangeViewportProperties(attr);
+    m_drawingArea->didChangeViewportAttributes(WTFMove(attr));
 #else
     send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
 #endif
@@ -1588,8 +1583,7 @@
         pluginView->pageScaleFactorDidChange();
 
 #if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
-    if (m_drawingArea->layerTreeHost())
-        m_drawingArea->layerTreeHost()->deviceOrPageScaleFactorChanged();
+    m_drawingArea->deviceOrPageScaleFactorChanged();
 #endif
 
     send(Messages::WebPageProxy::PageScaleFactorDidChange(scale));
@@ -1666,8 +1660,7 @@
     }
 
 #if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
-    if (m_drawingArea->layerTreeHost())
-        m_drawingArea->layerTreeHost()->deviceOrPageScaleFactorChanged();
+    m_drawingArea->deviceOrPageScaleFactorChanged();
 #endif
 }
 
@@ -1751,8 +1744,8 @@
     if (view && view->useFixedLayout())
         sendViewportAttributesChanged(viewportArguments);
 #if USE(COORDINATED_GRAPHICS_THREADED)
-    else if (auto* layerTreeHost = m_drawingArea->layerTreeHost())
-        layerTreeHost->didChangeViewportProperties(ViewportAttributes());
+    else
+        m_drawingArea->didChangeViewportAttributes(ViewportAttributes());
 #endif
 #endif
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to