[webkit-changes] [WebKit/WebKit] cab1c3: ImageBufferShareableBitmapBackend lacks ownership ...

Kimmo Kinnunen noreply at github.com
Wed Jan 17 04:02:05 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cab1c34e3f5de8eb66ddab429127b3127cd33f65
      https://github.com/WebKit/WebKit/commit/cab1c34e3f5de8eb66ddab429127b3127cd33f65
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2024-01-17 (Wed, 17 Jan 2024)

  Changed paths:
    M Source/WebCore/platform/graphics/ImageBufferBackend.h
    M Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.cpp
    M Source/WebKit/Platform/SharedMemory.h
    M Source/WebKit/Shared/ShareableBitmap.h
    M Source/WebKit/Shared/ShareableBitmapHandle.cpp
    M Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp
    M Source/WebKit/Shared/cg/ShareableBitmapCG.mm
    M Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp
    M Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBitmapBackend.cpp
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBitmapBackend.h

  Log Message:
  -----------
  ImageBufferShareableBitmapBackend lacks ownership attribution
https://bugs.webkit.org/show_bug.cgi?id=267266
rdar://problem/120707603

Reviewed by Matt Woodrow.

Add ShareableBitmap::setOwnershipOfMemory() to attribute the
ShareableBitmap to the owner process, currently always WP.

Use this when creating RemoteImageBuffer instances.
Use ShareableBitmap::Handle::takeOwnershipOfMemory() when receiving
the handles in WP.

Make some call sites of ShareableBitmap::create() more consistent.
The general pattern for marking the owner has to be:
- Use ShareableBitmap::setOwnershipOfMemory() in GPUP side immediately
  after creation.
- Use ShareableBitmap::Handle::takeOwnershipOfMemory() in WP side
  when receiving the handle. This is needed for the older macOS systems.

Remove unused ImageBuffer::setOwnershipIdentity() and similar methods.
Currently the ImageBuffer API contract is that the creator owns the
memory, and the internal implementation, in this case calls to
ShareableBitmap ensure it.

* Source/WebCore/platform/graphics/ImageBufferBackend.h:
(WebCore::ImageBufferBackend::setOwnershipIdentity): Deleted.
* Source/WebCore/platform/graphics/cg/ImageBufferIOSurfaceBackend.cpp:
(WebCore::ImageBufferIOSurfaceBackend::transferToNewContext):
* Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.cpp:
(WebKit::RemoteImageBuffer::getShareableBitmap):
(WebKit::RemoteImageBuffer::filteredNativeImage):
* Source/WebKit/Platform/SharedMemory.h:
* Source/WebKit/Shared/ShareableBitmap.h:
* Source/WebKit/Shared/ShareableBitmapHandle.cpp:
(WebKit::ShareableBitmapHandle::setOwnershipOfMemory const):
* Source/WebKit/Shared/cairo/ShareableBitmapCairo.cpp:
(WebKit::ShareableBitmap::setOwnershipIdentity):
* Source/WebKit/Shared/cg/ShareableBitmapCG.mm:
(WebKit::ShareableBitmap::setOwnershipIdentity):
* Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
(WebKit::ImageBufferShareableBitmapBackend::create):
(WebKit::ImageBufferShareableBitmapBackend::transferToNewContext):
(WebKit::BufferShareableBitmapBackend::bytesPerRow const):
(WebKit::ImageBufferShareableBitmapBackend::bytesPerRow const): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp:
(WebKit::RemoteImageBufferProxy::didCreateBackend):
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBitmapBackend.cpp:
(WebKit::ImageBufferShareableMappedIOSurfaceBitmapBackend::create):
(WebKit::ImageBufferShareableMappedIOSurfaceBitmapBackend::setOwnershipIdentity): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBitmapBackend.h:

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




More information about the webkit-changes mailing list