[webkit-dev] Issue with calling javascript function from a external thread

Oliver Hunt oliver at apple.com
Fri Aug 10 20:40:01 PDT 2007


If you create a WebCore timer with an timeout of 0 that should allow  
you to perform a reasonably low latency action on the main thread.

--Oliver

On 10/08/2007, at 10:41 AM, Geoffrey Garen wrote:

> WebKit is not thread-safe. If you want to perform external  
> processing on a secondary thread, that's OK, but any calls into the  
> DOM will have to happen on the main thread.
>
> Geoff
>
> On Aug 10, 2007, at 3:00 AM, Julien Chaffraix wrote:
>
>> Hi all,
>>
>> I am trying to make a wrapper in C++ for the Ivy protocol for OWB  
>> (I think it could work on Webkit even though I have not tested)  
>> that could world entirely in javascript. Ivy is a light-weigh  
>> publish/subscribe protocol. It is based on callback functions that  
>> you call  when a regExp is seen on the bus.
>>
>> My main problem is that the thread that calls back functions is  
>> the thread that handles incoming transmissions, that is not one of  
>> Webkit threads.
>>
>> As my problem seems close to what is done in XMLHttpRequest, I  
>> have tried mecanisms used by that class and particularly reusing  
>> the code from JSAbstractEventListener::handleEvent to call my  
>> object. The callback seems to work but developing  a javascript  
>> application on top of that lead me to discover that some part of  
>> javascript are not working : for example, accessing some (not all)  
>> element with document.getElementById("...") does return "null" in  
>> the callback (but works in the Webkit threads) even though I could  
>> access it directly in C++ through Document::getElementById.
>>
>> I do not know much about what I have done wrong but I am eager to  
>> do the necessary debugging and testing.
>>
>> Maybe also my method is not the best so if someone has a better  
>> idea, he is more than welcome.
>>
>> Thanks,
>>
>> Julien
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo/webkit-dev
>
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev




More information about the webkit-dev mailing list