Title: [274164] trunk/Source/WebCore
Revision
274164
Author
[email protected]
Date
2021-03-09 12:03:27 -0800 (Tue, 09 Mar 2021)

Log Message

[GPU Process] ImageBitmap should release its ImageBuffer in the main thread
https://bugs.webkit.org/show_bug.cgi?id=222960

Reviewed by Simon Fraser.

The ImageBuffer of the ImageBitmap should be deleted on the main thread
only since its deletion may require sending messages to the GPUP.

Covered by existing test:
    imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-in-worker-transfer.html

* html/ImageBitmap.cpp:
(WebCore::ImageBitmap::~ImageBitmap):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (274163 => 274164)


--- trunk/Source/WebCore/ChangeLog	2021-03-09 19:57:50 UTC (rev 274163)
+++ trunk/Source/WebCore/ChangeLog	2021-03-09 20:03:27 UTC (rev 274164)
@@ -1,3 +1,19 @@
+2021-03-09  Said Abou-Hallawa  <[email protected]>
+
+        [GPU Process] ImageBitmap should release its ImageBuffer in the main thread
+        https://bugs.webkit.org/show_bug.cgi?id=222960
+
+        Reviewed by Simon Fraser.
+
+        The ImageBuffer of the ImageBitmap should be deleted on the main thread
+        only since its deletion may require sending messages to the GPUP.
+
+        Covered by existing test: 
+            imported/w3c/web-platform-tests/html/canvas/element/imagebitmap/createImageBitmap-in-worker-transfer.html
+
+        * html/ImageBitmap.cpp:
+        (WebCore::ImageBitmap::~ImageBitmap):
+
 2021-03-09  Wenson Hsieh  <[email protected]>
 
         Unreviewed, fix the ENABLE(APP_HIGHLIGHTS) build after r274155

Modified: trunk/Source/WebCore/html/ImageBitmap.cpp (274163 => 274164)


--- trunk/Source/WebCore/html/ImageBitmap.cpp	2021-03-09 19:57:50 UTC (rev 274163)
+++ trunk/Source/WebCore/html/ImageBitmap.cpp	2021-03-09 20:03:27 UTC (rev 274164)
@@ -840,7 +840,13 @@
     ASSERT_IMPLIES(m_backingStore, m_backingStore->buffer());
 }
 
-ImageBitmap::~ImageBitmap() = default;
+ImageBitmap::~ImageBitmap()
+{
+    if (isMainThread())
+        return;
+    if (auto imageBuffer = takeImageBuffer())
+        callOnMainThread([imageBuffer = WTFMove(imageBuffer)] { });
+}
 
 Optional<ImageBitmapBacking> ImageBitmap::takeImageBitmapBacking()
 {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to