Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bb95a2f78031283cada762bcad6e521b98536380
      
https://github.com/WebKit/WebKit/commit/bb95a2f78031283cada762bcad6e521b98536380
  Author: Said Abou-Hallawa <[email protected]>
  Date:   2026-08-03 (Mon, 03 Aug 2026)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/loader/cache/CachedImage.cpp
    A Source/WebCore/platform/graphics/AsyncImageDecoder.cpp
    A Source/WebCore/platform/graphics/AsyncImageDecoder.h
    M Source/WebCore/platform/graphics/BitmapImage.h
    M Source/WebCore/platform/graphics/BitmapImageDescriptor.cpp
    M Source/WebCore/platform/graphics/BitmapImageDescriptor.h
    M Source/WebCore/platform/graphics/BitmapImageSource.cpp
    M Source/WebCore/platform/graphics/BitmapImageSource.h
    M Source/WebCore/platform/graphics/ImageDecoder.cpp
    M Source/WebCore/platform/graphics/ImageDecoder.h
    A Source/WebCore/platform/graphics/ImageDecoderClient.h
    R Source/WebCore/platform/graphics/ImageFrameWorkQueue.cpp
    R Source/WebCore/platform/graphics/ImageFrameWorkQueue.h
    M Source/WebCore/platform/graphics/ImageSource.h
    M Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVFManager.cpp
    M Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVFManager.h

  Log Message:
  -----------
  Introduce `AsyncImageDecoder`
https://bugs.webkit.org/show_bug.cgi?id=315970
rdar://178390303

Reviewed by Simon Fraser.

BitmapImage manages the async image decoding separate from the ImageDecoder in
a class named `ImageFrameWorkQueue`. The `WebCodecsImageDecoder` needs to have
the async image decoding as well. So if the async image decoding is implemented
in a new ImageDeocder sub-class named `AsyncImageDecoder`, then we can remove
`ImageFrameWorkQueue` and have `BitmapImage` and `WebCodecsImageDecoder` just
hold an instance of `AsyncImageDecoder`. The other places which uses synchronous
image decoding can still use the existing ImageDecoders.

The platform `ImageDecoder` is still responsible of decoding image frames and
retrieving image metadata. The `AsyncImageDecoder` is responsible of decoding 
the
image frames on a separate `WorkQueue`. The PlatformAsyncImageDecoder will 
combine
both classes in one class.

