Title: [258311] trunk/Source/WebKit
Revision
258311
Author
commit-qu...@webkit.org
Date
2020-03-11 21:19:58 -0700 (Wed, 11 Mar 2020)

Log Message

RemoteImageBuffer::getImageData() has to clear its DisplayList after calling flushDrawingContext()
https://bugs.webkit.org/show_bug.cgi?id=208931

Patch by Said Abou-Hallawa <sabouhall...@apple.com> on 2020-03-11
Reviewed by Myles C. Maxfield.

Instead of letting every caller to flushDrawingContextAndWaitCommit() or
flushDrawingContext() be responsible of clearing the DisplayList, we can
make these functions take this responsibility.

* WebProcess/GPU/graphics/RemoteImageBuffer.h:
* WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
(WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
(WebKit::RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit):
* WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (258310 => 258311)


--- trunk/Source/WebKit/ChangeLog	2020-03-12 03:19:09 UTC (rev 258310)
+++ trunk/Source/WebKit/ChangeLog	2020-03-12 04:19:58 UTC (rev 258311)
@@ -1,3 +1,20 @@
+2020-03-11  Said Abou-Hallawa  <sabouhall...@apple.com>
+
+        RemoteImageBuffer::getImageData() has to clear its DisplayList after calling flushDrawingContext()
+        https://bugs.webkit.org/show_bug.cgi?id=208931
+
+        Reviewed by Myles C. Maxfield.
+
+        Instead of letting every caller to flushDrawingContextAndWaitCommit() or
+        flushDrawingContext() be responsible of clearing the DisplayList, we can
+        make these functions take this responsibility.
+
+        * WebProcess/GPU/graphics/RemoteImageBuffer.h:
+        * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp:
+        (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
+        (WebKit::RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit):
+        * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h:
+
 2020-03-11  Don Olmstead  <don.olmst...@sony.com>
 
         Non-unified build fixes early March 2020 edition Take 2

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h (258310 => 258311)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h	2020-03-12 03:19:09 UTC (rev 258310)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h	2020-03-12 04:19:58 UTC (rev 258311)
@@ -75,7 +75,7 @@
 
     RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const override
     {
-        auto& displayList = m_drawingContext.displayList();
+        auto& displayList = const_cast<RemoteImageBuffer*>(this)->m_drawingContext.displayList();
         const_cast<RemoteImageBuffer*>(this)->RemoteImageBufferMessageHandler::flushDrawingContext(displayList);
         auto result = const_cast<RemoteImageBuffer*>(this)->RemoteImageBufferMessageHandler::getImageData(outputFormat, srcRect);
         // getImageData is synchronous, which means we've already received the CommitImageBufferFlushContext message.
@@ -99,10 +99,8 @@
     void flushDrawingContext() override
     {
         auto& displayList = m_drawingContext.displayList();
-        if (displayList.itemCount()) {
+        if (displayList.itemCount())
             RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit(displayList);
-            displayList.clear();
-        }
     }
     
     void willAppendItem(const WebCore::DisplayList::Item&) override
@@ -109,10 +107,8 @@
     {
         constexpr size_t DisplayListBatchSize = 512;
         auto& displayList = m_drawingContext.displayList();
-        if (displayList.itemCount() >= DisplayListBatchSize) {
+        if (displayList.itemCount() >= DisplayListBatchSize)
             RemoteImageBufferMessageHandler::flushDrawingContext(displayList);
-            displayList.clear();
-        }
     }
 };
 

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp (258310 => 258311)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp	2020-03-12 03:19:09 UTC (rev 258310)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp	2020-03-12 04:19:58 UTC (rev 258311)
@@ -70,20 +70,22 @@
         m_remoteRenderingBackend->waitForCommitImageBufferFlushContext();
 }
 
-void RemoteImageBufferMessageHandler::flushDrawingContext(const WebCore::DisplayList::DisplayList& displayList)
+void RemoteImageBufferMessageHandler::flushDrawingContext(WebCore::DisplayList::DisplayList& displayList)
 {
     if (!m_remoteRenderingBackend)
         return;
     
     m_remoteRenderingBackend->send(Messages::RemoteRenderingBackendProxy::FlushImageBufferDrawingContext(displayList, m_imageBufferIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier());
+    displayList.clear();
 }
 
-void RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit(const WebCore::DisplayList::DisplayList& displayList)
+void RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit(WebCore::DisplayList::DisplayList& displayList)
 {
     if (!m_remoteRenderingBackend)
         return;
     m_sentFlushIdentifier = ImageBufferFlushIdentifier::generate();
     m_remoteRenderingBackend->send(Messages::RemoteRenderingBackendProxy::FlushImageBufferDrawingContextAndCommit(displayList, m_sentFlushIdentifier, m_imageBufferIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier());
+    displayList.clear();
     waitForCommitImageBufferFlushContext();
 }
 

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h (258310 => 258311)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h	2020-03-12 03:19:09 UTC (rev 258310)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h	2020-03-12 04:19:58 UTC (rev 258311)
@@ -67,8 +67,8 @@
     void waitForCommitImageBufferFlushContext();
 
     // Messages to be sent. See RemoteRenderingBackendProxy.messages.in.
-    void flushDrawingContext(const WebCore::DisplayList::DisplayList&);
-    void flushDrawingContextAndWaitCommit(const WebCore::DisplayList::DisplayList&);
+    void flushDrawingContext(WebCore::DisplayList::DisplayList&);
+    void flushDrawingContextAndWaitCommit(WebCore::DisplayList::DisplayList&);
 
 private:
     WeakPtr<RemoteRenderingBackend> m_remoteRenderingBackend;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to