[CoordGraphics] Remove the remaining CoordinatedGraphicsLayerState cruft
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2018 12:34:36 +0000 (12:34 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 23 Aug 2018 12:34:36 +0000 (12:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=188881

Reviewed by Carlos Garcia Campos.

Source/WebCore:

Remove what's left of CoordinatedGraphicsLayerState usage in the
CoordinatedGraphics subsystem. In CoordinatedGraphicsLayer, this means
dropping the m_layerState member variable since at this point it is not
used anymore in any capacity. Affected helper methods and member
variables are also removed where possible.

The syncLayerState() method on the CoordinatedGraphicsLayerClient
interface is adjusted to not accept any parameters. Client should just
mark frame synchronization as required while the layer state is now
managed differently.

Instead of the CoordinatedLayerID (which is removed) the
Nicosia::PlatformLayer::LayerID alias is introduced as a layer ID type,
aliased to the uint64_t type.

CoordinatedGraphicsState.h file is rid of all structs except the
basic CoordinatedGraphicsState struct that at this point contains only
a reference to the Nicosia::Scene object. This will be further
simplified in the patches that follow.

* platform/graphics/nicosia/NicosiaPlatformLayer.h:
(Nicosia::PlatformLayer::id const):
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
(WebCore::CoordinatedGraphicsLayer::didChangeAnimations):
(WebCore::CoordinatedGraphicsLayer::didChangeChildren):
(WebCore::CoordinatedGraphicsLayer::didChangeFilters):
(WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
(WebCore::CoordinatedGraphicsLayer::didChangeGeometry):
(WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
(WebCore::CoordinatedGraphicsLayer::setPosition):
(WebCore::CoordinatedGraphicsLayer::setAnchorPoint):
(WebCore::CoordinatedGraphicsLayer::setSize):
(WebCore::CoordinatedGraphicsLayer::setTransform):
(WebCore::CoordinatedGraphicsLayer::setChildrenTransform):
(WebCore::CoordinatedGraphicsLayer::setPreserves3D):
(WebCore::CoordinatedGraphicsLayer::setMasksToBounds):
(WebCore::CoordinatedGraphicsLayer::setDrawsContent):
(WebCore::CoordinatedGraphicsLayer::setContentsVisible):
(WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
(WebCore::CoordinatedGraphicsLayer::setBackfaceVisibility):
(WebCore::CoordinatedGraphicsLayer::setOpacity):
(WebCore::CoordinatedGraphicsLayer::setContentsRect):
(WebCore::CoordinatedGraphicsLayer::setContentsTileSize):
(WebCore::CoordinatedGraphicsLayer::setContentsTilePhase):
(WebCore::CoordinatedGraphicsLayer::setContentsToSolidColor):
(WebCore::CoordinatedGraphicsLayer::setShowDebugBorder):
(WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
(WebCore::CoordinatedGraphicsLayer::setMaskLayer):
(WebCore::CoordinatedGraphicsLayer::setReplicatedByLayer):
(WebCore::CoordinatedGraphicsLayer::setNeedsDisplay):
(WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
(WebCore::CoordinatedGraphicsLayer::setDebugBorder):
(WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
(WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers):
(WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
(WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded):
(WebCore::toCoordinatedLayerID): Deleted.
(WebCore::CoordinatedGraphicsLayer::didChangeLayerState): Deleted.
(WebCore::CoordinatedGraphicsLayer::syncChildren): Deleted.
(WebCore::CoordinatedGraphicsLayer::syncFilters): Deleted.
(WebCore::CoordinatedGraphicsLayer::syncLayerState): Deleted.
(WebCore::CoordinatedGraphicsLayer::syncAnimations): Deleted.
(WebCore::CoordinatedGraphicsLayer::resetLayerState): Deleted.
* platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
* platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
(): Deleted.
(WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState): Deleted.
(WebCore::CoordinatedGraphicsLayerState::hasPendingChanges const): Deleted.

Source/WebKit:

Rid CompositingCoordinator class of code that manages now-deleted state
tracking of layer creation, update and removal on the
CoordinatedGraphicsState class. The syncLayerState() method is changed
accordingly, now only enforcing a frame synchronization when called.

Use of Nicosia::PlatformLayer::LayerID is adopted since the
CoordinatedLayerID type has been removed.

* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::CoordinatedGraphicsScene::purgeGLResources):
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::flushPendingLayerChanges):
(WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded):
(WebKit::CompositingCoordinator::syncLayerState):
(WebKit::CompositingCoordinator::createGraphicsLayer):
(WebKit::CompositingCoordinator::detachLayer):
(WebKit::CompositingCoordinator::attachLayer):
(WebKit::CompositingCoordinator::clearPendingStateChanges): Deleted.
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h
Source/WebKit/ChangeLog
Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h

index 091094e..a5b0128 100644 (file)
@@ -1,3 +1,79 @@
+2018-08-23  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CoordGraphics] Remove the remaining CoordinatedGraphicsLayerState cruft
+        https://bugs.webkit.org/show_bug.cgi?id=188881
+
+        Reviewed by Carlos Garcia Campos.
+
+        Remove what's left of CoordinatedGraphicsLayerState usage in the
+        CoordinatedGraphics subsystem. In CoordinatedGraphicsLayer, this means
+        dropping the m_layerState member variable since at this point it is not
+        used anymore in any capacity. Affected helper methods and member
+        variables are also removed where possible.
+
+        The syncLayerState() method on the CoordinatedGraphicsLayerClient
+        interface is adjusted to not accept any parameters. Client should just
+        mark frame synchronization as required while the layer state is now
+        managed differently.
+
+        Instead of the CoordinatedLayerID (which is removed) the
+        Nicosia::PlatformLayer::LayerID alias is introduced as a layer ID type,
+        aliased to the uint64_t type.
+
+        CoordinatedGraphicsState.h file is rid of all structs except the
+        basic CoordinatedGraphicsState struct that at this point contains only
+        a reference to the Nicosia::Scene object. This will be further
+        simplified in the patches that follow.
+
+        * platform/graphics/nicosia/NicosiaPlatformLayer.h:
+        (Nicosia::PlatformLayer::id const):
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp:
+        (WebCore::CoordinatedGraphicsLayer::didChangeAnimations):
+        (WebCore::CoordinatedGraphicsLayer::didChangeChildren):
+        (WebCore::CoordinatedGraphicsLayer::didChangeFilters):
+        (WebCore::CoordinatedGraphicsLayer::didUpdateTileBuffers):
+        (WebCore::CoordinatedGraphicsLayer::didChangeGeometry):
+        (WebCore::CoordinatedGraphicsLayer::CoordinatedGraphicsLayer):
+        (WebCore::CoordinatedGraphicsLayer::setPosition):
+        (WebCore::CoordinatedGraphicsLayer::setAnchorPoint):
+        (WebCore::CoordinatedGraphicsLayer::setSize):
+        (WebCore::CoordinatedGraphicsLayer::setTransform):
+        (WebCore::CoordinatedGraphicsLayer::setChildrenTransform):
+        (WebCore::CoordinatedGraphicsLayer::setPreserves3D):
+        (WebCore::CoordinatedGraphicsLayer::setMasksToBounds):
+        (WebCore::CoordinatedGraphicsLayer::setDrawsContent):
+        (WebCore::CoordinatedGraphicsLayer::setContentsVisible):
+        (WebCore::CoordinatedGraphicsLayer::setContentsOpaque):
+        (WebCore::CoordinatedGraphicsLayer::setBackfaceVisibility):
+        (WebCore::CoordinatedGraphicsLayer::setOpacity):
+        (WebCore::CoordinatedGraphicsLayer::setContentsRect):
+        (WebCore::CoordinatedGraphicsLayer::setContentsTileSize):
+        (WebCore::CoordinatedGraphicsLayer::setContentsTilePhase):
+        (WebCore::CoordinatedGraphicsLayer::setContentsToSolidColor):
+        (WebCore::CoordinatedGraphicsLayer::setShowDebugBorder):
+        (WebCore::CoordinatedGraphicsLayer::setShowRepaintCounter):
+        (WebCore::CoordinatedGraphicsLayer::setMaskLayer):
+        (WebCore::CoordinatedGraphicsLayer::setReplicatedByLayer):
+        (WebCore::CoordinatedGraphicsLayer::setNeedsDisplay):
+        (WebCore::CoordinatedGraphicsLayer::setNeedsDisplayInRect):
+        (WebCore::CoordinatedGraphicsLayer::setDebugBorder):
+        (WebCore::CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly):
+        (WebCore::CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers):
+        (WebCore::CoordinatedGraphicsLayer::purgeBackingStores):
+        (WebCore::CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded):
+        (WebCore::toCoordinatedLayerID): Deleted.
+        (WebCore::CoordinatedGraphicsLayer::didChangeLayerState): Deleted.
+        (WebCore::CoordinatedGraphicsLayer::syncChildren): Deleted.
+        (WebCore::CoordinatedGraphicsLayer::syncFilters): Deleted.
+        (WebCore::CoordinatedGraphicsLayer::syncLayerState): Deleted.
+        (WebCore::CoordinatedGraphicsLayer::syncAnimations): Deleted.
+        (WebCore::CoordinatedGraphicsLayer::resetLayerState): Deleted.
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h:
+        * platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h:
+        (): Deleted.
+        (WebCore::CoordinatedGraphicsLayerState::CoordinatedGraphicsLayerState): Deleted.
+        (WebCore::CoordinatedGraphicsLayerState::hasPendingChanges const): Deleted.
+
 2018-08-22  Zan Dobersek  <zdobersek@igalia.com>
 
         [CoordGraphics] Drop old-school PlatformLayer management in CoordinatedGraphicsLayer
index 49f22db..be3a525 100644 (file)
@@ -50,7 +50,8 @@ public:
     virtual bool isCompositionLayer() const { return false; }
     virtual bool isContentLayer() const { return false; }
 
-    uint64_t id() const { return m_id; }
+    using LayerID = uint64_t;
+    LayerID id() const { return m_id; }
 
 protected:
     explicit PlatformLayer(uint64_t);
index 7f38fd9..6aff0fd 100644 (file)
@@ -54,11 +54,6 @@ std::unique_ptr<GraphicsLayer> GraphicsLayer::create(GraphicsLayerFactory* facto
     return factory->createGraphicsLayer(layerType, client);
 }
 
-static CoordinatedLayerID toCoordinatedLayerID(GraphicsLayer* layer)
-{
-    return is<CoordinatedGraphicsLayer>(layer) ? downcast<CoordinatedGraphicsLayer>(*layer).id() : 0;
-}
-
 void CoordinatedGraphicsLayer::notifyFlushRequired()
 {
     if (!m_coordinator)
@@ -70,27 +65,21 @@ void CoordinatedGraphicsLayer::notifyFlushRequired()
     client().notifyFlushRequired(this);
 }
 
-void CoordinatedGraphicsLayer::didChangeLayerState()
-{
-    m_shouldSyncLayerState = true;
-    notifyFlushRequired();
-}
-
 void CoordinatedGraphicsLayer::didChangeAnimations()
 {
-    m_shouldSyncAnimations = true;
+    m_nicosia.delta.animationsChanged = true;
     notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::didChangeChildren()
 {
-    m_shouldSyncChildren = true;
+    m_nicosia.delta.childrenChanged = true;
     notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::didChangeFilters()
 {
-    m_shouldSyncFilters = true;
+    m_nicosia.delta.filtersChanged = true;
     notifyFlushRequired();
 }
 
@@ -100,8 +89,6 @@ void CoordinatedGraphicsLayer::didUpdateTileBuffers()
         return;
 
     auto repaintCount = incrementRepaintCount();
-    m_layerState.repaintCount.count = repaintCount;
-    m_layerState.repaintCountChanged = true;
     m_nicosia.repaintCounter.count = repaintCount;
     m_nicosia.delta.repaintCounterChanged = true;
 }
@@ -117,7 +104,7 @@ void CoordinatedGraphicsLayer::setShouldUpdateVisibleRect()
 
 void CoordinatedGraphicsLayer::didChangeGeometry()
 {
-    didChangeLayerState();
+    notifyFlushRequired();
     setShouldUpdateVisibleRect();
 }
 
@@ -127,25 +114,22 @@ CoordinatedGraphicsLayer::CoordinatedGraphicsLayer(Type layerType, GraphicsLayer
     , m_isPurging(false)
 #endif
     , m_shouldUpdateVisibleRect(true)
-    , m_shouldSyncLayerState(true)
-    , m_shouldSyncChildren(true)
-    , m_shouldSyncFilters(true)
-    , m_shouldSyncAnimations(true)
     , m_movingVisibleRect(false)
     , m_pendingContentsScaleAdjustment(false)
     , m_pendingVisibleRectAdjustment(false)
-#if USE(COORDINATED_GRAPHICS_THREADED)
     , m_shouldUpdatePlatformLayer(false)
-#endif
     , m_coordinator(0)
     , m_compositedNativeImagePtr(0)
     , m_animationStartedTimer(*this, &CoordinatedGraphicsLayer::animationStartedTimerFired)
 {
-    static CoordinatedLayerID nextLayerID = 1;
+    static Nicosia::PlatformLayer::LayerID nextLayerID = 1;
     m_id = nextLayerID++;
 
     m_nicosia.layer = Nicosia::CompositionLayer::create(m_id,
         Nicosia::CompositionLayerTextureMapperImpl::createFactory());
+
+    // Enforce a complete flush on the first occasion.
+    m_nicosia.delta.value = UINT_MAX;
 }
 
 CoordinatedGraphicsLayer::~CoordinatedGraphicsLayer()
@@ -219,7 +203,6 @@ void CoordinatedGraphicsLayer::setPosition(const FloatPoint& p)
         return;
 
     GraphicsLayer::setPosition(p);
-    m_layerState.positionChanged = true;
     m_nicosia.delta.positionChanged = true;
     didChangeGeometry();
 }
@@ -230,7 +213,6 @@ void CoordinatedGraphicsLayer::setAnchorPoint(const FloatPoint3D& p)
         return;
 
     GraphicsLayer::setAnchorPoint(p);
-    m_layerState.anchorPointChanged = true;
     m_nicosia.delta.anchorPointChanged = true;
     didChangeGeometry();
 }
@@ -241,7 +223,6 @@ void CoordinatedGraphicsLayer::setSize(const FloatSize& size)
         return;
 
     GraphicsLayer::setSize(size);
-    m_layerState.sizeChanged = true;
     m_nicosia.delta.sizeChanged = true;
 
     if (maskLayer())
@@ -255,7 +236,6 @@ void CoordinatedGraphicsLayer::setTransform(const TransformationMatrix& t)
         return;
 
     GraphicsLayer::setTransform(t);
-    m_layerState.transformChanged = true;
     m_nicosia.delta.transformChanged = true;
 
     didChangeGeometry();
@@ -267,7 +247,6 @@ void CoordinatedGraphicsLayer::setChildrenTransform(const TransformationMatrix&
         return;
 
     GraphicsLayer::setChildrenTransform(t);
-    m_layerState.childrenTransformChanged = true;
     m_nicosia.delta.childrenTransformChanged = true;
 
     didChangeGeometry();
@@ -279,8 +258,6 @@ void CoordinatedGraphicsLayer::setPreserves3D(bool b)
         return;
 
     GraphicsLayer::setPreserves3D(b);
-    m_layerState.preserves3D = b;
-    m_layerState.flagsChanged = true;
     m_nicosia.delta.flagsChanged = true;
 
     didChangeGeometry();
@@ -291,8 +268,6 @@ void CoordinatedGraphicsLayer::setMasksToBounds(bool b)
     if (masksToBounds() == b)
         return;
     GraphicsLayer::setMasksToBounds(b);
-    m_layerState.masksToBounds = b;
-    m_layerState.flagsChanged = true;
     m_nicosia.delta.flagsChanged = true;
 
     didChangeGeometry();
@@ -303,11 +278,9 @@ void CoordinatedGraphicsLayer::setDrawsContent(bool b)
     if (drawsContent() == b)
         return;
     GraphicsLayer::setDrawsContent(b);
-    m_layerState.drawsContent = b;
-    m_layerState.flagsChanged = true;
     m_nicosia.delta.flagsChanged = true;
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setContentsVisible(bool b)
@@ -315,14 +288,12 @@ void CoordinatedGraphicsLayer::setContentsVisible(bool b)
     if (contentsAreVisible() == b)
         return;
     GraphicsLayer::setContentsVisible(b);
-    m_layerState.contentsVisible = b;
-    m_layerState.flagsChanged = true;
     m_nicosia.delta.flagsChanged = true;
 
     if (maskLayer())
         maskLayer()->setContentsVisible(b);
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setContentsOpaque(bool b)
@@ -331,8 +302,6 @@ void CoordinatedGraphicsLayer::setContentsOpaque(bool b)
         return;
 
     GraphicsLayer::setContentsOpaque(b);
-    m_layerState.contentsOpaque = b;
-    m_layerState.flagsChanged = true;
     m_nicosia.delta.flagsChanged = true;
 
     // Demand a repaint of the whole layer.
@@ -343,7 +312,7 @@ void CoordinatedGraphicsLayer::setContentsOpaque(bool b)
         addRepaintRect({ { }, m_size });
     }
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setBackfaceVisibility(bool b)
@@ -352,11 +321,9 @@ void CoordinatedGraphicsLayer::setBackfaceVisibility(bool b)
         return;
 
     GraphicsLayer::setBackfaceVisibility(b);
-    m_layerState.backfaceVisible = b;
-    m_layerState.flagsChanged = true;
     m_nicosia.delta.flagsChanged = true;
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setOpacity(float opacity)
@@ -365,11 +332,9 @@ void CoordinatedGraphicsLayer::setOpacity(float opacity)
         return;
 
     GraphicsLayer::setOpacity(opacity);
-    m_layerState.opacity = opacity;
-    m_layerState.opacityChanged = true;
     m_nicosia.delta.opacityChanged = true;
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setContentsRect(const FloatRect& r)
@@ -378,11 +343,9 @@ void CoordinatedGraphicsLayer::setContentsRect(const FloatRect& r)
         return;
 
     GraphicsLayer::setContentsRect(r);
-    m_layerState.contentsRect = r;
-    m_layerState.contentsRectChanged = true;
     m_nicosia.delta.contentsRectChanged = true;
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setContentsTileSize(const FloatSize& s)
@@ -391,10 +354,8 @@ void CoordinatedGraphicsLayer::setContentsTileSize(const FloatSize& s)
         return;
 
     GraphicsLayer::setContentsTileSize(s);
-    m_layerState.contentsTileSize = s;
-    m_layerState.contentsTilingChanged = true;
     m_nicosia.delta.contentsTilingChanged = true;
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setContentsTilePhase(const FloatSize& p)
@@ -403,10 +364,8 @@ void CoordinatedGraphicsLayer::setContentsTilePhase(const FloatSize& p)
         return;
 
     GraphicsLayer::setContentsTilePhase(p);
-    m_layerState.contentsTilePhase = p;
-    m_layerState.contentsTilingChanged = true;
     m_nicosia.delta.contentsTilingChanged = true;
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 bool GraphicsLayer::supportsContentsTiling()
@@ -476,11 +435,9 @@ void CoordinatedGraphicsLayer::setContentsToSolidColor(const Color& color)
         return;
 
     m_solidColor = color;
-    m_layerState.solidColor = color;
-    m_layerState.solidColorChanged = true;
     m_nicosia.delta.solidColorChanged = true;
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setShowDebugBorder(bool show)
@@ -489,12 +446,13 @@ void CoordinatedGraphicsLayer::setShowDebugBorder(bool show)
         return;
 
     GraphicsLayer::setShowDebugBorder(show);
-    m_layerState.debugVisuals.showDebugBorders = show;
-    m_layerState.debugVisualsChanged = true;
     m_nicosia.debugBorder.visible = show;
     m_nicosia.delta.debugBorderChanged = true;
 
-    didChangeLayerState();
+    if (m_nicosia.debugBorder.visible)
+        updateDebugIndicators();
+
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setShowRepaintCounter(bool show)
@@ -503,12 +461,10 @@ void CoordinatedGraphicsLayer::setShowRepaintCounter(bool show)
         return;
 
     GraphicsLayer::setShowRepaintCounter(show);
-    m_layerState.repaintCount.showRepaintCounter = show;
-    m_layerState.repaintCountChanged = true;
     m_nicosia.repaintCounter.visible = show;
     m_nicosia.delta.repaintCounterChanged = true;
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setContentsToImage(Image* image)
@@ -536,14 +492,10 @@ void CoordinatedGraphicsLayer::setMaskLayer(GraphicsLayer* layer)
 
     layer->setSize(size());
     layer->setContentsVisible(contentsAreVisible());
-    auto& coordinatedLayer = downcast<CoordinatedGraphicsLayer>(*layer);
-    coordinatedLayer.didChangeLayerState();
 
-    m_layerState.mask = coordinatedLayer.id();
-    m_layerState.maskChanged = true;
     m_nicosia.delta.maskChanged = true;
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 bool CoordinatedGraphicsLayer::shouldDirectlyCompositeImage(Image* image) const
@@ -564,10 +516,8 @@ void CoordinatedGraphicsLayer::setReplicatedByLayer(GraphicsLayer* layer)
         return;
 
     GraphicsLayer::setReplicatedByLayer(layer);
-    m_layerState.replica = toCoordinatedLayerID(layer);
-    m_layerState.replicaChanged = true;
     m_nicosia.delta.replicaChanged = true;
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setNeedsDisplay()
@@ -578,7 +528,7 @@ void CoordinatedGraphicsLayer::setNeedsDisplay()
     m_needsDisplay.completeLayer = true;
     m_needsDisplay.rects.clear();
 
-    didChangeLayerState();
+    notifyFlushRequired();
     addRepaintRect({ { }, m_size });
 }
 
@@ -605,7 +555,7 @@ void CoordinatedGraphicsLayer::setNeedsDisplayInRect(const FloatRect& initialRec
     else
         rects[0].unite(rect);
 
-    didChangeLayerState();
+    notifyFlushRequired();
     addRepaintRect(rect);
 }
 
@@ -623,94 +573,20 @@ void CoordinatedGraphicsLayer::flushCompositingState(const FloatRect& rect)
         child->flushCompositingState(rect);
 }
 
-void CoordinatedGraphicsLayer::syncChildren()
-{
-    if (!m_shouldSyncChildren)
-        return;
-    m_shouldSyncChildren = false;
-    m_layerState.childrenChanged = true;
-    m_nicosia.delta.childrenChanged = true;
-
-    m_layerState.children.clear();
-    for (auto& child : children())
-        m_layerState.children.append(toCoordinatedLayerID(child));
-}
-
-void CoordinatedGraphicsLayer::syncFilters()
-{
-    if (!m_shouldSyncFilters)
-        return;
-    m_shouldSyncFilters = false;
-
-    m_layerState.filters = GraphicsLayer::filters();
-    m_layerState.filtersChanged = true;
-    m_nicosia.delta.filtersChanged = true;
-}
-
-void CoordinatedGraphicsLayer::syncLayerState()
-{
-    if (!m_shouldSyncLayerState)
-        return;
-    m_shouldSyncLayerState = false;
-
-    m_layerState.childrenTransform = childrenTransform();
-    m_layerState.contentsRect = contentsRect();
-    m_layerState.mask = toCoordinatedLayerID(maskLayer());
-    m_layerState.opacity = opacity();
-    m_layerState.replica = toCoordinatedLayerID(replicaLayer());
-    m_layerState.transform = transform();
-
-    m_layerState.anchorPoint = m_adjustedAnchorPoint;
-    m_layerState.pos = m_adjustedPosition;
-    m_layerState.size = m_adjustedSize;
-
-    if (m_layerState.flagsChanged) {
-        m_layerState.contentsOpaque = contentsOpaque();
-        m_layerState.drawsContent = drawsContent();
-        m_layerState.contentsVisible = contentsAreVisible();
-        m_layerState.backfaceVisible = backfaceVisibility();
-        m_layerState.masksToBounds = masksToBounds();
-        m_layerState.preserves3D = preserves3D();
-    }
-
-    if (m_layerState.debugVisualsChanged) {
-        m_layerState.debugVisuals.showDebugBorders = isShowingDebugBorder();
-        if (m_layerState.debugVisuals.showDebugBorders)
-            updateDebugIndicators();
-    }
-    if (m_layerState.repaintCountChanged)
-        m_layerState.repaintCount.showRepaintCounter = isShowingRepaintCounter();
-}
-
 void CoordinatedGraphicsLayer::setDebugBorder(const Color& color, float width)
 {
-    ASSERT(m_layerState.debugVisuals.showDebugBorders);
-    if (m_layerState.debugVisuals.debugBorderColor != color) {
-        m_layerState.debugVisuals.debugBorderColor = color;
-        m_layerState.debugVisualsChanged = true;
+    ASSERT(m_nicosia.debugBorder.visible);
+    if (m_nicosia.debugBorder.color != color) {
         m_nicosia.debugBorder.color = color;
         m_nicosia.delta.debugBorderChanged = true;
     }
 
-    if (m_layerState.debugVisuals.debugBorderWidth != width) {
-        m_layerState.debugVisuals.debugBorderWidth = width;
-        m_layerState.debugVisualsChanged = true;
+    if (m_nicosia.debugBorder.width != width) {
         m_nicosia.debugBorder.width = width;
         m_nicosia.delta.debugBorderChanged = true;
     }
 }
 
-void CoordinatedGraphicsLayer::syncAnimations()
-{
-    if (!m_shouldSyncAnimations)
-        return;
-
-    m_shouldSyncAnimations = false;
-    m_layerState.animations = m_animations.getActiveAnimations();
-    m_layerState.animationsChanged = true;
-    m_nicosia.delta.animationsChanged = true;
-}
-
 void CoordinatedGraphicsLayer::updatePlatformLayer()
 {
     if (!m_shouldUpdatePlatformLayer)
@@ -733,15 +609,7 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly()
     // Sets the values.
     computePixelAlignment(m_adjustedPosition, m_adjustedSize, m_adjustedAnchorPoint, m_pixelAlignmentOffset);
 
-    // FIXME: this is commented out to immediately disable any old-way image updates.
-    // It will soon be removed in a larger cleanup.
-    // syncImageBacking();
-
-    syncLayerState();
-    syncAnimations();
     computeTransformedVisibleRect();
-    syncChildren();
-    syncFilters();
     updatePlatformLayer();
 
     // Only unset m_movingVisibleRect after we have updated the visible rect after the animation stopped.
@@ -893,13 +761,8 @@ void CoordinatedGraphicsLayer::flushCompositingStateForThisLayerOnly()
 
 void CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers()
 {
-    // FIXME: For now the best way for layer state changes to trigger an update is to use
-    // the CoordinatedGraphicsLayerClient::syncLayerState() method. This should be simplified
-    // once the m_layerState member object is removed.
-    if (m_nicosia.performLayerSync || m_layerState.hasPendingChanges()) {
-        m_coordinator->syncLayerState(m_id, m_layerState);
-        resetLayerState();
-    }
+    if (m_nicosia.performLayerSync)
+        m_coordinator->syncLayerState();
     m_nicosia.performLayerSync = false;
 
     if (maskLayer())
@@ -909,11 +772,6 @@ void CoordinatedGraphicsLayer::syncPendingStateChangesIncludingSubLayers()
         downcast<CoordinatedGraphicsLayer>(*child).syncPendingStateChangesIncludingSubLayers();
 }
 
-void CoordinatedGraphicsLayer::resetLayerState()
-{
-    m_layerState.changeMask = 0;
-}
-
 void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged()
 {
     if (shouldHaveBackingStore())
@@ -1093,7 +951,7 @@ void CoordinatedGraphicsLayer::purgeBackingStores()
         m_nicosia.backingStore = nullptr;
     }
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setCoordinator(CoordinatedGraphicsLayerClient* coordinator)
@@ -1121,7 +979,7 @@ void CoordinatedGraphicsLayer::setCoordinatorIncludingSubLayersIfNeeded(Coordina
     // flag value, so the scene won't update it and the layer won't be rendered.
     //
     // We need to update here the layer changeMask so the scene gets all the current values.
-    m_layerState.changeMask = UINT_MAX;
+    m_nicosia.delta.value = UINT_MAX;
 
     coordinator->attachLayer(this);
     for (auto& child : children())
index c0733ae..3b5ee9f 100644 (file)
@@ -50,8 +50,7 @@ public:
     virtual void detachLayer(CoordinatedGraphicsLayer*) = 0;
     virtual void attachLayer(CoordinatedGraphicsLayer*) = 0;
     virtual Nicosia::PaintingEngine& paintingEngine() = 0;
-
-    virtual void syncLayerState(CoordinatedLayerID, CoordinatedGraphicsLayerState&) = 0;
+    virtual void syncLayerState() = 0;
 };
 
 class WEBCORE_EXPORT CoordinatedGraphicsLayer : public GraphicsLayer {
@@ -112,7 +111,7 @@ public:
     FloatPoint computePositionRelativeToBase();
     void computePixelAlignment(FloatPoint& position, FloatSize&, FloatPoint3D& anchorPoint, FloatSize& alignmentOffset);
 
-    CoordinatedLayerID id() const { return m_id; }
+    Nicosia::PlatformLayer::LayerID id() const { return m_id; }
 
     IntRect transformedVisibleRect();
 
@@ -131,23 +130,15 @@ private:
 
     void setDebugBorder(const Color&, float width) override;
 
-    void didChangeLayerState();
     void didChangeAnimations();
     void didChangeGeometry();
     void didChangeChildren();
     void didChangeFilters();
     void didUpdateTileBuffers();
 
-    void resetLayerState();
-    void syncLayerState();
-    void syncAnimations();
-    void syncChildren();
-    void syncFilters();
     void computeTransformedVisibleRect();
     void updateContentBuffers();
 
-    void releaseImageBackingIfNeeded();
-
     void notifyFlushRequired();
 
     bool shouldHaveBackingStore() const;
@@ -161,8 +152,7 @@ private:
 
     bool filtersCanBeComposited(const FilterOperations&) const;
 
-    CoordinatedLayerID m_id;
-    CoordinatedGraphicsLayerState m_layerState;
+    Nicosia::PlatformLayer::LayerID m_id;
     GraphicsLayerTransform m_layerTransform;
     TransformationMatrix m_cachedInverseTransform;
     FloatSize m_pixelAlignmentOffset;
@@ -177,15 +167,10 @@ private:
 #endif
     bool m_shouldUpdateVisibleRect: 1;
     bool m_shouldSyncLayerState: 1;
-    bool m_shouldSyncChildren: 1;
-    bool m_shouldSyncFilters: 1;
-    bool m_shouldSyncAnimations: 1;
     bool m_movingVisibleRect : 1;
     bool m_pendingContentsScaleAdjustment : 1;
     bool m_pendingVisibleRectAdjustment : 1;
-#if USE(COORDINATED_GRAPHICS_THREADED)
     bool m_shouldUpdatePlatformLayer : 1;
-#endif
 
     CoordinatedGraphicsLayerClient* m_coordinator;
 
index 6244a61..bb9e79d 100644 (file)
 
 #if USE(COORDINATED_GRAPHICS)
 
-#include "Color.h"
-#include "FilterOperations.h"
-#include "FloatRect.h"
-#include "FloatSize.h"
-#include "IntRect.h"
-#include "IntSize.h"
-#include "NicosiaBuffer.h"
-#include "NicosiaPlatformLayer.h"
 #include "NicosiaScene.h"
-#include "SurfaceUpdateInfo.h"
-#include "TextureMapperAnimation.h"
-#include "TransformationMatrix.h"
 
 namespace WebCore {
 
-typedef uint32_t CoordinatedLayerID;
-enum { InvalidCoordinatedLayerID = 0 };
-
-struct DebugVisuals {
-    Color debugBorderColor;
-    float debugBorderWidth { 0 };
-    bool showDebugBorders { false };
-};
-
-struct RepaintCount {
-    unsigned count { 0 };
-    bool showRepaintCounter { false };
-};
-
-struct CoordinatedGraphicsLayerState {
-    union {
-        struct {
-            bool positionChanged: 1;
-            bool anchorPointChanged: 1;
-            bool sizeChanged: 1;
-            bool transformChanged: 1;
-            bool childrenTransformChanged: 1;
-            bool contentsRectChanged: 1;
-            bool opacityChanged: 1;
-            bool solidColorChanged: 1;
-            bool debugVisualsChanged: 1;
-            bool replicaChanged: 1;
-            bool maskChanged: 1;
-            bool flagsChanged: 1;
-            bool animationsChanged: 1;
-            bool filtersChanged: 1;
-            bool childrenChanged: 1;
-            bool repaintCountChanged : 1;
-            bool isScrollableChanged: 1;
-            bool contentsTilingChanged: 1;
-        };
-        unsigned changeMask;
-    };
-    union {
-        struct {
-            bool contentsOpaque : 1;
-            bool drawsContent : 1;
-            bool contentsVisible : 1;
-            bool backfaceVisible : 1;
-            bool masksToBounds : 1;
-            bool preserves3D : 1;
-            bool isScrollable: 1;
-        };
-        unsigned flags;
-    };
-
-    CoordinatedGraphicsLayerState()
-        : changeMask(0)
-        , contentsOpaque(false)
-        , drawsContent(false)
-        , contentsVisible(true)
-        , backfaceVisible(true)
-        , masksToBounds(false)
-        , preserves3D(false)
-        , isScrollable(false)
-        , opacity(0)
-        , replica(InvalidCoordinatedLayerID)
-        , mask(InvalidCoordinatedLayerID)
-    {
-    }
-
-    FloatPoint pos;
-    FloatPoint3D anchorPoint;
-    FloatSize size;
-    TransformationMatrix transform;
-    TransformationMatrix childrenTransform;
-    FloatRect contentsRect;
-    FloatSize contentsTilePhase;
-    FloatSize contentsTileSize;
-    float opacity;
-    Color solidColor;
-    FilterOperations filters;
-    TextureMapperAnimations animations;
-    Vector<uint32_t> children;
-    CoordinatedLayerID replica;
-    CoordinatedLayerID mask;
-    DebugVisuals debugVisuals;
-    RepaintCount repaintCount;
-
-    bool hasPendingChanges() const
-    {
-        return changeMask;
-    }
-};
-
 struct CoordinatedGraphicsState {
     struct NicosiaState {
         RefPtr<Nicosia::Scene> scene;
     } nicosia;
-
-    uint32_t rootCompositingLayer;
-
-    Vector<CoordinatedLayerID> layersToCreate;
-    Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState>> layersToUpdate;
-    Vector<CoordinatedLayerID> layersToRemove;
 };
 
 } // namespace WebCore
index b8e8649..7d82e6f 100644 (file)
@@ -1,3 +1,31 @@
+2018-08-23  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CoordGraphics] Remove the remaining CoordinatedGraphicsLayerState cruft
+        https://bugs.webkit.org/show_bug.cgi?id=188881
+
+        Reviewed by Carlos Garcia Campos.
+
+        Rid CompositingCoordinator class of code that manages now-deleted state
+        tracking of layer creation, update and removal on the
+        CoordinatedGraphicsState class. The syncLayerState() method is changed
+        accordingly, now only enforcing a frame synchronization when called.
+
+        Use of Nicosia::PlatformLayer::LayerID is adopted since the
+        CoordinatedLayerID type has been removed.
+
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
+        (WebKit::CoordinatedGraphicsScene::purgeGLResources):
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
+        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
+        (WebKit::CompositingCoordinator::flushPendingLayerChanges):
+        (WebKit::CompositingCoordinator::initializeRootCompositingLayerIfNeeded):
+        (WebKit::CompositingCoordinator::syncLayerState):
+        (WebKit::CompositingCoordinator::createGraphicsLayer):
+        (WebKit::CompositingCoordinator::detachLayer):
+        (WebKit::CompositingCoordinator::attachLayer):
+        (WebKit::CompositingCoordinator::clearPendingStateChanges): Deleted.
+        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
+
 2018-08-22  Antti Koivisto  <antti@apple.com>
 
         NetworkCache::Storage::lastStableVersion should be a developer-only feature
index 56926a2..2fe66ae 100644 (file)
@@ -449,7 +449,7 @@ void CoordinatedGraphicsScene::purgeGLResources()
     }
 
     m_rootLayer = nullptr;
-    m_rootLayerID = InvalidCoordinatedLayerID;
+    m_rootLayerID = 0;
     m_textureMapper = nullptr;
 }
 
index 40b8b63..d4bb582 100644 (file)
@@ -28,6 +28,7 @@
 #include <WebCore/GraphicsLayer.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/IntSize.h>
+#include <WebCore/NicosiaPlatformLayer.h>
 #include <WebCore/TextureMapper.h>
 #include <WebCore/TextureMapperBackingStore.h>
 #include <WebCore/TextureMapperFPSCounter.h>
@@ -111,7 +112,7 @@ private:
 
     std::unique_ptr<WebCore::TextureMapperLayer> m_rootLayer;
 
-    WebCore::CoordinatedLayerID m_rootLayerID { WebCore::InvalidCoordinatedLayerID };
+    Nicosia::PlatformLayer::LayerID m_rootLayerID { 0 };
     WebCore::Color m_viewBackgroundColor { WebCore::Color::white };
 
     WebCore::TextureMapperFPSCounter m_fpsCounter;
index eb0a0e1..36d52b6 100644 (file)
@@ -161,8 +161,6 @@ bool CompositingCoordinator::flushPendingLayerChanges()
             });
 
         m_client.commitSceneState(m_state);
-
-        clearPendingStateChanges();
         m_shouldSyncFrame = false;
     }
 
@@ -189,13 +187,6 @@ double CompositingCoordinator::nextAnimationServiceTime() const
     return std::max<double>(0., MinimalTimeoutForAnimations - timestamp() + m_lastAnimationServiceTime);
 }
 
-void CompositingCoordinator::clearPendingStateChanges()
-{
-    m_state.layersToCreate.clear();
-    m_state.layersToUpdate.clear();
-    m_state.layersToRemove.clear();
-}
-
 void CompositingCoordinator::initializeRootCompositingLayerIfNeeded()
 {
     if (m_didInitializeRootCompositingLayer)
@@ -203,7 +194,6 @@ void CompositingCoordinator::initializeRootCompositingLayerIfNeeded()
 
     auto& rootLayer = downcast<CoordinatedGraphicsLayer>(*m_rootLayer);
     m_nicosia.state.rootLayer = rootLayer.compositionLayer();
-    m_state.rootCompositingLayer = rootLayer.id();
     m_didInitializeRootCompositingLayer = true;
     m_shouldSyncFrame = true;
 }
@@ -220,10 +210,9 @@ void CompositingCoordinator::createRootLayer(const IntSize& size)
     m_rootLayer->setSize(size);
 }
 
