Instead of allocating a new memory buffer in GPUProcess and copying the ShareableBitmap data to it, we can create a PlatformImage that directly references this data. This will make all the NativeImages data be attributed to WebProcess.
rdar://92031359
Created attachment 458550 [details] Patch
Created attachment 458600 [details] Patch
Created attachment 458668 [details] Patch
Comment on attachment 458668 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=458668&action=review > Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:350 > + auto image = NativeImage::create(bitmap->createPlatformImage(DontCopyBackingStore, true), nativeImageResourceIdentifier.object()); The `true` here is not really readable. I suggest using an enum class to replace this boolean to make call sites more readable. > Source/WebKit/Shared/ShareableBitmap.h:118 > + RetainPtr<CGImageRef> makeCGImage(bool shouldInterpolate = false); parameter should be an enum class : bool. > Source/WebKit/Shared/ShareableBitmap.h:120 > + WebCore::PlatformImagePtr createPlatformImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore, bool shouldInterpolate = false); ditto. > Source/WebKit/Shared/ShareableBitmap.h:127 > + WebCore::PlatformImagePtr createPlatformImage(WebCore::BackingStoreCopy = WebCore::CopyBackingStore, bool shouldInterpolate = false) { return createCairoSurface(); } ditto. > Source/WebKit/Shared/ShareableBitmap.h:134 > + RetainPtr<CGImageRef> createCGImage(CGDataProviderRef, bool shouldInterpolate) const; ditto. > Source/WebKit/Shared/cg/ShareableBitmapCG.cpp:178 > + RetainPtr<CGDataProvider> dataProvider = adoptCF(CGDataProviderCreateWithData(this, data(), sizeInBytes(), [](void* typelessBitmap, const void* typelessData, size_t) { auto > Source/WebKit/Shared/cg/ShareableBitmapCG.cpp:179 > + ShareableBitmap* bitmap = static_cast<ShareableBitmap*>(typelessBitmap); auto*
Created attachment 458856 [details] Patch
Committed r293846 (250317@main): <https://commits.webkit.org/250317@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 458856 [details].