Title: [291202] trunk/Source/WebKit
Revision
291202
Author
simon.fra...@apple.com
Date
2022-03-11 18:23:42 -0800 (Fri, 11 Mar 2022)

Log Message

Move RemoteLayerBackingStore flusher creation into RemoteLayerBackingStoreCollection
https://bugs.webkit.org/show_bug.cgi?id=237798

Reviewed by Tim Horton.

Move the code that creates layer flushers from RemoteLayerTreeDrawingArea into
RemoteLayerBackingStoreCollection, per the FIXME.

RemoteLayerBackingStoreCollection::didFlushLayers() then becomes internal, and gets renamed
to updateUnreachableBackingStores(). Now we only need to schedule the volatility timer from
one place.

* Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h:
* Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm:
(WebKit::RemoteLayerBackingStoreCollection::didFlushLayers):
(WebKit::RemoteLayerBackingStoreCollection::updateUnreachableBackingStores):
* WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::updateRendering):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (291201 => 291202)


--- trunk/Source/WebKit/ChangeLog	2022-03-12 00:56:15 UTC (rev 291201)
+++ trunk/Source/WebKit/ChangeLog	2022-03-12 02:23:42 UTC (rev 291202)
@@ -1,3 +1,24 @@
+2022-03-11  Simon Fraser  <simon.fra...@apple.com>
+
+        Move RemoteLayerBackingStore flusher creation into RemoteLayerBackingStoreCollection
+        https://bugs.webkit.org/show_bug.cgi?id=237798
+
+        Reviewed by Tim Horton.
+
+        Move the code that creates layer flushers from RemoteLayerTreeDrawingArea into
+        RemoteLayerBackingStoreCollection, per the FIXME.
+
+        RemoteLayerBackingStoreCollection::didFlushLayers() then becomes internal, and gets renamed
+        to updateUnreachableBackingStores(). Now we only need to schedule the volatility timer from
+        one place.
+
+        * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h:
+        * Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm:
+        (WebKit::RemoteLayerBackingStoreCollection::didFlushLayers):
+        (WebKit::RemoteLayerBackingStoreCollection::updateUnreachableBackingStores):
+        * WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::updateRendering):
+
 2022-03-11  Wenson Hsieh  <wenson_hs...@apple.com>
 
         Refactor the filter block in DocumentMarkerController::filterMarkers() to return an enum type

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h (291201 => 291202)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h	2022-03-12 00:56:15 UTC (rev 291201)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.h	2022-03-12 02:23:42 UTC (rev 291202)
@@ -33,6 +33,7 @@
 
 namespace WebCore {
 class ImageBuffer;
+class ThreadSafeImageBufferFlusher;
 enum class SetNonVolatileResult : uint8_t;
 }
 
@@ -63,7 +64,7 @@
 
     void willFlushLayers();
     void willCommitLayerTree(RemoteLayerTreeTransaction&);
-    void didFlushLayers();
+    Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> didFlushLayers(RemoteLayerTreeTransaction&);
 
     virtual void tryMarkAllBackingStoreVolatile(CompletionHandler<void(bool)>&&);
 
@@ -86,6 +87,7 @@
     bool markBackingStoreVolatile(RemoteLayerBackingStore&, OptionSet<VolatilityMarkingBehavior> = { }, MonotonicTime = { });
     bool markAllBackingStoreVolatile(OptionSet<VolatilityMarkingBehavior> liveBackingStoreMarkingBehavior, OptionSet<VolatilityMarkingBehavior> unparentedBackingStoreMarkingBehavior);
 
+    bool updateUnreachableBackingStores();
     void volatilityTimerFired();
 
 protected:

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm (291201 => 291202)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm	2022-03-12 00:56:15 UTC (rev 291201)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStoreCollection.mm	2022-03-12 02:23:42 UTC (rev 291202)
@@ -70,10 +70,34 @@
     transaction.setLayerIDsWithNewlyUnreachableBackingStore(newlyUnreachableLayerIDs);
 }
 
-void RemoteLayerBackingStoreCollection::didFlushLayers()
+Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> RemoteLayerBackingStoreCollection::didFlushLayers(RemoteLayerTreeTransaction& transaction)
 {
+    bool needToScheduleVolatilityTimer = false;
+
+    Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> flushers;
+    for (auto& layer : transaction.changedLayers()) {
+        if (layer->properties().changedProperties & RemoteLayerTreeTransaction::BackingStoreChanged) {
+            needToScheduleVolatilityTimer = true;
+            if (layer->properties().backingStore)
+                flushers.appendVector(layer->properties().backingStore->takePendingFlushers());
+        }
+
+        layer->didCommit();
+    }
+
     m_inLayerFlush = false;
 
+    if (updateUnreachableBackingStores())
+        needToScheduleVolatilityTimer = true;
+
+    if (needToScheduleVolatilityTimer)
+        scheduleVolatilityTimer();
+
+    return flushers;
+}
+
+bool RemoteLayerBackingStoreCollection::updateUnreachableBackingStores()
+{
     Vector<RemoteLayerBackingStore*> newlyUnreachableBackingStore;
     for (auto* backingStore : m_liveBackingStore) {
         if (!m_reachableBackingStoreInLatestFlush.contains(backingStore))
@@ -83,8 +107,7 @@
     for (auto* backingStore : newlyUnreachableBackingStore)
         backingStoreBecameUnreachable(*backingStore);
 
-    if (!newlyUnreachableBackingStore.isEmpty())
-        scheduleVolatilityTimer();
+    return !newlyUnreachableBackingStore.isEmpty();
 }
 
 void RemoteLayerBackingStoreCollection::backingStoreWasCreated(RemoteLayerBackingStore& backingStore)

Modified: trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm (291201 => 291202)


--- trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm	2022-03-12 00:56:15 UTC (rev 291201)
+++ trunk/Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm	2022-03-12 02:23:42 UTC (rev 291202)
@@ -381,24 +381,7 @@
     auto commitEncoder = makeUniqueRef<IPC::Encoder>(Messages::RemoteLayerTreeDrawingAreaProxy::CommitLayerTree::name(), m_identifier.toUInt64());
     commitEncoder.get() << message.arguments();
 
-    // FIXME: Move all backing store flushing management to RemoteLayerBackingStoreCollection.
-    bool hadAnyChangedBackingStore = false;
-    Vector<std::unique_ptr<WebCore::ThreadSafeImageBufferFlusher>> flushers;
-    for (auto& layer : layerTransaction.changedLayers()) {
-        if (layer->properties().changedProperties & RemoteLayerTreeTransaction::BackingStoreChanged) {
-            hadAnyChangedBackingStore = true;
-            if (layer->properties().backingStore)
-                flushers.appendVector(layer->properties().backingStore->takePendingFlushers());
-        }
-
-        layer->didCommit();
-    }
-
-    backingStoreCollection.didFlushLayers();
-
-    if (hadAnyChangedBackingStore)
-        backingStoreCollection.scheduleVolatilityTimer();
-
+    auto flushers = backingStoreCollection.didFlushLayers(layerTransaction);
     RefPtr<BackingStoreFlusher> backingStoreFlusher = BackingStoreFlusher::create(WebProcess::singleton().parentProcessConnection(), WTFMove(commitEncoder), WTFMove(flushers));
     m_pendingBackingStoreFlusher = backingStoreFlusher;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to