-void CompositingCoordinator::syncLayerState(CoordinatedLayerID id, CoordinatedGraphicsLayerState& state)
+void CompositingCoordinator::syncLayerState()
 {
     m_shouldSyncFrame = true;
-    m_state.layersToUpdate.append(std::make_pair(id, state));
 }
 
 void CompositingCoordinator::notifyFlushRequired(const GraphicsLayer*)
@@ -248,7 +237,6 @@ std::unique_ptr<GraphicsLayer> CompositingCoordinator::createGraphicsLayer(Graph
     layer->setCoordinator(this);
     m_nicosia.state.layers.add(layer->compositionLayer());
     m_registeredLayers.add(layer->id(), layer);
-    m_state.layersToCreate.append(layer->id());
     layer->setNeedsVisibleRectAdjustment();
     notifyFlushRequired(layer);
     return std::unique_ptr<GraphicsLayer>(layer);
@@ -289,14 +277,6 @@ void CompositingCoordinator::detachLayer(CoordinatedGraphicsLayer* layer)
 
     m_nicosia.state.layers.remove(layer->compositionLayer());
     m_registeredLayers.remove(layer->id());
-
-    size_t index = m_state.layersToCreate.find(layer->id());
-    if (index != notFound) {
-        m_state.layersToCreate.remove(index);
-        return;
-    }
-
-    m_state.layersToRemove.append(layer->id());
     notifyFlushRequired(layer);
 }
 
