<?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>170391</bug_id>
          
          <creation_ts>2017-04-02 10:04:35 -0700</creation_ts>
          <short_desc>Implement PromiseDeferredTimer for non CF based ports</short_desc>
          <delta_ts>2017-04-05 00:58:15 -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>JavaScriptCore</component>
          <version>WebKit Local Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=169187</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>Gtk</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>170390</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Carlos Garcia Campos">cgarcia</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>andersca</cc>
    
    <cc>buildbot</cc>
    
    <cc>darin</cc>
    
    <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>jfbastien</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>mcatanzaro</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>sam</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1293535</commentid>
    <comment_count>0</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2017-04-02 10:04:35 -0700</bug_when>
    <thetext>RunLoop handling is only implemented for CF causing several wasm tests to fail for other ports:

wasm.yaml/wasm/js-api/Module-compile.js.default-wasm: ERROR: Unexpected exit code: 3
wasm.yaml/wasm/js-api/web-assembly-compile-parallel.js.default-wasm: ERROR: Unexpected exit code: 3
wasm.yaml/wasm/js-api/web-assembly-instantiate.js.default-wasm: ERROR: Unexpected exit code: 3
wasm.yaml/wasm/js-api/web-assembly-instantiate-parallel.js.default-wasm: ERROR: Unexpected exit code: 3</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293536</commentid>
    <comment_count>1</comment_count>
      <attachid>306055</attachid>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2017-04-02 10:13:45 -0700</bug_when>
    <thetext>Created attachment 306055
Patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293543</commentid>
    <comment_count>2</comment_count>
      <attachid>306055</attachid>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-04-02 11:05:58 -0700</bug_when>
    <thetext>Comment on attachment 306055
Patch

It looks OK to me, but I wonder if the separate implementation for CF is really necessary. If it really is, then I&apos;d expect RunLoop to be implemented in terms of CFRunLoop....</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293567</commentid>
    <comment_count>3</comment_count>
      <attachid>306055</attachid>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-04-02 17:40:30 -0700</bug_when>
    <thetext>Comment on attachment 306055
Patch

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

&gt; Source/JavaScriptCore/runtime/PromiseDeferredTimer.cpp:-85
&gt; +#if USE(CF)
&gt;          CFRunLoopRun();
&gt; -}

It&apos;s unnecessary since we already have the assertion that CFRunLoopGetCurrent() == m_runLoop.get(). So, RunLoop::run() drives current thread RunLoop and it is OK for all the ports.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293571</commentid>
    <comment_count>4</comment_count>
      <attachid>306055</attachid>
    <who name="Michael Catanzaro">mcatanzaro</who>
    <bug_when>2017-04-02 18:16:57 -0700</bug_when>
    <thetext>Comment on attachment 306055
Patch

