Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 93848dd6cac160ace5db5e827e8a30e97bfc88a5
      
https://github.com/WebKit/WebKit/commit/93848dd6cac160ace5db5e827e8a30e97bfc88a5
  Author: Kimmo Kinnunen <[email protected]>
  Date:   2026-08-13 (Thu, 13 Aug 2026)

  Changed paths:
    M Source/WebCore/platform/graphics/NativeImage.cpp
    M Source/WebCore/platform/graphics/NativeImage.h
    M Source/WebCore/platform/graphics/cairo/ImageUtilitiesCairo.cpp
    M Source/WebCore/platform/graphics/cairo/NativeImageCairo.cpp
    M Source/WebCore/platform/graphics/cg/NativeImageCG.cpp
    M Source/WebCore/platform/graphics/skia/ImageUtilitiesSkia.cpp
    M Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp
    M Source/WebCore/platform/graphics/texmap/BitmapTexture.cpp
    M 
Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayerBufferNativeImage.cpp
    M Source/WebCore/platform/win/cairo/DragImageWinCairo.cpp
    M Source/WebKit/UIProcess/API/gtk/DragSourceGtk4.cpp
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
    M Source/WebKit/UIProcess/gtk/GtkUtilities.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageProxy.h
    M Source/WebKitLegacy/mac/Misc/WebCache.mm

  Log Message:
  -----------
  NativeImage accesses platform image without a lock
https://bugs.webkit.org/show_bug.cgi?id=321582
rdar://problem/184699290

Reviewed by Nikolas Zimmermann.

Lock the NativeImage::m_platformImage access, since theoretically
replacePlatformImage could replace the image while other threads
would access it. The uncontended lock is very cheap. Removes false
positives from analysis tools.

The replacement happens as a memory optimization:
 - When sending an image from WCP to GPUP, use the GPUP-shared pixel
   data in WCP source image. Today this is not a multithreaded case,
   but in future will be.
 - When sending the bitmap data of GPUP generated image, use the
   shared pixel data in the GPUP generated image. This is potentially
   multithreaded case.

* Source/WebCore/platform/graphics/NativeImage.cpp:
(WebCore::NativeImage::platformImage const):
(WebCore::NativeImage::replacePlatformImage const):
* Source/WebCore/platform/graphics/NativeImage.h:
* Source/WebCore/platform/graphics/cg/NativeImageCG.cpp:
(WebCore::NativeImage::size const):
(WebCore::NativeImage::hasAlpha const):
(WebCore::NativeImage::sizeInBytes const):
(WebCore::NativeImage::colorSpace const):
* Source/WebCore/platform/graphics/skia/NativeImageSkia.cpp:
(WebCore::NativeImage::size const):
(WebCore::NativeImage::hasAlpha const):
(WebCore::NativeImage::colorSpace const):
(WebCore::NativeImage::uniqueID const):
* Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageProxy.cpp:
(WebKit::RemoteNativeImageProxy::platformImage const):
* Source/WebKit/WebProcess/GPU/graphics/RemoteNativeImageProxy.h:

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



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

Reply via email to