[webkit-changes] [WebKit/WebKit] 6646f0: Use span for MappedFileData and DataSegment
Darin Adler
noreply at github.com
Sat Sep 28 12:23:46 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6646f0585b449208fb9eabe1b43a3dd5ae153e6f
https://github.com/WebKit/WebKit/commit/6646f0585b449208fb9eabe1b43a3dd5ae153e6f
Author: Darin Adler <darin at apple.com>
Date: 2024-09-28 (Sat, 28 Sep 2024)
Changed paths:
M Source/JavaScriptCore/runtime/CachePayload.cpp
M Source/JavaScriptCore/runtime/CachePayload.h
M Source/JavaScriptCore/runtime/CachedTypes.cpp
M Source/WTF/wtf/FileSystem.cpp
M Source/WTF/wtf/FileSystem.h
M Source/WTF/wtf/win/FileSystemWin.cpp
M Source/WebCore/platform/ShareableResource.cpp
M Source/WebCore/platform/SharedBuffer.cpp
M Source/WebCore/platform/SharedBuffer.h
M Source/WebCore/platform/SharedMemory.cpp
M Source/WebCore/platform/cocoa/SharedBufferCocoa.mm
M Source/WebCore/platform/glib/SharedBufferGlib.cpp
M Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp
M Source/WebCore/platform/network/BlobRegistryImpl.cpp
M Source/WebCore/platform/skia/SharedBufferSkia.cpp
M Source/WebKit/NetworkProcess/Notifications/Cocoa/WebPushDaemonConnectionCocoa.mm
M Source/WebKit/NetworkProcess/cache/NetworkCacheDataCocoa.mm
M Source/WebKit/UIProcess/API/C/WKPage.cpp
M Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/webpushd/WebPushDaemon.mm
Log Message:
-----------
Use span for MappedFileData and DataSegment
https://bugs.webkit.org/show_bug.cgi?id=274756
rdar://128807880
Reviewed by Chris Dumez.
Changed JSC::CachePayload, WTF::MappedFileData, and
WebCore::DataSegment::Provider to use spans instead of pointer/size pairs.
* Source/JavaScriptCore/runtime/CachePayload.cpp:
(JSC::CachePayload::span const): Added.
(JSC::CachePayload::data const): Deleted.
(JSC::CachePayload::size const): Deleted.
* Source/JavaScriptCore/runtime/CachePayload.h: Updated for the above.
* Source/JavaScriptCore/runtime/CachedTypes.cpp:
(JSC::Decoder::offsetOf): Tweaked coding style a bit
(JSC::decodeCodeBlockImpl): Ditto.
(JSC::isCachedBytecodeStillValid): Removed use of CachePayload::size
in function that already calls CachePayload::span.
* Source/WTF/wtf/FileSystem.cpp:
(WTF::FileSystemImpl::MappedFileData::~MappedFileData): Updated since
m_fileData is now a span.
(WTF::FileSystemImpl::MappedFileData::mapFileHandle): Use span for
m_fileData.
* Source/WTF/wtf/win/FileSystemWin.cpp:
(WTF::FileSystemImpl::MappedFileData::~MappedFileData): Updated since
m_fileData is now a span.
(WTF::FileSystemImpl::MappedFileData::mapFileHandle): Use span for
m_fileData.
* Source/WTF/wtf/FileSystem.h: Use span for m_fileData. Return a span
from leakHandle.
* Source/WebCore/platform/ShareableResource.cpp:
(WebCore::ShareableResource::wrapInSharedBuffer): Updated since
DataSegment::Provider now takes a Function that returns a span.
(WebCore::ShareableResource::span const): Fixed bug where the span
returned here was bigger than it should be: not past the end of the
shared memory, but possibly past the end of the resource.
* Source/WebCore/platform/SharedBuffer.cpp:
(WebCore::FragmentedSharedBuffer::FragmentedSharedBuffer): Updated
since DataSegment::Provider now takes a Function that returns a span.
(WebCore::FragmentedSharedBuffer::tryCreateArrayBuffer const):
Removed unneeded cast to unsigned. Use copyTo instead of a hand-written
loop to copy the data from m_segments into the ArrayBuffer.
(WebCore::DataSegment::iterate const): Use span.
(WebCore::FragmentedSharedBuffer::startsWith const): Ditto.
(WebCore::FragmentedSharedBuffer::copyTo const): Use span, memcpySpan,
and subspan instead of pointers.
(WebCore::FragmentedSharedBuffer::operator== const): Use equalSpans.
(WebCore::SharedBuffer::span const): Added.
(WebCore::SharedBuffer::data const): Deleted.
(WebCore::SharedBuffer::operator[] const): Updated since
DataSegment::Provider now takes a Function that returns a span.
(WebCore::SharedBuffer::decoder const): Use span.
(WebCore::DataSegment::span const): Added.
(WebCore::DataSegment::data const): Deleted.
(WebCore::DataSegment::size const): Deleted.
(WebCore::SharedBufferDataView::createSharedBuffer const): Updated
since DataSegment::Provider now takes a Function that returns a span.
* Source/WebCore/platform/SharedBuffer.h: Changed
DataSegment::Provider to a single Function that returns a span instead
of one that returns a data pointer and another that returns a size.
* Source/WebCore/platform/SharedMemory.cpp:
(WebCore::SharedMemory::createSharedBuffer const): Updated
since DataSegment::Provider now takes a Function that returns a span.
* Source/WebCore/platform/cocoa/SharedBufferCocoa.mm:
(WebCore::FragmentedSharedBuffer::createCMBlockBuffer const):
Removed unneeded cast.
* Source/WebCore/platform/glib/SharedBufferGlib.cpp:
(WebCore::SharedBuffer::createGBytes const): Use span.
* Source/WebCore/platform/image-decoders/ScalableImageDecoder.cpp:
(copyFromSharedBuffer): Deleted.
(WebCore::ScalableImageDecoder::create): Use FragmentedSharedBuffer::copyTo
instead of a local copyFromSharedBuffer function here that does the same thing.
* Source/WebCore/platform/network/BlobRegistryImpl.cpp:
(WebCore::writeFilePathsOrDataBuffersToFile): Use the correct int64_t type here,
which matches the return type of FileSystem::writeToFile.
* Source/WebCore/platform/skia/SharedBufferSkia.cpp:
(WebCore::SharedBuffer::createSkData const): Use span.
* Source/WebKit/NetworkProcess/Notifications/Cocoa/WebPushDaemonConnectionCocoa.mm:
(WebKit::WebPushD::Connection::performSendWithAsyncReplyWithoutUsingIPCConnection const):
Tweak coding style.
* Source/WebKit/NetworkProcess/cache/NetworkCacheDataCocoa.mm:
(WebKit::NetworkCache::Data::adoptMap): Updated since MappedFileData::leakHandle now
returns a span.
* Source/WebKit/UIProcess/API/C/WKPage.cpp:
(dataReferenceFrom): Updated since DataSegment::Provider now takes a Function that
returns a span. This new version now holds a reference to the string instead of
making a copy of the bytes, which seems what was intended from the start.
* Source/WebKit/UIProcess/API/Cocoa/WKBrowsingContextController.mm:
(-[WKBrowsingContextController loadAlternateHTMLString:baseURL:forUnreachableURL:]):
Updated for changes to DataSegment. This now makes the object lifetime clearer
using an explicit RetainPtr.
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _loadAlternateHTMLString:baseURL:forUnreachableURL:]): Ditto.
* Source/WebKit/webpushd/WebPushDaemon.mm:
(WebPushD::WebPushDaemon::connectionEventHandler): Use auto* for style consistency.
Canonical link: https://commits.webkit.org/284419@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list