<?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>223089</bug_id>
          
          <creation_ts>2021-03-11 14:03:20 -0800</creation_ts>
          <short_desc>Use BinarySemaphore in SerializedScriptValue::writeBlobsToDiskForIndexedDBSynchronously()</short_desc>
          <delta_ts>2021-03-11 14:41:18 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore Misc.</component>
          <version>WebKit Nightly 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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Chris Dumez">cdumez</reporter>
          <assigned_to name="Chris Dumez">cdumez</assigned_to>
          <cc>achristensen</cc>
    
    <cc>alecflett</cc>
    
    <cc>beidson</cc>
    
    <cc>darin</cc>
    
    <cc>ews-watchlist</cc>
    
    <cc>ggaren</cc>
    
    <cc>jsbell</cc>
    
    <cc>sam</cc>
    
    <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1738609</commentid>
    <comment_count>0</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-11 14:03:20 -0800</bug_when>
    <thetext>Use BinarySemaphore in SerializedScriptValue::writeBlobsToDiskForIndexedDBSynchronously() instead of a Condition. This simplifies the code a bit.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1738612</commentid>
    <comment_count>1</comment_count>
      <attachid>422963</attachid>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-11 14:05:23 -0800</bug_when>
    <thetext>Created attachment 422963
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1738613</commentid>
    <comment_count>2</comment_count>
      <attachid>422963</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2021-03-11 14:07:39 -0800</bug_when>
    <thetext>Comment on attachment 422963
Patch

r=me</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1738614</commentid>
    <comment_count>3</comment_count>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2021-03-11 14:08:30 -0800</bug_when>
    <thetext>View in context: https://bugs.webkit.org/attachment.cgi?id=422963&amp;action=review