To communicate back async decoded image frames, a new class named 
`ImageDecoderClient`
will be introduced. This class will be notified when an image frame has finished
decoding. It is now sub-classed by `BitmapImageSource`. `WebCodecsImageDecoder`
will also sub-class it.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/loader/cache/CachedImage.cpp:
(WebCore::CachedImage::removeAllClientsWaitingForAsyncDecoding):
* Source/WebCore/platform/graphics/AsyncImageDecoder.cpp: Added.
(WebCore::AsyncImageDecoder::create):
(WebCore::AsyncImageDecoder::AsyncImageDecoder):
(WebCore::AsyncImageDecoder::requestQueue):
(WebCore::AsyncImageDecoder::startWorkQueue):
(WebCore::AsyncImageDecoder::dispatchRequest):
(WebCore::AsyncImageDecoder::stopWorkQueue):
(WebCore::AsyncImageDecoder::requestNativeImageAtIndex):
(WebCore::AsyncImageDecoder::isPendingDecodingAtIndex const):
(WebCore::AsyncImageDecoder::dump const):
(WebCore::AsyncImageDecoder::bytesDecodedToDetermineProperties const):
(WebCore::AsyncImageDecoder::encodedDataStatus const):
(WebCore::AsyncImageDecoder::setEncodedDataStatusChangeCallback):
(WebCore::AsyncImageDecoder::frameCount const):
(WebCore::AsyncImageDecoder::hasHDRGainMap const):
(WebCore::AsyncImageDecoder::primaryFrameIndex const):
(WebCore::AsyncImageDecoder::repetitionCount const):
(WebCore::AsyncImageDecoder::uti const):
(WebCore::AsyncImageDecoder::filenameExtension const):
(WebCore::AsyncImageDecoder::accessibilityDescription const):
(WebCore::AsyncImageDecoder::hotSpot const):
(WebCore::AsyncImageDecoder::frameDurationAtIndex const):
(WebCore::AsyncImageDecoder::frameHasAlphaAtIndex const):
(WebCore::AsyncImageDecoder::fetchFrameMetaDataAtIndex const):
(WebCore::AsyncImageDecoder::createNativeImageAtIndex):
(WebCore::AsyncImageDecoder::setExpectedContentSize):
(WebCore::AsyncImageDecoder::setData):
(WebCore::AsyncImageDecoder::isAllDataReceived const):
(WebCore::AsyncImageDecoder::clearFrameBufferCache):
(WebCore::AsyncImageDecoder::size const):
(WebCore::AsyncImageDecoder::isPanorama const):
(WebCore::AsyncImageDecoder::isSpatial const):
(WebCore::AsyncImageDecoder::spatialLeftEyeFrameIndex const):
(WebCore::AsyncImageDecoder::spatialRightEyeFrameIndex const):
(WebCore::AsyncImageDecoder::spatialEyePropertiesAtIndex const):
(WebCore::AsyncImageDecoder::isMaybePanoramic const):
* Source/WebCore/platform/graphics/AsyncImageDecoder.h: Added.
(WebCore::AsyncImageDecoder::requestNativeImageAtIndex):
(WebCore::AsyncImageDecoder::isWorkQueueIdle const):
(WebCore::AsyncImageDecoder::setMinimumDecodingDurationForTesting):
(WebCore::AsyncImageDecoder::minimumDecodingDurationForTesting const):
* Source/WebCore/platform/graphics/BitmapImage.h:
* Source/WebCore/platform/graphics/BitmapImageDescriptor.cpp:
(WebCore::BitmapImageDescriptor::isPanorama const):
(WebCore::BitmapImageDescriptor::imageMetadata const):
(WebCore::BitmapImageDescriptor::primaryFrameIndex const):
(WebCore::BitmapImageDescriptor::frameCount const):
(WebCore::BitmapImageDescriptor::repetitionCount const):
(WebCore::BitmapImageDescriptor::hasHDRGainMap const):
(WebCore::BitmapImageDescriptor::uti const):
(WebCore::BitmapImageDescriptor::filenameExtension const):
(WebCore::BitmapImageDescriptor::accessibilityDescription const):
(WebCore::BitmapImageDescriptor::hotSpot const):
* Source/WebCore/platform/graphics/BitmapImageSource.cpp:
(WebCore::BitmapImageSource::decoder const):
(WebCore::BitmapImageSource::destroyDecodedData):
(WebCore::BitmapImageSource::canDestroyDecodedData const):
(WebCore::BitmapImageSource::stopAnimation):
(WebCore::BitmapImageSource::isDecoderWorkQueueIdle const):
(WebCore::BitmapImageSource::stopDecoderWorkQueue):
(WebCore::BitmapImageSource::isPendingDecodingAtIndex const):
(WebCore::BitmapImageSource::imageFrameDecodeAtIndexHasFinished):
(WebCore::BitmapImageSource::frameAtIndexCacheIfNeeded):
(WebCore::BitmapImageSource::requestNativeImageAtIndex):
(WebCore::BitmapImageSource::setMinimumDecodingDurationForTesting):
(WebCore::BitmapImageSource::dump const):
(WebCore::BitmapImageSource::workQueue const): Deleted.
(WebCore::BitmapImageSource::isDecodingWorkQueueIdle const): Deleted.
(WebCore::BitmapImageSource::stopDecodingWorkQueue): Deleted.
* Source/WebCore/platform/graphics/BitmapImageSource.h:
* Source/WebCore/platform/graphics/ImageDecoder.h:
* Source/WebCore/platform/graphics/ImageDecoderClient.h: Added.
* Source/WebCore/platform/graphics/ImageSource.h:
(WebCore::ImageSource::stopDecoderWorkQueue):
(WebCore::ImageSource::stopDecodingWorkQueue): Deleted.
* Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVFManager.cpp:
(WebKit::RemoteImageDecoderAVFManager::createRemoteImageDecoder):
(WebKit::RemoteImageDecoderAVFManager::createImageDecoder):
(WebKit::RemoteImageDecoderAVFManager::createAsyncImageDecoder):
(WebKit::RemoteImageDecoderAVFManager::setUseGPUProcess):
* Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVFManager.h:
* Source/WebCore/platform/graphics/BitmapImageDescriptor.h:
* Source/WebCore/platform/graphics/ImageFrameWorkQueue.cpp: Removed.
* Source/WebCore/platform/graphics/ImageDecoder.cpp:
(WebCore::createInProcessAsyncImageDecoderAVFObjC):
(WebCore::platformRegisterFactories):

Canonical link: https://commits.webkit.org/318501@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to