Canvas.toDataURL causes excessive GPUP memory use on Cocoa IOSurface -backed image -> CGBitmap copy -> compressed data string 1 (61.0M) CONTENT: VM: CG raster data + 1 (61.0M) mmap (in libsystem_kernel.dylib) + 0 [0x1dfc92c84] ..... + 1 (61.0M) CGBitmapContextCreateImage (in CoreGraphics) + 172 [0x1a6b6d444] + 1 (61.0M) WebKit::ShareableBitmap::makeCGImageCopy() (in WebKit) + 84 [0x10544eb60] + 1 (61.0M) WebKit::ImageBufferShareableBitmapBackend::copyNativeImage(WebCore::BackingStoreCopy) const (in WebKit) + 40 [0x105a7e1a4] + 1 (61.0M) WebCore::ImageBufferCGBackend::copyCGImageForEncoding(__CFString const*, WebCore::PreserveResolution) const (in WebCore) + 568 [0x113f87f34] + 1 (61.0M) WebCore::ImageBufferCGBackend::toDataURL(WTF::String const&, std::__1::optional<double>, WebCore::PreserveResolution) const (in WebCore) + 124 [0x113f883a0] + 1 (61.0M) WebKit::RemoteRenderingBackend::getDataURLForImageBufferWithQualifiedIdentifier(WTF::String const&, std::__1::optional<double>, WebCore::PreserveResolution, WebCore::ProcessQualified<WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType> >, WTF::CompletionHandler<void (WTF::String&&)>&&) (in WebKit) + 124 [0x1057ac384] + 1 (61.0M) void IPC::handleMessageSynchronous<Messages::RemoteRenderingBackend::GetDataURLForImageBuffer, WebKit::RemoteRenderingBackend, void (WebKit::RemoteRenderingBackend::*)(WTF::String const&, std::__1::optional<double>, WebCore::PreserveResolution, WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WTF::CompletionHandler<void (WTF::String&&)>&&)>(IPC::StreamServerConnection&, IPC::Decoder&, WebKit::RemoteRenderingBackend*, void (WebKit::RemoteRenderingBackend::*)(WTF::String const&, std::__1::optional<double>, WebCore::PreserveResolution, WTF::ObjectIdentifier<WebCore::RenderingResourceIdentifierType>, WTF::CompletionHandler<void (WTF::String&&)>&&)) (in WebKit) + 232 [0x10579cdf0]
<rdar://problem/93567863>
Should probably be fixed by removing ImageBuffer::toData / ImageBuffer::toDataURL and using data(), dataURL(), String dataURL(ImageBuffer&, const String& mimeType, std::optional<double> quality = std::nullopt, PreserveResolution preserveResolution) Vector<uint8_t> toData(ImageBuffer&, const String& mimeType, std::optional<double> quality = std::nullopt)
Pull request: https://github.com/WebKit/WebKit/pull/1407
Pull request: https://github.com/WebKit/WebKit/pull/1528
Pull request: https://github.com/WebKit/WebKit/pull/1741
Committed 251974@main (bc684eeb57fb): <https://commits.webkit.org/251974@main> Reviewed commits have been landed. Closing PR #1741 and removing active labels.
Reopening as the change was reverted, see https://github.com/WebKit/WebKit/pull/1940
Pull request: https://github.com/WebKit/WebKit/pull/1951
Committed 252032@main (55390aa216e4): <https://commits.webkit.org/252032@main> Reviewed commits have been landed. Closing PR #1951 and removing active labels.