[Webkit-unassigned] [Bug 209804] New: [WPE][GTK] Avoid copying JSON source in webkit_user_content_filter_store_save() and friends

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Mar 31 05:56:13 PDT 2020


https://bugs.webkit.org/show_bug.cgi?id=209804

            Bug ID: 209804
           Summary: [WPE][GTK] Avoid copying JSON source in
                    webkit_user_content_filter_store_save() and friends
           Product: WebKit
           Version: WebKit Local Build
          Hardware: Unspecified
                OS: Unspecified
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: WebKit API
          Assignee: webkit-unassigned at lists.webkit.org
          Reporter: aperez at igalia.com

API functions webkit_user_content_filter_store_save() and
webkit_user_content_filter_store_save_from_file() result in
passing a GBytes to webkitUserContentFilterStoreSaveBytes(),
the the later instantiates a WTF::String with the contents
of the GBytes. This last step creates a copy of the data,
which can be potentially big (in the megabytes magnitude).

Moreover, webkit_user_content_filter_store_save_from_file()
will try to mmap() local files (good ☺) but to the data copy
to create the WTF::String will make the UI thread block on
page faults to load the data from disk, defeating the purpose
of the optimization (bad ☹).

It should be possible to use a WTF::ExternalStringImpl to
create a WTF::String pointing to the data from the GBytes
without copying, keeping a ref so the GBytes stays alive
and dropping the ref in ExternalStringImplFreeFunction
callback.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-unassigned/attachments/20200331/ac07f2a4/attachment.htm>


More information about the webkit-unassigned mailing list