OK then, please rewrite to get rid of CFRunLoop.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293572</commentid>
    <comment_count>5</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-04-02 18:20:49 -0700</bug_when>
    <thetext>(In reply to Michael Catanzaro from comment #4)
&gt; Comment on attachment 306055 [details]
&gt; Patch
&gt; 
&gt; OK then, please rewrite to get rid of CFRunLoop.

A bit worried thing is that, current RunLoop &amp; RunLoop::Timer do not have the full features of CFRunLoop. For example, RunLoop is thread-safe, functions can be called from the other thread. But RunLoop::Timer is only available from the created thread. And current Heap&apos;s timers are touched from the other thread.

So, I think we still need to use CFRunLoop right now. But at least, in runRunLoop, we can just use RunLoop::run(). But for doWork function, we still need CFRunLoop thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293577</commentid>
    <comment_count>6</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2017-04-02 22:34:47 -0700</bug_when>
    <thetext>(In reply to Yusuke Suzuki from comment #5)
&gt; (In reply to Michael Catanzaro from comment #4)
&gt; &gt; Comment on attachment 306055 [details]
&gt; &gt; Patch
&gt; &gt; 
&gt; &gt; OK then, please rewrite to get rid of CFRunLoop.
&gt; 
&gt; A bit worried thing is that, current RunLoop &amp; RunLoop::Timer do not have
&gt; the full features of CFRunLoop. For example, RunLoop is thread-safe,
&gt; functions can be called from the other thread. But RunLoop::Timer is only
&gt; available from the created thread. And current Heap&apos;s timers are touched
&gt; from the other thread.
&gt; 
&gt; So, I think we still need to use CFRunLoop right now. But at least, in
&gt; runRunLoop, we can just use RunLoop::run(). But for doWork function, we
&gt; still need CFRunLoop thing.

Also note that iOS calls setRunLoop. Since CF timers already have a m_runLoop member I thought it was safer to use the member. I agree we could use RunLoop::run(), but since we need to keep the CF ifdefs for the stop, I think it&apos;s less confusing to have ifdefs for the run too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1293579</commentid>
    <comment_count>7</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-04-02 22:38:56 -0700</bug_when>
    <thetext>(In reply to Carlos Garcia Campos from comment #6)
&gt; (In reply to Yusuke Suzuki from comment #5)
&gt; &gt; (In reply to Michael Catanzaro from comment #4)
&gt; &gt; &gt; Comment on attachment 306055 [details]
&gt; &gt; &gt; Patch
&gt; &gt; &gt; 
&gt; &gt; &gt; OK then, please rewrite to get rid of CFRunLoop.
&gt; &gt; 
&gt; &gt; A bit worried thing is that, current RunLoop &amp; RunLoop::Timer do not have
&gt; &gt; the full features of CFRunLoop. For example, RunLoop is thread-safe,
&gt; &gt; functions can be called from the other thread. But RunLoop::Timer is only
&gt; &gt; available from the created thread. And current Heap&apos;s timers are touched
&gt; &gt; from the other thread.
&gt; &gt; 
&gt; &gt; So, I think we still need to use CFRunLoop right now. But at least, in
&gt; &gt; runRunLoop, we can just use RunLoop::run(). But for doWork function, we
&gt; &gt; still need CFRunLoop thing.
&gt; 
&gt; Also note that iOS calls setRunLoop. Since CF timers already have a
&gt; m_runLoop member I thought it was safer to use the member. I agree we could
&gt; use RunLoop::run(), but since we need to keep the CF ifdefs for the stop, I
&gt; think it&apos;s less confusing to have ifdefs for the run too.

OK, we should change &amp; drop all the CF things when we use RunLoop &amp; RunLoop::Timer thing exclusively.
Eventually, we should change current JSRunLoopTimer to accept RunLoop instead of CFRunLoopRef thing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1294429</commentid>
    <comment_count>8</comment_count>
    <who name="Carlos Garcia Campos">cgarcia</who>
    <bug_when>2017-04-05 00:58:15 -0700</bug_when>
    <thetext>Committed r214936: &lt;http://trac.webkit.org/changeset/214936&gt;</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>306055</attachid>
            <date>2017-04-02 10:13:45 -0700</date>
            <delta_ts>2017-04-02 22:39:04 -0700</delta_ts>
            <desc>Patch</desc>
            <filename>jsc-promise-timer.diff</filename>
            <type>text/plain</type>
            <size>3518</size>
            <attacher name="Carlos Garcia Campos">cgarcia</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1NvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cgYi9Tb3VyY2UvSmF2
YVNjcmlwdENvcmUvQ2hhbmdlTG9nCmluZGV4IGM5YTk2ZjVjNzJiLi5mOTgwNTgyNjhhNyAxMDA2
NDQKLS0tIGEvU291cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZworKysgYi9Tb3VyY2UvSmF2
YVNjcmlwdENvcmUvQ2hhbmdlTG9nCkBAIC0xLDUgKzEsMjEgQEAKIDIwMTctMDQtMDIgIENhcmxv
cyBHYXJjaWEgQ2FtcG9zICA8Y2dhcmNpYUBpZ2FsaWEuY29tPgogCisgICAgICAgIEltcGxlbWVu
dCBQcm9taXNlRGVmZXJyZWRUaW1lciBmb3Igbm9uIENGIGJhc2VkIHBvcnRzCisgICAgICAgIGh0
dHBzOi8vYnVncy53ZWJraXQub3JnL3Nob3dfYnVnLmNnaT9pZD0xNzAzOTEKKworICAgICAgICBS
ZXZpZXdlZCBieSBOT0JPRFkgKE9PUFMhKS4KKworICAgICAgICBSdW5Mb29wIGhhbmRsaW5nIGlz
IG9ubHkgaW1wbGVtZW50ZWQgZm9yIENGIGNhdXNpbmcgc2V2ZXJhbCB3YXNtIHRlc3RzIHRvIGZh
aWwgZm9yIG90aGVyIHBvcnRzLgorCisgICAgICAgICoganNjLmNwcDoKKyAgICAgICAgKHJ1bkpT
Qyk6IFJlbW92ZSBDRiBpZmRlZnMuCisgICAgICAgICogcnVudGltZS9Qcm9taXNlRGVmZXJyZWRU
aW1lci5jcHA6CisgICAgICAgIChKU0M6OlByb21pc2VEZWZlcnJlZFRpbWVyOjpkb1dvcmspOiBB
ZGQgbm9uIENGIGltc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gbV9ydW5UYXNrcyA9IGZhbHNlOyB9Ci0jaWYgVVNFKENGKQorCiAgICAgSlNfRVhQT1JUX1BS
SVZBVEUgdm9pZCBydW5SdW5Mb29wKCk7Ci0jZW5kaWYKIAogcHJpdmF0ZToKICAgICBIYXNoTWFw
PEpTUHJvbWlzZURlZmVycmVkKiwgVmVjdG9yPFN0cm9uZzxKU0NlbGw+Pj4gbV9wZW5kaW5nUHJv
bWlzZXM7CiAgICAgTG9jayBtX3Rhc2tMb2NrOwogICAgIGJvb2wgbV9ydW5UYXNrcyB7IHRydWUg
fTsKLSNpZiBVU0UoQ0YpCiAgICAgYm9vbCBtX3Nob3VsZFN0b3BSdW5Mb29wV2hlbkFsbFByb21p
c2VzRmluaXNoIHsgZmFsc2UgfTsKLSNlbmRpZgogICAgIFZlY3RvcjxzdGQ6OnR1cGxlPEpTUHJv
bWlzZURlZmVycmVkKiwgVGFzaz4+IG1fdGFza3M7CiAgICAgSGFzaE1hcDxKU1Byb21pc2VEZWZl
cnJlZCosIFZlY3RvcjxUYXNrPj4gbV9ibG9ja2VkVGFza3M7CiB9Owo=
</data>
<flag name="review"
          id="327434"
          type_id="1"
          status="+"
          setter="ysuzuki"
    />
          </attachment>
      

    </bug>

</bugzilla>