Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 284cb84712010a40007790ae4db69cc0076eda9e
https://github.com/WebKit/WebKit/commit/284cb84712010a40007790ae4db69cc0076eda9e
Author: Carlos Garcia Campos <[email protected]>
Date: 2026-05-25 (Mon, 25 May 2026)
Changed paths:
M Source/WebCore/platform/SourcesSkia.txt
M Source/WebCore/platform/graphics/ImageBuffer.cpp
A Source/WebCore/platform/graphics/skia/SkiaSerializedImageBuffer.cpp
A Source/WebCore/platform/graphics/skia/SkiaSerializedImageBuffer.h
Log Message:
-----------
[Skia] Add SkiaSerializedImageBuffer to properly transfer ImageBuffer to
other threads
https://bugs.webkit.org/show_bug.cgi?id=315499
Reviewed by Nikolas Zimmermann.
In DefaultSerializedImageBuffer we flush the drawing context to make
sure all pending operations are done, but the ImageBuffer is
transferred to another thread as is. If the worker thread wants to
transfer the
ImageBuffer back to the main thread (which is what test
imported/w3c/web-platform-tests/html/canvas/element/manual/imagebitmap/createImageBitmap-transfer.html
does) a new DefaultSerializedImageBuffer is created trying to flush a
skia gr context from a different thread. This patch adds
SkiaSerializedImageBuffer that also implements sinkIntoImageBuffer()
that is called when the buffer is deserialized in the destination thead.
If the destination thread is different than the original one, the
ImageBuffer is copied by rewrapping the SkImage that is painted into the
copy. This ensures that when transferring an imageBitmap, the skia gr
context used is always the one from the current thread.
* Source/WebCore/platform/SourcesSkia.txt:
* Source/WebCore/platform/graphics/ImageBuffer.cpp:
(WebCore::DefaultSerializedImageBuffer::DefaultSerializedImageBuffer):
(WebCore::ImageBuffer::sinkIntoSerializedImageBuffer):
*
Source/WebCore/platform/graphics/skia/SkiaSerializedImageBuffer.cpp: Added.
(WebCore::SkiaSerializedImageBuffer::SkiaSerializedImageBuffer):
(WebCore::SkiaSerializedImageBuffer::sinkIntoImageBuffer):
(WebCore::SkiaSerializedImageBuffer::memoryCost const):
* Source/WebCore/platform/graphics/skia/SkiaSerializedImageBuffer.h: Added.
Canonical link:
https://flagged.apple.com:443/proxy?t2=Dt8k5W8eI1&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzEzODY4QG1haW4=&emid=a626abda-844a-44da-bb8d-aae0a72c94ac&c=11
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications