Bug 223997 - Make FontCache constructable and safe to use off the main thread
Summary: Make FontCache constructable and safe to use off the main thread
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Lord
URL:
Keywords: InRadar
Depends on: 223995
Blocks: 202793
  Show dependency treegraph
 
Reported: 2021-03-31 06:00 PDT by Chris Lord
Modified: 2021-04-01 09:11 PDT (History)
6 users (show)

See Also:


Attachments
Patch (30.06 KB, patch)
2021-03-31 15:38 PDT, Chris Lord
no flags Details | Formatted Diff | Diff
Patch (31.47 KB, patch)
2021-04-01 01:40 PDT, Chris Lord
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Lord 2021-03-31 06:00:38 PDT
For OffscreenCanvas to have its own FontCache separate from the main FontCache singleton, FontCache needs to be constructable and its methods safe to use off the main thread.
Comment 1 Chris Lord 2021-03-31 15:38:32 PDT
Created attachment 424834 [details]
Patch
Comment 2 Darin Adler 2021-03-31 15:44:47 PDT
Comment on attachment 424834 [details]
Patch

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

> Source/WebCore/platform/graphics/FontCache.h:41
> +#include <wtf/RefCounted.h>

Should not need this if the header is including WTFString.h or AtomString.h

> Source/WebCore/platform/graphics/FontCascadeFonts.cpp:491
> +    ASSERT(m_thread.ptr() == &Thread::current());

Not sure this does the right thing with the web thread on iOS.

> Source/WebCore/platform/graphics/FontCascadeFonts.h:117
> +    Ref<Thread> m_thread { Thread::current() };

Should wrap this in #if ASSERT_ENABLED.

> Source/WebCore/platform/graphics/FontCascadeFonts.h:129
> +    ASSERT(m_thread.ptr() == &Thread::current());

Not sure this does the right thing with the web thread on iOS.
Comment 3 Chris Lord 2021-04-01 01:40:16 PDT
Created attachment 424880 [details]
Patch
Comment 4 EWS 2021-04-01 09:10:50 PDT
Committed r275364: <https://commits.webkit.org/r275364>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 424880 [details].
Comment 5 Radar WebKit Bug Importer 2021-04-01 09:11:15 PDT
<rdar://problem/76106447>