&gt; Source/WebCore/bindings/js/SerializedScriptValue.cpp:4159
&gt; +    callOnMainThread([this, &amp;semaphore, &amp;value] {

Won&apos;t this do something different in UIWebView?  Does this matter?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1738616</commentid>
    <comment_count>4</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-11 14:11:50 -0800</bug_when>
    <thetext>(In reply to Alex Christensen from comment #3)
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=422963&amp;action=review
&gt; 
&gt; &gt; Source/WebCore/bindings/js/SerializedScriptValue.cpp:4159
&gt; &gt; +    callOnMainThread([this, &amp;semaphore, &amp;value] {
&gt; 
&gt; Won&apos;t this do something different in UIWebView?  Does this matter?

I mentioned this in the changelog. I changed this intentionally. We&apos;re in WebCore here so we should be using callOnMainThread() in my opinion. Also note that the surrounding code is using isMainThread(), not isMainRunLoop().</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1738617</commentid>
    <comment_count>5</comment_count>
      <attachid>422963</attachid>
    <who name="Alex Christensen">achristensen</who>
    <bug_when>2021-03-11 14:12:23 -0800</bug_when>
    <thetext>Comment on attachment 422963
Patch

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

Sounds good

&gt; Source/WebCore/bindings/js/SerializedScriptValue.cpp:4159
&gt; +    callOnMainThread([this, &amp;semaphore, &amp;value] {

Won&apos;t this do something different in UIWebView?  Does this matter?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1738620</commentid>
    <comment_count>6</comment_count>
    <who name="Chris Dumez">cdumez</who>
    <bug_when>2021-03-11 14:16:22 -0800</bug_when>
    <thetext>(In reply to Chris Dumez from comment #4)
&gt; (In reply to Alex Christensen from comment #3)
&gt; &gt; View in context:
&gt; &gt; https://bugs.webkit.org/attachment.cgi?id=422963&amp;action=review
&gt; &gt; 
&gt; &gt; &gt; Source/WebCore/bindings/js/SerializedScriptValue.cpp:4159
&gt; &gt; &gt; +    callOnMainThread([this, &amp;semaphore, &amp;value] {
&gt; &gt; 
&gt; &gt; Won&apos;t this do something different in UIWebView?  Does this matter?
&gt; 
&gt; I mentioned this in the changelog. I changed this intentionally. We&apos;re in
&gt; WebCore here so we should be using callOnMainThread() in my opinion. Also
&gt; note that the surrounding code is using isMainThread(), not isMainRunLoop().

I also checked the call site, it does:
if (!isMainThread()) {
     value-&gt;writeBlobsToDiskForIndexedDBSynchronously();
     return;   
}
value-&gt;writeBlobsToDiskForIndexedDB()

So for this call site, it was OK to call writeBlobsToDiskForIndexedDB() directly if isMainThread() returns true (potentially being the WebThread).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1738633</commentid>
    <comment_count>7</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2021-03-11 14:40:05 -0800</bug_when>
    <thetext>Committed r274300: &lt;https://commits.webkit.org/r274300&gt;

All reviewed patches have been landed. Closing bug and clearing flags on attachment 422963.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1738637</commentid>
    <comment_count>8</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2021-03-11 14:41:18 -0800</bug_when>
    <thetext>&lt;rdar://problem/75333893&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>422963</attachid>
            <date>2021-03-11 14:05:23 -0800</date>
            <delta_ts>2021-03-11 14:40:06 -0800</delta_ts>
            <desc>Patch</desc>
            <filename>bug-223089-20210311140522.patch</filename>
            <type>text/plain</type>
            <size>2476</size>
            <attacher name="Chris Dumez">cdumez</attacher>
            
              <data encoding="base64">U3VidmVyc2lvbiBSZXZpc2lvbjogMjc0Mjk2CmRpZmYgLS1naXQgYS9Tb3VyY2UvV2ViQ29yZS9D
aGFuZ2VMb2cgYi9Tb3VyY2UvV2ViQ29yZS9DaGFuZ2VMb2cKaW5kZXggMDI2YjM4ZGVhYTY1YmIz
OTAwMjU4NDI1NzkwZjIxN2FkZGU2NTZlOC4uNjlkOTY1OWM0MzE1MWFmOGQ3ODkzODI3YmJjOTg0
Zjk0ODMyZjViMSAxMDA2NDQKLS0tIGEvU291cmNlL1dlYkNvcmUvQ2hhbmdlTG9nCisrKyBiL1Nv
dXJjZS9XZWJDb3JlL0NoYW5nZUxvZwpAQCAtMSwzICsxLDE3IEBACisyMDIxLTAzLTExICBDaHJp
cyBEdW1leiAgPGNkdW1lekBhcHBsZS5jb20+CisKKyAgICAgICAgVXNlIEJpbmFyeVNlbWFwaG9y
ZSBpbiBTZXJpYWxpemVkU2NyaXB0VmFsdWU6OndyaXRlQmxvYnNUb0Rpc2tGb3JJbmRleGVkREJT
eW5jaHJvbm91c2x5KCkKKyAgICAgICAgaHR0cHM6Ly9idWdzLndlYmtpdC5vcmcvc2hvd19idWcu
Y2dpP2lkPTIyMzA4OQorCisgICAgICAgIFJldmlld2VkIGJ5IE5PQk9EWSAoT09QUyEpLgorCisg
ICAgICAgIFVzZSBCaW5hcnlTZW1hcGhvcmUgaW4gU2VyaWFsaXplZFNjcmlwdFZhbHVlOjp3cml0
ZUJsb2JzVG9EaXNrRm9ySW5kZXhlZERCU3luY2hyb25v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NNYWluVGhyZWFkKCkpOwotICAgICAgICAgICAgdmFs
dWVQdHItPnNldEFzSXNvbGF0ZWRDb3B5KHJlc3VsdCk7CisgICAgICAgICAgICB2YWx1ZS5zZXRB
c0lzb2xhdGVkQ29weShyZXN1bHQpOwogCi0gICAgICAgICAgICBjb25kaXRpb25QdHItPm5vdGlm
eUFsbCgpOworICAgICAgICAgICAgc2VtYXBob3JlLnNpZ25hbCgpOwogICAgICAgICB9KTsKICAg
ICB9KTsKLQotICAgIGNvbmRpdGlvbi53YWl0KGxvY2spOworICAgIHNlbWFwaG9yZS53YWl0KCk7
CiAKICAgICByZXR1cm4gdmFsdWU7CiB9Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>