[Webkit-unassigned] [Bug 160238] [Coordinated Graphics] Improve scheduling of tasks between threads in CoordinatedGraphicsScene

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Jul 27 06:51:53 PDT 2016


https://bugs.webkit.org/show_bug.cgi?id=160238

--- Comment #3 from Carlos Garcia Campos <cgarcia at igalia.com> ---
(In reply to comment #2)
> Comment on attachment 284684 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=284684&action=review
> 
> Questions
> 
> > Source/WebKit2/ChangeLog:12
> > +         - Use Function instead of std::function on dispatch methods.
> 
> Why, just to use our thing instead of the standard one? Is there an
> advantage to WTF::Function?

This is WTF::Function.

> > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:44
> > +    RunLoop::main().dispatch([protectedThis = makeRef(*this), function = WTFMove(function)] {
> 
> Why is this correct? We don't use |this| inside the lambda, so why the need
> to keep it alive? If the ref is really needed then it should be handled
> inside |function|, right?

Just to ensure the scene is alive, that's why it's called protectedThis. Before this patch all caller do that themselves, and in some cases unnecessarily, because we only need it when scheduling to another thread. Now it's done here to simplify the callers.

> > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:56
> > +    m_clientRunLoop.dispatch([protectedThis = makeRef(*this), function = WTFMove(function)] {
> 
> Ditto.

Ditto.

> > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:158
> > +    dispatchOnClientRunLoop([this] {
> 
> Why no protector?

Because dispatchOnClientRunLoop is protecting this only when actually needed.

> > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:622
> > +    dispatchOnMainThread([this] {
> 
> Ditto.
> 
> > Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:689
> > +    dispatchOnMainThread([this, layerID, offset] {
> 
> Ditto.

Ditto.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-unassigned/attachments/20160727/e2a90c7e/attachment.html>


More information about the webkit-unassigned mailing list