Title: [235221] trunk/Source
Revision
235221
Author
[email protected]
Date
2018-08-23 05:34:36 -0700 (Thu, 23 Aug 2018)

Log Message

[CoordGraphics] Remove the remaining CoordinatedGraphicsLayerState cruft
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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (235220 => 235221)


--- trunk/Source/WebCore/ChangeLog	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebCore/ChangeLog	2018-08-23 12:34:36 UTC (rev 235221)
@@ -1,3 +1,79 @@
+2018-08-23  Zan Dobersek  <[email protected]>
+
+        [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  <[email protected]>
 
         [CoordGraphics] Drop old-school PlatformLayer management in CoordinatedGraphicsLayer

Modified: trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h (235220 => 235221)


--- trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebCore/platform/graphics/nicosia/NicosiaPlatformLayer.h	2018-08-23 12:34:36 UTC (rev 235221)
@@ -50,7 +50,8 @@
     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);

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp (235220 => 235221)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.cpp	2018-08-23 12:34:36 UTC (rev 235221)
@@ -54,11 +54,6 @@
     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 @@
     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 @@
         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::didChangeGeometry()
 {
-    didChangeLayerState();
+    notifyFlushRequired();
     setShouldUpdateVisibleRect();
 }
 
@@ -127,25 +114,22 @@
     , 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 @@
         return;
 
     GraphicsLayer::setPosition(p);
-    m_layerState.positionChanged = true;
     m_nicosia.delta.positionChanged = true;
     didChangeGeometry();
 }
@@ -230,7 +213,6 @@
         return;
 
     GraphicsLayer::setAnchorPoint(p);
-    m_layerState.anchorPointChanged = true;
     m_nicosia.delta.anchorPointChanged = true;
     didChangeGeometry();
 }
@@ -241,7 +223,6 @@
         return;
 
     GraphicsLayer::setSize(size);
-    m_layerState.sizeChanged = true;
     m_nicosia.delta.sizeChanged = true;
 
     if (maskLayer())
@@ -255,7 +236,6 @@
         return;
 
     GraphicsLayer::setTransform(t);
-    m_layerState.transformChanged = true;
     m_nicosia.delta.transformChanged = true;
 
     didChangeGeometry();
@@ -267,7 +247,6 @@
         return;
 
     GraphicsLayer::setChildrenTransform(t);
-    m_layerState.childrenTransformChanged = true;
     m_nicosia.delta.childrenTransformChanged = true;
 
     didChangeGeometry();
@@ -279,8 +258,6 @@
         return;
 
     GraphicsLayer::setPreserves3D(b);
-    m_layerState.preserves3D = b;
-    m_layerState.flagsChanged = true;
     m_nicosia.delta.flagsChanged = true;
 
     didChangeGeometry();
@@ -291,8 +268,6 @@
     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 @@
     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 @@
     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 @@
         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 @@
         addRepaintRect({ { }, m_size });
     }
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setBackfaceVisibility(bool b)
@@ -352,11 +321,9 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
         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 @@
 
     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 @@
         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 @@
     m_needsDisplay.completeLayer = true;
     m_needsDisplay.rects.clear();
 
-    didChangeLayerState();
+    notifyFlushRequired();
     addRepaintRect({ { }, m_size });
 }
 
@@ -605,7 +555,7 @@
     else
         rects[0].unite(rect);
 
-    didChangeLayerState();
+    notifyFlushRequired();
     addRepaintRect(rect);
 }
 
@@ -623,94 +573,20 @@
         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 @@
     // 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::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 @@
         downcast<CoordinatedGraphicsLayer>(*child).syncPendingStateChangesIncludingSubLayers();
 }
 
-void CoordinatedGraphicsLayer::resetLayerState()
-{
-    m_layerState.changeMask = 0;
-}
-
 void CoordinatedGraphicsLayer::deviceOrPageScaleFactorChanged()
 {
     if (shouldHaveBackingStore())
@@ -1093,7 +951,7 @@
         m_nicosia.backingStore = nullptr;
     }
 
-    didChangeLayerState();
+    notifyFlushRequired();
 }
 
 void CoordinatedGraphicsLayer::setCoordinator(CoordinatedGraphicsLayerClient* coordinator)
@@ -1121,7 +979,7 @@
     // 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())

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h (235220 => 235221)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsLayer.h	2018-08-23 12:34:36 UTC (rev 235221)
@@ -50,8 +50,7 @@
     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 @@
     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,7 +130,6 @@
 
     void setDebugBorder(const Color&, float width) override;
 
-    void didChangeLayerState();
     void didChangeAnimations();
     void didChangeGeometry();
     void didChangeChildren();
@@ -138,16 +136,9 @@
     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 @@
 
     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 @@
 #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;
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h (235220 => 235221)


--- trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedGraphicsState.h	2018-08-23 12:34:36 UTC (rev 235221)
@@ -30,121 +30,14 @@
 
 #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

Modified: trunk/Source/WebKit/ChangeLog (235220 => 235221)


--- trunk/Source/WebKit/ChangeLog	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebKit/ChangeLog	2018-08-23 12:34:36 UTC (rev 235221)
@@ -1,3 +1,31 @@
+2018-08-23  Zan Dobersek  <[email protected]>
+
+        [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  <[email protected]>
 
         NetworkCache::Storage::lastStableVersion should be a developer-only feature

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (235220 => 235221)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp	2018-08-23 12:34:36 UTC (rev 235221)
@@ -449,7 +449,7 @@
     }
 
     m_rootLayer = nullptr;
-    m_rootLayerID = InvalidCoordinatedLayerID;
+    m_rootLayerID = 0;
     m_textureMapper = nullptr;
 }
 

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h (235220 => 235221)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h	2018-08-23 12:34:36 UTC (rev 235221)
@@ -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 @@
 
     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;

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp (235220 => 235221)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp	2018-08-23 12:34:36 UTC (rev 235221)
@@ -161,8 +161,6 @@
             });
 
         m_client.commitSceneState(m_state);
-
-        clearPendingStateChanges();
         m_shouldSyncFrame = false;
     }
 
@@ -189,13 +187,6 @@
     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 @@
 
     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 @@
     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 @@
     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 @@
 
     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 @@
     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);
 }

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h (235220 => 235221)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h	2018-08-23 07:00:08 UTC (rev 235220)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h	2018-08-23 12:34:36 UTC (rev 235221)
@@ -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 @@
     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 @@
     } 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;
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to