Changeset 211350 in webkit


Ignore:
Timestamp:
Jan 29, 2017 2:06:30 AM (7 years ago)
Author:
Carlos Garcia Campos
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.

Location:
trunk/Source/WebKit2
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r211348 r211350  
     12017-01-29  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [Coordinated Graphics] WebPage shouldn't use the layerTreeHost directly
     4        https://bugs.webkit.org/show_bug.cgi?id=167494
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        In Coordinated Graphics we have a couple of methods that the WebPage uses directly from the layer tree host,
     9        instead of using the drawing area interface. This patch adds DrawingArea::didChangeViewportAttributes and
     10        DrawingArea::deviceOrPageScaleFactorChanged and renames LayerTreeHost::didChangeViewportProperties as
     11        LayerTreeHost::didChangeViewportAttributes for consistency.
     12
     13        * Shared/CoordinatedGraphics/SimpleViewportController.cpp:
     14        (WebKit::SimpleViewportController::didChangeViewportAttributes): Receive an rvalue reference to avoid copies.
     15        * Shared/CoordinatedGraphics/SimpleViewportController.h:
     16        * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
     17        (WebKit::AcceleratedDrawingArea::didChangeViewportAttributes): Forward it to the layer tree host if any.
     18        (WebKit::AcceleratedDrawingArea::deviceOrPageScaleFactorChanged): Ditto.
     19        * WebProcess/WebPage/AcceleratedDrawingArea.h:
     20        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
     21        (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
     22        (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties): Deleted.
     23        * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
     24        * WebProcess/WebPage/DrawingArea.h:
     25        * WebProcess/WebPage/LayerTreeHost.h:
     26        (WebKit::LayerTreeHost::didChangeViewportAttributes): Renamed and updated to pass an rvalue reference.
     27        (WebKit::LayerTreeHost::didChangeViewportProperties): Deleted.
     28        * WebProcess/WebPage/WebPage.cpp:
     29        (WebKit::WebPage::sendViewportAttributesChanged): Use the drawing area.
     30        (WebKit::WebPage::scalePage): Ditto
     31        (WebKit::WebPage::setDeviceScaleFactor): Ditto.
     32        (WebKit::WebPage::viewportPropertiesDidChange): Ditto.
     33
    1342017-01-28  Carlos Garcia Campos  <cgarcia@igalia.com>
    235
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.cpp

    r210954 r211350  
    5858}
    5959
    60 void SimpleViewportController::didChangeViewportAttributes(const ViewportAttributes& newAttributes)
     60void SimpleViewportController::didChangeViewportAttributes(ViewportAttributes&& newAttributes)
    6161{
    6262    if (newAttributes.layoutSize.isEmpty()) {
     
    6767    m_hasViewportAttribute = true;
    6868
    69     m_rawAttributes = newAttributes;
     69    m_rawAttributes = WTFMove(newAttributes);
    7070    m_allowsUserScaling = m_rawAttributes.userScalable;
    7171    m_initiallyFitToViewport = m_rawAttributes.initialScale < 0;
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/SimpleViewportController.h

    r210954 r211350  
    4242    void didChangeViewportSize(const WebCore::IntSize&);
    4343    void didChangeContentsSize(const WebCore::IntSize&);
    44     void didChangeViewportAttributes(const WebCore::ViewportAttributes&);
     44    void didChangeViewportAttributes(WebCore::ViewportAttributes&&);
    4545    void didScroll(const WebCore::IntPoint&);
    4646
  • trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp

    r211083 r211350  
    372372#endif
    373373
     374#if USE(COORDINATED_GRAPHICS_THREADED)
     375void AcceleratedDrawingArea::didChangeViewportAttributes(ViewportAttributes&& attrs)
     376{
     377    if (m_layerTreeHost)
     378        m_layerTreeHost->didChangeViewportAttributes(WTFMove(attrs));
     379}
     380#endif
     381
     382#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
     383void AcceleratedDrawingArea::deviceOrPageScaleFactorChanged()
     384{
     385    if (m_layerTreeHost)
     386        m_layerTreeHost->deviceOrPageScaleFactorChanged();
     387}
     388#endif
     389
    374390void AcceleratedDrawingArea::activityStateDidChange(ActivityState::Flags changed, bool, const Vector<uint64_t>&)
    375391{
  • trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h

    r208225 r211350  
    7474    void layerHostDidFlushLayers() override;
    7575
     76#if USE(COORDINATED_GRAPHICS_THREADED)
     77    void didChangeViewportAttributes(WebCore::ViewportAttributes&&) override;
     78#endif
     79
     80#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
     81    void deviceOrPageScaleFactorChanged() override;
     82#endif
     83
    7684    // IPC message handlers.
    7785    void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset) override;
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp

    r211205 r211350  
    140140}
    141141
    142 void ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties(const ViewportAttributes& attr)
    143 {
    144     m_viewportController.didChangeViewportAttributes(attr);
     142void ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes(ViewportAttributes&& attr)
     143{
     144    m_viewportController.didChangeViewportAttributes(WTFMove(attr));
    145145    didChangeViewport();
    146146}
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h

    r205431 r211350  
    6060
    6161    void contentsSizeChanged(const WebCore::IntSize&) override;
    62     void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
     62    void didChangeViewportAttributes(WebCore::ViewportAttributes&&) override;
    6363
    6464    void invalidate() override;
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h

    r208985 r211350  
    5353class GraphicsLayerFactory;
    5454class MachSendRight;
     55struct ViewportAttributes;
    5556}
    5657
     
    141142    virtual void layerHostDidFlushLayers() { };
    142143
     144#if USE(COORDINATED_GRAPHICS_THREADED)
     145    virtual void didChangeViewportAttributes(WebCore::ViewportAttributes&&) = 0;
     146#endif
     147
     148#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
     149    virtual void deviceOrPageScaleFactorChanged() = 0;
     150#endif
     151
    143152protected:
    144153    DrawingArea(DrawingAreaType, WebPage&);
  • trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h

    r210797 r211350  
    7272    virtual bool forceRepaintAsync(uint64_t /*callbackID*/) { return false; }
    7373    virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
    74     virtual void deviceOrPageScaleFactorChanged() = 0;
    7574    virtual void pageBackgroundTransparencyChanged() = 0;
    7675
     
    8685#if USE(COORDINATED_GRAPHICS_THREADED)
    8786    virtual void contentsSizeChanged(const WebCore::IntSize&) { };
    88     virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) { };
     87    virtual void didChangeViewportAttributes(WebCore::ViewportAttributes&&) { };
    8988#endif
    9089
     
    9594#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
    9695    virtual void setNativeSurfaceHandleForCompositing(uint64_t) { };
     96#endif
     97
     98#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
     99    virtual void deviceOrPageScaleFactorChanged() = 0;
    97100#endif
    98101
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r211341 r211350  
    238238#endif
    239239
    240 #if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    241 #include "LayerTreeHost.h"
    242 #endif
    243 
    244240#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
    245241#include "CoordinatedLayerTreeHostMessages.h"
     
    14301426
    14311427#if USE(COORDINATED_GRAPHICS_THREADED)
    1432     if (m_drawingArea->layerTreeHost())
    1433         m_drawingArea->layerTreeHost()->didChangeViewportProperties(attr);
     1428    m_drawingArea->didChangeViewportAttributes(WTFMove(attr));
    14341429#else
    14351430    send(Messages::WebPageProxy::DidChangeViewportProperties(attr));
     
    15891584
    15901585#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    1591     if (m_drawingArea->layerTreeHost())
    1592         m_drawingArea->layerTreeHost()->deviceOrPageScaleFactorChanged();
     1586    m_drawingArea->deviceOrPageScaleFactorChanged();
    15931587#endif
    15941588
     
    16671661
    16681662#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
    1669     if (m_drawingArea->layerTreeHost())
    1670         m_drawingArea->layerTreeHost()->deviceOrPageScaleFactorChanged();
     1663    m_drawingArea->deviceOrPageScaleFactorChanged();
    16711664#endif
    16721665}
     
    17521745        sendViewportAttributesChanged(viewportArguments);
    17531746#if USE(COORDINATED_GRAPHICS_THREADED)
    1754     else if (auto* layerTreeHost = m_drawingArea->layerTreeHost())
    1755         layerTreeHost->didChangeViewportProperties(ViewportAttributes());
     1747    else
     1748        m_drawingArea->didChangeViewportAttributes(ViewportAttributes());
    17561749#endif
    17571750#endif
Note: See TracChangeset for help on using the changeset viewer.