[webkit-dev] WTF::callOnMainThread() and re-entrancy

Dmitry Titov dimich at chromium.org
Tue Mar 9 12:53:20 PST 2010


I've tried to post a timer if the scheduleDispatchFunctionsFromMainThread
comes on main thread - this fixes the test and it is a minimal change.

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's patch).

Dmitry

On Tue, Mar 9, 2010 at 12:37 PM, Drew Wilson <atwilson at google.com> wrote:

> That's a great idea:
>
>
> http://developer.apple.com/Mac/library/documentation/CoreFoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/c/tdef/CFRunLoopActivity
>
>
> <http://developer.apple.com/Mac/library/documentation/CoreFoundation/Reference/CFRunLoopObserverRef/Reference/reference.html#//apple_ref/c/tdef/CFRunLoopActivity>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.
> kCFRunLoopBeforeWaiting<http://reference.html#//apple_ref/doc/c_ref/kCFRunLoopBeforeWaiting>
> ).
>
> The only downside is that I'm not sure how to implement the "yield for UI
> events" behavior in dispatchFunctionsFromMainThread() if we'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.
>
> -atw
>
> On Tue, Mar 9, 2010 at 11:55 AM, Alexey Proskuryakov <ap at webkit.org>wrote:
>
>>
>> On 09.03.2010, at 11:51, Drew Wilson wrote:
>>
>>  That actually is an interesting idea - perhaps we could implement
>>> scheduleDispatchFunctionsFromMainThread() using a 0-delay timer in the case
>>> where it's called from the main thread...
>>>
>>
>> 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.
>>
>> - WBR, Alexey Proskuryakov
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20100309/f3542187/attachment.html>


More information about the webkit-dev mailing list