[webkit-changes] [WebKit/WebKit] bdeb00: [GLib] Provide and use helper functions to convert...
Adrian Perez
noreply at github.com
Tue Oct 29 13:47:29 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: bdeb007fd6c1fe75bfc58afdf501ce0ddb5f465f
https://github.com/WebKit/WebKit/commit/bdeb007fd6c1fe75bfc58afdf501ce0ddb5f465f
Author: Adrian Perez de Castro <aperez at igalia.com>
Date: 2024-10-29 (Tue, 29 Oct 2024)
Changed paths:
M Source/WTF/wtf/PlatformGTK.cmake
M Source/WTF/wtf/PlatformWPE.cmake
A Source/WTF/wtf/glib/GSpanExtras.h
M Source/WebKit/NetworkProcess/cache/NetworkCacheDataGLib.cpp
M Source/WebKit/UIProcess/API/glib/WebKitUserContentFilterStore.cpp
M Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp
M Source/WebKit/UIProcess/API/gtk/DropTargetGtk4.cpp
M Source/WebKit/UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp
M Source/WebKit/UIProcess/Inspector/glib/RemoteInspectorHTTPServer.cpp
Log Message:
-----------
[GLib] Provide and use helper functions to convert GBytes to std::span
https://bugs.webkit.org/show_bug.cgi?id=282210
Reviewed by Geoffrey Garen and Michael Catanzaro.
Add a new span(GBytes*) utility function, and a span(GRefPtr<GBytes>&)
overload. These localize the unsafe creation of a std::span<const uint8_t>
that represents the GBytes data in a single location, allowing to remove
WTF_ALLOW_UNSAFE_BUFFER_USAGE_{BEGIN,END} macros which were sprinkled
around. For item types other than uint8_t it is recommended to use
WTF::spanReinterpretCast<T> afterwards.
* Source/WTF/wtf/PlatformGTK.cmake: List new SpanHelpers.h header.
* Source/WTF/wtf/PlatformWPE.cmake: Ditto.
* Source/WTF/wtf/glib/GSpanExtras.h: Added.
(WTF::span): New function to make a std::span out of a GBytes.
* Source/WebKit/NetworkProcess/cache/NetworkCacheDataGLib.cpp:
(WebKit::NetworkCache::Data::span const): Use WTF::span() helper.
(WebKit::NetworkCache::Data::apply const): Use the Data::span() method.
* Source/WebKit/UIProcess/API/glib/WebKitUserContentFilterStore.cpp:
(webkitUserContentFilterStoreSaveBytes): Use WTF::span() helper.
* Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_load_bytes): Ditto.
* Source/WebKit/UIProcess/API/gtk/DropTargetGtk4.cpp:
(WebKit::DropTarget::accept): Ditto.
* Source/WebKit/UIProcess/Automation/gtk/WebAutomationSessionGtk.cpp:
(WebKit::base64EncodedPNGData): Ditto.
* Source/WebKit/UIProcess/Inspector/glib/RemoteInspectorHTTPServer.cpp:
Canonical link: https://commits.webkit.org/285855@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