Diff
Modified: trunk/Source/WebCore/ChangeLog (275234 => 275235)
--- trunk/Source/WebCore/ChangeLog 2021-03-30 21:14:52 UTC (rev 275234)
+++ trunk/Source/WebCore/ChangeLog 2021-03-30 21:23:22 UTC (rev 275235)
@@ -1,3 +1,15 @@
+2021-03-30 Peng Liu <[email protected]>
+
+ [GPUP] Add an IPC message to implement RemoteImageDecoderAVF::clearFrameBufferCache()
+ https://bugs.webkit.org/show_bug.cgi?id=223707
+
+ Reviewed by Youenn Fablet.
+
+ No change in observable functionality.
+
+ * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h:
+ Export method `clearFrameBufferCache()` so that we can call it from WebKit.
+
2021-03-30 Antti Koivisto <[email protected]>
Nullptr crash in applyCommonButtonPaddingToStyle
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h (275234 => 275235)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h 2021-03-30 21:14:52 UTC (rev 275234)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.h 2021-03-30 21:23:22 UTC (rev 275235)
@@ -88,7 +88,7 @@
WEBCORE_EXPORT void setExpectedContentSize(long long) final;
WEBCORE_EXPORT void setData(SharedBuffer&, bool allDataReceived) final;
bool isAllDataReceived() const final { return m_isAllDataReceived; }
- void clearFrameBufferCache(size_t) final;
+ WEBCORE_EXPORT void clearFrameBufferCache(size_t) final;
bool hasTrack() const { return !!m_track; }
WEBCORE_EXPORT Vector<ImageDecoder::FrameInfo> frameInfos() const;
Modified: trunk/Source/WebKit/ChangeLog (275234 => 275235)
--- trunk/Source/WebKit/ChangeLog 2021-03-30 21:14:52 UTC (rev 275234)
+++ trunk/Source/WebKit/ChangeLog 2021-03-30 21:23:22 UTC (rev 275235)
@@ -1,3 +1,29 @@
+2021-03-30 Peng Liu <[email protected]>
+
+ [GPUP] Add an IPC message to implement RemoteImageDecoderAVF::clearFrameBufferCache()
+ https://bugs.webkit.org/show_bug.cgi?id=223707
+
+ Reviewed by Youenn Fablet.
+
+ * GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
+ (WebKit::RemoteImageDecoderAVFProxy::deleteDecoder):
+ Replace `const ImageDecoderIdentifier&` with `ImageDecoderIdentifier`.
+ (WebKit::RemoteImageDecoderAVFProxy::encodedDataStatusChanged): Ditto.
+ (WebKit::RemoteImageDecoderAVFProxy::setExpectedContentSize): Ditto.
+ (WebKit::RemoteImageDecoderAVFProxy::setData): Ditto.
+ (WebKit::RemoteImageDecoderAVFProxy::createFrameImageAtIndex): Ditto.
+ (WebKit::RemoteImageDecoderAVFProxy::clearFrameBufferCache):
+ * GPUProcess/media/RemoteImageDecoderAVFProxy.h:
+ * GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in:
+ Add IPC message `clearFrameBufferCache()`, and replace `uint32_t` with `size_t`
+ because IPC messages support it now.
+
+ * WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
+ (WebKit::RemoteImageDecoderAVF::setData):
+ (WebKit::RemoteImageDecoderAVF::clearFrameBufferCache):
+ Implement the same behavior as `ImageDecoderAVFObjC::clearFrameBufferCache()`.
+ This change will reduce the peak memory usage.
+
2021-03-30 Jer Noble <[email protected]>
Unreviewed build fix after r275210. Disambiguate the WeakPtrFactory in RemoteMediaSessionCoordinatorProxy with a using statement.
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp (275234 => 275235)
--- trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp 2021-03-30 21:14:52 UTC (rev 275234)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp 2021-03-30 21:23:22 UTC (rev 275235)
@@ -63,7 +63,7 @@
completionHandler(WTFMove(imageDecoderIdentifier));
}
-void RemoteImageDecoderAVFProxy::deleteDecoder(const ImageDecoderIdentifier& identifier)
+void RemoteImageDecoderAVFProxy::deleteDecoder(ImageDecoderIdentifier identifier)
{
ASSERT(m_imageDecoders.contains(identifier));
if (!m_imageDecoders.contains(identifier))
@@ -72,7 +72,7 @@
m_imageDecoders.take(identifier);
}
-void RemoteImageDecoderAVFProxy::encodedDataStatusChanged(const ImageDecoderIdentifier& identifier)
+void RemoteImageDecoderAVFProxy::encodedDataStatusChanged(ImageDecoderIdentifier identifier)
{
if (!m_connectionToWebProcess || !m_imageDecoders.contains(identifier))
return;
@@ -81,7 +81,7 @@
m_connectionToWebProcess->connection().send(Messages::RemoteImageDecoderAVFManager::EncodedDataStatusChanged(identifier, imageDecoder->frameCount(), imageDecoder->size(), imageDecoder->hasTrack()), 0);
}
-void RemoteImageDecoderAVFProxy::setExpectedContentSize(const ImageDecoderIdentifier& identifier, long long expectedContentSize)
+void RemoteImageDecoderAVFProxy::setExpectedContentSize(ImageDecoderIdentifier identifier, long long expectedContentSize)
{
ASSERT(m_imageDecoders.contains(identifier));
if (!m_imageDecoders.contains(identifier))
@@ -90,7 +90,7 @@
m_imageDecoders.get(identifier)->setExpectedContentSize(expectedContentSize);
}
-void RemoteImageDecoderAVFProxy::setData(const ImageDecoderIdentifier& identifier, const IPC::DataReference& data, bool allDataReceived, CompletionHandler<void(size_t frameCount, const IntSize& size, bool hasTrack, Optional<Vector<ImageDecoder::FrameInfo>>&&)>&& completionHandler)
+void RemoteImageDecoderAVFProxy::setData(ImageDecoderIdentifier identifier, const IPC::DataReference& data, bool allDataReceived, CompletionHandler<void(size_t frameCount, const IntSize& size, bool hasTrack, Optional<Vector<ImageDecoder::FrameInfo>>&&)>&& completionHandler)
{
ASSERT(m_imageDecoders.contains(identifier));
if (!m_imageDecoders.contains(identifier)) {
@@ -110,7 +110,7 @@
completionHandler(frameCount, imageDecoder->size(), imageDecoder->hasTrack(), WTFMove(frameInfos));
}
-void RemoteImageDecoderAVFProxy::createFrameImageAtIndex(const ImageDecoderIdentifier& identifier, size_t index, CompletionHandler<void(Optional<WTF::MachSendRight>&&, ColorSpaceData&&)>&& completionHandler)
+void RemoteImageDecoderAVFProxy::createFrameImageAtIndex(ImageDecoderIdentifier identifier, size_t index, CompletionHandler<void(Optional<WTF::MachSendRight>&&, ColorSpaceData&&)>&& completionHandler)
{
ASSERT(m_imageDecoders.contains(identifier));
Optional<WTF::MachSendRight> sendRight;
@@ -134,6 +134,13 @@
completionHandler(WTFMove(sendRight), WTFMove(colorSpaceData));
}
+void RemoteImageDecoderAVFProxy::clearFrameBufferCache(ImageDecoderIdentifier identifier, size_t index)
+{
+ ASSERT(m_imageDecoders.contains(identifier));
+ if (auto* imageDecoder = m_imageDecoders.get(identifier))
+ imageDecoder->clearFrameBufferCache(std::min(index, imageDecoder->frameCount() - 1));
}
+}
+
#endif
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h (275234 => 275235)
--- trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h 2021-03-30 21:14:52 UTC (rev 275234)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h 2021-03-30 21:23:22 UTC (rev 275235)
@@ -52,12 +52,13 @@
private:
void createDecoder(const IPC::DataReference&, const String& mimeType, CompletionHandler<void(Optional<WebCore::ImageDecoderIdentifier>&&)>&&);
- void deleteDecoder(const WebCore::ImageDecoderIdentifier&);
- void setExpectedContentSize(const WebCore::ImageDecoderIdentifier&, long long expectedContentSize);
- void setData(const WebCore::ImageDecoderIdentifier&, const IPC::DataReference&, bool allDataReceived, CompletionHandler<void(size_t frameCount, const WebCore::IntSize& size, bool hasTrack, Optional<Vector<WebCore::ImageDecoder::FrameInfo>>&&)>&&);
- void createFrameImageAtIndex(const WebCore::ImageDecoderIdentifier&, size_t index, CompletionHandler<void(Optional<WTF::MachSendRight>&&, ColorSpaceData&&)>&&);
+ void deleteDecoder(WebCore::ImageDecoderIdentifier);
+ void setExpectedContentSize(WebCore::ImageDecoderIdentifier, long long expectedContentSize);
+ void setData(WebCore::ImageDecoderIdentifier, const IPC::DataReference&, bool allDataReceived, CompletionHandler<void(size_t frameCount, const WebCore::IntSize& size, bool hasTrack, Optional<Vector<WebCore::ImageDecoder::FrameInfo>>&&)>&&);
+ void createFrameImageAtIndex(WebCore::ImageDecoderIdentifier, size_t index, CompletionHandler<void(Optional<WTF::MachSendRight>&&, ColorSpaceData&&)>&&);
+ void clearFrameBufferCache(WebCore::ImageDecoderIdentifier, size_t index);
- void encodedDataStatusChanged(const WebCore::ImageDecoderIdentifier&);
+ void encodedDataStatusChanged(WebCore::ImageDecoderIdentifier);
WeakPtr<GPUConnectionToWebProcess> m_connectionToWebProcess;
HashMap<WebCore::ImageDecoderIdentifier, RefPtr<WebCore::ImageDecoderAVFObjC>> m_imageDecoders;
Modified: trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in (275234 => 275235)
--- trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in 2021-03-30 21:14:52 UTC (rev 275234)
+++ trunk/Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in 2021-03-30 21:23:22 UTC (rev 275235)
@@ -31,8 +31,9 @@
CreateDecoder(IPC::SharedBufferDataReference data, String mimeType) -> (Optional<WebCore::ImageDecoderIdentifier> identifier) Synchronous
DeleteDecoder(WebCore::ImageDecoderIdentifier identifier)
SetExpectedContentSize(WebCore::ImageDecoderIdentifier identifier, long long expectedContentSize)
- SetData(WebCore::ImageDecoderIdentifier identifier, IPC::SharedBufferDataReference data, bool allDataReceived) -> (uint32_t frameCount, WebCore::IntSize size, bool hasTrack, Optional<Vector<WebCore::ImageDecoder::FrameInfo>> frameInfos) Synchronous
- CreateFrameImageAtIndex(WebCore::ImageDecoderIdentifier identifier, uint32_t index) -> (Optional<MachSendRight> sendRight, struct WebKit::ColorSpaceData colorSpace) Synchronous
+ SetData(WebCore::ImageDecoderIdentifier identifier, IPC::SharedBufferDataReference data, bool allDataReceived) -> (size_t frameCount, WebCore::IntSize size, bool hasTrack, Optional<Vector<WebCore::ImageDecoder::FrameInfo>> frameInfos) Synchronous
+ CreateFrameImageAtIndex(WebCore::ImageDecoderIdentifier identifier, size_t index) -> (Optional<MachSendRight> sendRight, struct WebKit::ColorSpaceData colorSpace) Synchronous
+ ClearFrameBufferCache(WebCore::ImageDecoderIdentifier identifier, size_t index)
}
#endif
Modified: trunk/Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVF.cpp (275234 => 275235)
--- trunk/Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVF.cpp 2021-03-30 21:14:52 UTC (rev 275234)
+++ trunk/Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVF.cpp 2021-03-30 21:23:22 UTC (rev 275235)
@@ -208,7 +208,7 @@
IPC::SharedBufferDataReference dataReference { data };
- uint32_t frameCount;
+ size_t frameCount;
IntSize size;
bool hasTrack;
Optional<Vector<ImageDecoder::FrameInfo>> frameInfos;
@@ -225,9 +225,12 @@
m_frameInfos.swap(*frameInfos);
}
-void RemoteImageDecoderAVF::clearFrameBufferCache(size_t)
+void RemoteImageDecoderAVF::clearFrameBufferCache(size_t index)
{
- m_frameImages.clear();
+ for (size_t i = 0; i < std::min(index + 1, m_frameCount); ++i)
+ m_frameImages.remove(i);
+
+ m_gpuProcessConnection->connection().send(Messages::RemoteImageDecoderAVFProxy::ClearFrameBufferCache(m_identifier, index), 0);
}
void RemoteImageDecoderAVF::encodedDataStatusChanged(size_t frameCount, const WebCore::IntSize& size, bool hasTrack)