Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 981f2c532e67b14de772b9afd25cfe79a68f9a07
      
https://github.com/WebKit/WebKit/commit/981f2c532e67b14de772b9afd25cfe79a68f9a07
  Author: Chris Dumez <[email protected]>
  Date:   2026-09-11 (Fri, 11 Sep 2026)

  Changed paths:
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
    M Source/WebCore/platform/graphics/GraphicsContextGL.h
    M Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h
    M 
Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in
    M
Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm
    M Tools/TestWebKitAPI/Tests/WebCore/glib/GraphicsContextGLTextureMapper.cpp

  Log Message:
  -----------
  GraphicsContextGL::Client::addDebugMessage() should take a std::span<const 
char8_t> rather than a UTF8CString
https://bugs.webkit.org/show_bug.cgi?id=323951

Reviewed by Darin Adler.

Taking a UTF8CString forces every producer of a debug message to build a 
ref-counted,
heap-allocated buffer just to hand over some characters. The only real producer 
already
has the characters as a pointer and a length: ANGLE's KHR_debug callback. It 
allocates
a CStringBuffer solely to satisfy the signature.

Take a std::span<const char8_t> instead. The span is the natural shape at both 
ends: the
ANGLE callback passes its (message, length) pair straight through, and
WebGLRenderingContextBase::addDebugMessage() feeds it to makeString(), which 
already has
a StringTypeAdapter for std::span<const char8_t> that
decodes UTF-8 the same way the
UTF8CString adapter did. The formatted message is built in one pass with no 
intermediate
allocation.

Nothing changes on the wire. WTFArgumentCoders.serialization.in already 
serializes
UTF8CString as exactly its std::span<const char8_t>, so declaring the IPC 
argument as the
span encodes the same bytes and merely skips materializing a CStringBuffer on 
each side.
On the receiving side the span points into the Decoder's buffer and stays valid 
for the
synchronous duration of the message dispatch;
RemoteGraphicsContextGLProxy::addDebugMessage() forwards it to the client, 
which formats
a String immediately, so it never escapes. This is the GPU-to-WebContent 
direction on a
regular Connection, whose Decoder owns a private copy of the message, not a 
shared-memory
stream read.

* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::addDebugMessage):
*
Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
* Source/WebCore/platform/graphics/GraphicsContextGL.h:
* Source/WebCore/platform/graphics/angle/GraphicsContextGLANGLE.cpp:
(WebCore::GraphicsContextGLANGLE::initialize):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::addDebugMessage):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::addDebugMessage):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
* 
Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.messages.in:
* Tools/TestWebKitAPI/Tests/WebCore/cocoa/TestGraphicsContextGLCocoa.mm:
* Tools/TestWebKitAPI/Tests/WebCore/glib/GraphicsContextGLTextureMapper.cpp:

Canonical link:
https://flagged.apple.com:443/proxy?t2=Di8K6e8Db8&o=aHR0cHM6Ly9jb21taXRzLndlYmtpdC5vcmcvMzIwOTc5QG1haW4=&emid=1f9cc522-2664-4286-9ae1-c1af2134657b&c=11



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

Reply via email to