Bug 222552

Summary: Make the data backing generated global AtomString values accessible
Product: WebKit Reporter: Chris Lord <clord>
Component: WebCore Misc.Assignee: Chris Lord <clord>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, darin, esprehn+autocc, ews-watchlist, kangil.han, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch none

Description Chris Lord 2021-03-01 07:41:56 PST
Taking WebKitFontFamilyNames as the example, there are sometimes generated strings that you may want to use from a Worker. Currently this isn't possible, as these are AtomStrings created on the main thread. It would be helpful if the data behind them was accessible so that Worker instances can make their own copies of them if needed. It would be good to modify the generation so that the data variables that are currently private were publicly accessible.
Comment 1 Chris Lord 2021-03-01 07:45:33 PST
Created attachment 421826 [details]
Patch
Comment 2 Darin Adler 2021-03-01 12:19:38 PST
Comment on attachment 421826 [details]
Patch

Is this going to make the binary bigger?

Is the name with the "Data" suffix good enough to use outside the file? The choice of the name was "low stakes" since it was used only within the generated code. Now that it’s visible for use elsewhere in WebKit the name could matter a little more.
Comment 3 Chris Lord 2021-03-01 16:25:20 PST
(In reply to Darin Adler from comment #2)
> Comment on attachment 421826 [details]
> Patch
> 
> Is this going to make the binary bigger?

I wouldn't have thought so, but I'm not confident enough to say that's a definite no - I can test it out tomorrow.

> Is the name with the "Data" suffix good enough to use outside the file? The
> choice of the name was "low stakes" since it was used only within the
> generated code. Now that it’s visible for use elsewhere in WebKit the name
> could matter a little more.

Assuming that the name alone is enough, I think the Data suffix is good enough, but don't have strong feelings about it. Could always suffix it "StaticString", that would certainly make it pretty clear?
Comment 4 Chris Lord 2021-03-02 02:46:21 PST
So testing a release build of before and after the patch, libwebkit2gtk-4.0.so shrinks by 8 bytes (122674608->122674600) and libWebCoreGTK.a increases by 480 bytes (14609776->14610256). Everything else is unaffected.
Comment 5 Chris Lord 2021-03-04 00:55:19 PST
Created attachment 422191 [details]
Patch
Comment 6 EWS 2021-03-04 01:39:08 PST
Committed r273880: <https://commits.webkit.org/r273880>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 422191 [details].
Comment 7 Radar WebKit Bug Importer 2021-03-04 01:40:44 PST
<rdar://problem/75026071>