<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>233978</bug_id>
          
          <creation_ts>2021-12-07 22:22:52 -0800</creation_ts>
          <short_desc>Make FontCascade::setShouldUseSmoothing/shouldUseSmoothing thread safe</short_desc>
          <delta_ts>2022-09-14 17:38:28 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Layout and Rendering</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>233488</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Cameron McCormack (:heycam)">heycam</reporter>
          <assigned_to name="Matt Woodrow">mattwoodrow</assigned_to>
          <cc>bfulgham</cc>
    
    <cc>mattwoodrow</cc>
    
    <cc>mmaxfield</cc>
    
    <cc>simon.fraser</cc>
    
    <cc>webkit-bug-importer</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1821389</commentid>
    <comment_count>0</comment_count>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-12-07 22:22:52 -0800</bug_when>
    <thetext>Make FontCascade::setShouldUseSmoothing/shouldUseSmoothing thread safe</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1821393</commentid>
    <comment_count>1</comment_count>
      <attachid>446301</attachid>
    <who name="Cameron McCormack (:heycam)">heycam</who>
    <bug_when>2021-12-07 22:29:12 -0800</bug_when>
    <thetext>Created attachment 446301
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1821990</commentid>
    <comment_count>2</comment_count>
      <attachid>446301</attachid>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2021-12-08 21:08:32 -0800</bug_when>
    <thetext>Comment on attachment 446301
Patch

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

&gt; Source/WebCore/ChangeLog:11
&gt; +        same time from the main thread. This setting is only changed from
&gt; +        Internals and WebView and at WebProcess initilization, but should

WebKitLegacy and WebKit have SPI for this:

+ (void)_setShouldUseFontSmoothing:(BOOL)f
{
    WebCore::FontCascade::setShouldUseSmoothing(f);
}

void WKContextSetShouldUseFontSmoothing(WKContextRef contextRef, bool useFontSmoothing)
{
    WebKit::toImpl(contextRef)-&gt;setShouldUseFontSmoothing(useFontSmoothing);
}

&gt; Source/WebCore/platform/graphics/FontCascade.cpp:442
&gt; +static std::atomic&lt;bool&gt; shouldUseFontSmoothing = true;

Is it possible to make this no longer a global? I think that would be a better solution than this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1824253</commentid>
    <comment_count>3</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-12-14 22:23:15 -0800</bug_when>
    <thetext>&lt;rdar://problem/86506527&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1896949</commentid>
    <comment_count>4</comment_count>
    <who name="Matt Woodrow">mattwoodrow</who>
    <bug_when>2022-09-07 19:24:45 -0700</bug_when>
    <thetext>(In reply to Myles C. Maxfield from comment #2)
&gt; 
&gt; &gt; Source/WebCore/platform/graphics/FontCascade.cpp:442
&gt; &gt; +static std::atomic&lt;bool&gt; shouldUseFontSmoothing = true;
&gt; 
&gt; Is it possible to make this no longer a global? I think that would be a
&gt; better solution than this.

We could store this on the per-thread FontCache instances, but that then makes it harder to mutate with the SPI, since we&apos;d have to dispatch it to all threads that have a FontCache initialised.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1896955</commentid>
    <comment_count>5</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2022-09-07 19:46:00 -0700</bug_when>
    <thetext>(In reply to Matt Woodrow from comment #4)
&gt; (In reply to Myles C. Maxfield from comment #2)
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/platform/graphics/FontCascade.cpp:442
&gt; &gt; &gt; +static std::atomic&lt;bool&gt; shouldUseFontSmoothing = true;
&gt; &gt; 
&gt; &gt; Is it possible to make this no longer a global? I think that would be a
&gt; &gt; better solution than this.
&gt; 
&gt; We could store this on the per-thread FontCache instances, but that then
&gt; makes it harder to mutate with the SPI, since we&apos;d have to dispatch it to
&gt; all threads that have a FontCache initialised.

I guess I still think that&apos;s a better solution than a global :/</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1896956</commentid>
    <comment_count>6</comment_count>
    <who name="Myles C. Maxfield">mmaxfield</who>
    <bug_when>2022-09-07 19:46:50 -0700</bug_when>
    <thetext>Alternatively, we could try to find all callers of the SPI and see if we can remove it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1897746</commentid>
    <comment_count>7</comment_count>
    <who name="Matt Woodrow">mattwoodrow</who>
    <bug_when>2022-09-11 15:32:44 -0700</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/4240</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1898601</commentid>
    <comment_count>8</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2022-09-14 17:38:25 -0700</bug_when>
    <thetext>Committed 254500@main (eb547e04a187): &lt;https://commits.webkit.org/254500@main&gt;

Reviewed commits have been landed. Closing PR #4240 and removing active labels.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="1"
              ispatch="1"
              isprivate="0"
          >
            <attachid>446301</attachid>
            <date>2021-12-07 22:29:12 -0800</date>
            <delta_ts>2022-09-11 15:30:02 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>bug-233978-20211208172911.patch</filename>
            <type>text/plain</type>
            <size>1799</size>
            <attacher name="Cameron McCormack (:heycam)">heycam</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjg2NjM3CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggZDI1NThlY2JkYWVkNTVm
NWU1OWRjYmU4NjdmNjI4ZTE4MDBlMGI5NS4uZWUxOGUwYzliNDI2YmMxYjk4MzQzMzIyYzA2YWE4
MjIxMTBhNzQ0MiAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE5IEBACisyMDIxLTEyLTAyICBDYW1l
cm9uIE1jQ29ybWFjayAgPGhleWNhbUBhcHBsZS5jb20+CisKKyAgICAgICAgTWFrZSBGb250Q2Fz
Y2FkZTo6c2V0U2hvdWxkVXNlU21vb3RoaW5nL3Nob3VsZFVzZVNtb290aGluZyB0aHJlYWQgc2Fm
ZQorICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MjMzOTc4
CisKKyAgICAgICAgUmV2aWV3ZWQgYnkgTk9CT0RZIChPT1BTISkuCisKKyAgICAgICAgRm9udENh
c2NhZGU6OnNob3VsZFVzZVNtb290aGluZyBjYW4gYmUgY2FsbGVkIGZyb20gd29ya2VyIHRocmVh
ZHMKKyAgICAgICAgdXNpbmcgT2Zmc2NyZWVuQ2FudmFzLCBidXQgc2V0U2hvdWxkVXNlU21vb3Ro
aW5nIGNhbiBiZSBjYWxsZWQgYXQgdGhlCisgICAgICAgIHNhbWUgdGltZSBmcm9tIHRoZSBtYWlu
IHRocm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