WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
160238
[Coordinated Graphics] Improve scheduling of tasks between threads in CoordinatedGraphicsScene
https://bugs.webkit.org/show_bug.cgi?id=160238
Summary
[Coordinated Graphics] Improve scheduling of tasks between threads in Coordin...
Carlos Garcia Campos
Reported
2016-07-27 04:11:50 PDT
Avoid scheduling tasks to the main thread if the scene is detached. Do not take references when not actually sending tasks to another threads. Use Function instead of std::function on dispatch methods. Remove purgeBackingStores that is actually never called.
Attachments
Patch
(19.76 KB, patch)
2016-07-27 04:18 PDT
,
Carlos Garcia Campos
mcatanzaro
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Carlos Garcia Campos
Comment 1
2016-07-27 04:18:14 PDT
Created
attachment 284684
[details]
Patch
Michael Catanzaro
Comment 2
2016-07-27 06:44:22 PDT
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?
> 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?
> Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:56 > + m_clientRunLoop.dispatch([protectedThis = makeRef(*this), function = WTFMove(function)] {
Ditto.
> Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:158 > + dispatchOnClientRunLoop([this] {
Why no protector?
> Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:622 > + dispatchOnMainThread([this] {
Ditto.
> Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:689 > + dispatchOnMainThread([this, layerID, offset] {
Ditto.
Carlos Garcia Campos
Comment 3
2016-07-27 06:51:53 PDT
(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.
Michael Catanzaro
Comment 4
2016-07-27 08:22:04 PDT
(In reply to
comment #3
)
> This is WTF::Function.
Why is WTF::Function preferred to std::function?
Carlos Garcia Campos
Comment 5
2016-07-27 08:44:30 PDT
(In reply to
comment #4
)
> (In reply to
comment #3
) > > This is WTF::Function. > > Why is WTF::Function preferred to std::function?
WTF::Function is non-copyable, so it's safer to use between threads and allows to capture things like Ref<>
Carlos Garcia Campos
Comment 6
2016-07-27 08:59:30 PDT
Committed
r203776
: <
http://trac.webkit.org/changeset/203776
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug