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

Geoffrey Garen ggaren at apple.com
Fri Aug 10 10:41:14 PDT 2007


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




More information about the webkit-dev mailing list