Yeah, that seems to be the least invasive.<div><br></div><div>And we&#39;re already confident that creating a zero-delay timer won&#39;t cause event source starvation, since that&#39;s how postTask() used to work.</div><div>
<br></div><div>-atw<br><br><div class="gmail_quote">On Tue, Mar 9, 2010 at 12:53 PM, Dmitry Titov <span dir="ltr">&lt;<a href="mailto:dimich@chromium.org">dimich@chromium.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I&#39;ve tried to post a timer if the <span style="font-family:arial, sans-serif;font-size:13px;border-collapse:collapse">scheduleDispatchFunctionsFromMainThread comes on main thread - this fixes the test and it is a minimal change.</span><div>

<font face="arial, sans-serif"><span style="border-collapse:collapse"><br></span></font></div><div><font face="arial, sans-serif"><span style="border-collapse:collapse">Drew, let me know if you want to dig deeper in CFRunLoopObserver, otherwise I could whip up a patch (post a timer from main thread + postTask change from Dumi&#39;s patch).</span></font></div>

<div><font face="arial, sans-serif"><span style="border-collapse:collapse"><br></span></font></div><div><font color="#888888"><font face="arial, sans-serif"><span style="border-collapse:collapse">Dmitry<br>
</span></font></font><div><div></div><div class="h5"><br><div class="gmail_quote">On Tue, Mar 9, 2010 at 12:37 PM, Drew Wilson <span dir="ltr">&lt;<a href="mailto:atwilson@google.com" target="_blank">atwilson@google.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That&#39;s a great idea:<div><br></div><div><a href="http://developer.apple.com/Mac/library/documentation/CoreFoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/c/tdef/CFRunLoopActivity" target="_blank">http://developer.apple.com/Mac/library/documentation/CoreFoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/c/tdef/CFRunLoopActivity</a></div>


<div><br></div><div><a href="http://developer.apple.com/Mac/library/documentation/CoreFoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/c/tdef/CFRunLoopActivity" target="_blank"></a>This gives us lots of places to hook. scheduleDispatchFunctionsFromMainThread() could be a no-op on the mac, if we just always invoke dispatchFunctionsFromMainThread() at a specified point in the loop (e.g.<span style="font-family:Menlo, Monaco, Courier, Consolas, monospace;font-size:11px;white-space:pre"> <a href="http://reference.html#//apple_ref/doc/c_ref/kCFRunLoopBeforeWaiting" style="color:rgb(0, 51, 102);text-decoration:none" target="_blank">kCFRunLoopBeforeWaiting</a>).</span><br>


<br></div><div>The only downside is that I&#39;m not sure how to implement the &quot;yield for UI events&quot; behavior in dispatchFunctionsFromMainThread() if we&#39;re calling this from an observer - we actually need to have some kind of event generated to make sure we wake up. Maybe we could use scheduleDispatchFunctionsFromMainThread() to fire an event to make sure we have something to process, but actually do the processing from within the observer.</div>


<div><br></div><div>-atw</div><div><div></div><div><div><br><div class="gmail_quote">On Tue, Mar 9, 2010 at 11:55 AM, Alexey Proskuryakov <span dir="ltr">&lt;<a href="mailto:ap@webkit.org" target="_blank">ap@webkit.org</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><br>
On 09.03.2010, at 11:51, Drew Wilson wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
That actually is an interesting idea - perhaps we could implement scheduleDispatchFunctionsFromMainThread() using a 0-delay timer in the case where it&#39;s called from the main thread...<br>
</blockquote>
<br></div>
As an unsubstantiated idea, we could also consider using a run loop observer. These can be set to fire at well defined points of run loop execution.<br>
<br>
- WBR, Alexey Proskuryakov<br>
<br>
</blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div>
</blockquote></div><br></div>