[haiku-webkit-commits] Re: r241 - webkit/trunk/WebCore/platform/haiku

  • From: Stephan Assmus <superstippi@xxxxxx>
  • To: haiku-webkit-commits@xxxxxxxxxxxxx
  • Date: Sun, 28 Feb 2010 10:14:51 +0100

On 2010-02-28 at 06:12:16 [+0100], Ryan Leavengood <leavengood@xxxxxxxxx> 
wrote:
> On Sat, Feb 27, 2010 at 7:00 PM, Stephan Assmus <superstippi@xxxxxx> wrote:
> >
> > One problem with your solution, is that it runs the timer function in the
> > wrong thread. I haven't looked closely enough if that was the only 
> > problem,
> > or if there was another reason why Andrea rewrote it. That I am using a
> > different thread as well is just for improved precision. Otherwise it's
> > equivalent to the BMessageRunner version.
> 
> Yes I see that I was calling the timer function from the new thread,
> which is not how it should work obviously.
> 
> I would like to learn from my mistakes, though in this case it may
> have just been not understanding how the WebKit timer was supposed to
> work. While threading certainly can be difficult, I think I find it
> even more difficult trying to deal with a primarily single-threaded
> library like WebKit in a multi-threaded environment like Haiku.

Very true. After getting the HaikuLauncher to build, when I started it the 
first times, I ran into all sorts of asserts, because functions were not 
executed in the main thread. I guess those asserts didn't exist back when 
you did the initial port. But they were very helpful for me to resolve the 
issues and understand how things need to work.

Which thread is allowed to run which code will make any of our WebKit API 
functions that return values to the caller very difficult. Right now, there 
is a strict locking order -> the application thread may lock the window 
threads, but never the other way around. We could design our WebKit API 
around a BMessage protocol. That would make it a bit less handy to use, but 
perhaps more clean. Then you would call BWebPage->SendPageSource(), and 
receive the result asynchronously in a BMessage.

Best regards,
-Stephan

Other related posts: