Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a3cfbbbccbd80ae28e843fa78b7fbb8c8e9c1cfb
      
https://github.com/WebKit/WebKit/commit/a3cfbbbccbd80ae28e843fa78b7fbb8c8e9c1cfb
  Author: Jean-Yves Avenard <j...@apple.com>
  Date:   2025-08-07 (Thu, 07 Aug 2025)

  Changed paths:
    M Source/WebCore/bindings/js/ScriptBufferSourceProvider.h
    M Source/WebCore/bindings/js/WebAssemblyScriptBufferSourceProvider.h
    M Source/WebCore/platform/SharedBuffer.cpp
    M Source/WebCore/platform/SharedBuffer.h
    M Source/WebCore/workers/ScriptBuffer.cpp
    M Source/WebCore/workers/ScriptBuffer.h
    M Source/WebCore/workers/service/server/SWScriptStorage.cpp

  Log Message:
  -----------
  SharedBufferBuilder copy constructor should not take reference of original 
FragmentedSharedBuffer
https://bugs.webkit.org/show_bug.cgi?id=234215
rdar://86699446

Reviewed by Gerald Squelart.

in webkit.org/b/296798 we stopped using a SharedBuffer as storage backend
and instead used a dedicated Vector of DataSegment, removing the need to
store the FragmentedSharedBuffer when performing a copy.

We can further extend and never pass a SharedBuffer by pointer and instead
return a const reference in ScriptBuffer::buffer() and we remove all
use of unsafe pointers.

* Source/WebCore/platform/SharedBuffer.cpp:
(WebCore::FragmentedSharedBuffer::operator== const):
(WebCore::FragmentedSharedBuffer::haveIdenticalContent): Optimise the case
where the two shared buffers being compared have identical DataSegment instead
of performing a byte comparison over their entire content.
(WebCore::SharedBufferBuilder::operator== const): Add operator== to avoid 
having to create
an unnecessary temporary SharedBuffer.
* Source/WebCore/platform/SharedBuffer.h:
* Source/WebCore/workers/ScriptBuffer.cpp:
(WebCore::tryConvertToShareableResourceHandle):
(WebCore::operator==): Deleted.
* Source/WebCore/workers/ScriptBuffer.h:
(WebCore::ScriptBuffer::buffer const): Return a const reference to the 
SharedBufferBuilder instead
so that we don't have to unnecessarily create a SharedBuffer unless actually 
needed.
(WebCore::ScriptBuffer::size const): Add shortcut to return the size without
having to create a SharedBuffer.
(WebCore::ScriptBuffer::operator== const):
* Source/WebCore/workers/service/server/SWScriptStorage.cpp:
(WebCore::SWScriptStorage::store): Change storage type to SharedBuffer as the
content stored is always contiguous. Allows to remove unnecessary tests and 
conversions.

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to