@@ -305,7 +285,6 @@ void CompositingCoordinator::attachLayer(CoordinatedGraphicsLayer* layer)
     layer->setCoordinator(this);
     m_nicosia.state.layers.add(layer->compositionLayer());
     m_registeredLayers.add(layer->id(), layer);
-    m_state.layersToCreate.append(layer->id());
     layer->setNeedsVisibleRectAdjustment();
     notifyFlushRequired(layer);
 }
index 987a912..6ba85f1 100644 (file)
@@ -36,6 +36,7 @@
 #include <WebCore/GraphicsLayerFactory.h>
 #include <WebCore/IntRect.h>
 #include <WebCore/NicosiaBuffer.h>
+#include <WebCore/NicosiaPlatformLayer.h>
 
 namespace Nicosia {
 class PaintingEngine;
@@ -99,13 +100,12 @@ private:
     void detachLayer(WebCore::CoordinatedGraphicsLayer*) override;
     void attachLayer(WebCore::CoordinatedGraphicsLayer*) override;
     Nicosia::PaintingEngine& paintingEngine() override;
-    void syncLayerState(WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayerState&) override;
+    void syncLayerState() override;
 
     // GraphicsLayerFactory
     std::unique_ptr<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override;
 
     void initializeRootCompositingLayerIfNeeded();
-    void clearPendingStateChanges();
 
     void purgeBackingStores();
 
@@ -124,7 +124,7 @@ private:
     } m_nicosia;
     WebCore::CoordinatedGraphicsState m_state;
 
-    HashMap<WebCore::CoordinatedLayerID, WebCore::CoordinatedGraphicsLayer*> m_registeredLayers;
+    HashMap<Nicosia::PlatformLayer::LayerID, WebCore::CoordinatedGraphicsLayer*> m_registeredLayers;
 
     std::unique_ptr<Nicosia::PaintingEngine> m_paintingEngine;