Bug 233749 - move shouldAutoActivateFontIfNeeded knownFamilies cache to FontCache
Summary: move shouldAutoActivateFontIfNeeded knownFamilies cache to FontCache
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Cameron McCormack (:heycam)
URL:
Keywords: InRadar
Depends on: 233747
Blocks: 233488
  Show dependency treegraph
 
Reported: 2021-12-01 23:09 PST by Cameron McCormack (:heycam)
Modified: 2021-12-07 17:38 PST (History)
17 users (show)

See Also:


Attachments
Patch with dependencies for EWS (61.47 KB, patch)
2021-12-01 23:10 PST, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff
Patch (3.62 KB, patch)
2021-12-01 23:11 PST, Cameron McCormack (:heycam)
mmaxfield: review+
ews-feeder: commit-queue-
Details | Formatted Diff | Diff
[fast-cq] Patch for landing (3.65 KB, patch)
2021-12-07 17:18 PST, Cameron McCormack (:heycam)
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Cameron McCormack (:heycam) 2021-12-01 23:09:30 PST
With OffscreenCanvas, we can call shouldAutoActivateFontIfNeeded on a worker thread, and the knownFamilies HashSet is not thread safe. Also, the AtomStrings it stores are thread-specific. Move it to FontCache, so each thread has its own set.
Comment 1 Cameron McCormack (:heycam) 2021-12-01 23:10:38 PST
Created attachment 445675 [details]
Patch with dependencies for EWS
Comment 2 Cameron McCormack (:heycam) 2021-12-01 23:11:56 PST
Created attachment 445676 [details]
Patch
Comment 3 Myles C. Maxfield 2021-12-07 00:47:12 PST
Comment on attachment 445676 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=445676&action=review

Good idea.

> Source/WebCore/platform/graphics/FontCache.h:378
> +#if PLATFORM(MAC)

I think generally our policy is to only ifdef function definitions, not declarations (just to reduce visual noise).
Comment 4 Myles C. Maxfield 2021-12-07 00:47:54 PST
It's probably worth investigating whether this cache actually saves us any perf at all.
Comment 5 Cameron McCormack (:heycam) 2021-12-07 13:16:15 PST
(In reply to Myles C. Maxfield from comment #3)
> I think generally our policy is to only ifdef function definitions, not
> declarations (just to reduce visual noise).

OK.  I guess it would need to be #ifdefed it were using some platform-specific type (and we didn't already have a typedef pointing to the platform-specific type we could use).

There is some benefit from the #ifdef, which is to point out to the reader that these are indeed only available on some platform/configuration, but maybe they can just discover that themselves when they try to call the function and it's not defined everywhere.
Comment 6 EWS 2021-12-07 17:09:46 PST
/Volumes/Data/worker/Commit-Queue/build/Source/WebCore/ChangeLog neither lists a valid reviewer nor contains the string "Unreviewed" or "Rubber stamp" (case insensitive).
Comment 7 Cameron McCormack (:heycam) 2021-12-07 17:18:58 PST
Created attachment 446261 [details]
[fast-cq] Patch for landing
Comment 8 EWS 2021-12-07 17:36:57 PST
Committed r286634 (?): <https://commits.webkit.org/r286634>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 446261 [details].
Comment 9 Radar WebKit Bug Importer 2021-12-07 17:38:41 PST
<rdar://problem/86185239>