RESOLVED FIXED 183161
[Web Animations] Correct implementation of pending tasks and promises
https://bugs.webkit.org/show_bug.cgi?id=183161
Summary [Web Animations] Correct implementation of pending tasks and promises
Antoine Quint
Reported 2018-02-27 05:09:05 PST
[Web Animations] Correct implementation of pending tasks and promises
Attachments
Patch (39.82 KB, patch)
2018-02-27 05:25 PST, Antoine Quint
no flags
Patch (39.79 KB, patch)
2018-02-27 11:45 PST, Antoine Quint
no flags
Antoine Quint
Comment 1 2018-02-27 05:25:06 PST
Dean Jackson
Comment 2 2018-02-27 11:24:05 PST
Comment on attachment 334685 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=334685&action=review > Source/WebCore/animation/WebAnimation.cpp:942 > + document->postTask([this] (auto&) { > + if (hasPendingPauseTask() && m_timeline) > + runPendingPauseTask(); > + }); I don't understand the build errors here, sorry. You could try [protectedThis = makeRef(*this)] and then protectedThis->hasPendingPauseTask() > Source/WebCore/animation/WebAnimation.h:149 > + UniqueRef<ReadyPromise> m_readyPromise; > + UniqueRef<FinishedPromise> m_finishedPromise; I didn't really understand the message from the changelog about this. Why store refs, instead of the promises directly? Then instead of clear(), you'd call clear and assign a new instance.
Chris Dumez
Comment 3 2018-02-27 11:28:47 PST
Comment on attachment 334685 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=334685&action=review > Source/WebCore/animation/WebAnimation.cpp:952 > + if (hasPendingPlayTask() && m_timeline) Use this->hasPendingPlayTask() to make gcc happy.
Chris Dumez
Comment 4 2018-02-27 11:36:53 PST
Comment on attachment 334685 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=334685&action=review > Source/WebCore/animation/WebAnimation.cpp:939 > + document->postTask([this] (auto&) { What guarantees |this| is still alive when the task is executed asynchronously? We usually capture protectedThis = makeRef(*this) to avoid this problem. >> Source/WebCore/animation/WebAnimation.cpp:942 >> + }); > > I don't understand the build errors here, sorry. You could try [protectedThis = makeRef(*this)] and then protectedThis->hasPendingPauseTask() gcc just needs some explicit this-> to make it happy. > Source/WebCore/animation/WebAnimation.cpp:949 > + if (is<DocumentTimeline>(m_timeline)) { This could be merged with the previous condition (is<>() does a null check when passed in a pointer type. if (hasPendingPlayTask() && is<DocumentTimeline>(m_timeline)) > Source/WebCore/animation/WebAnimation.cpp:951 > + document->postTask([this] (auto&) { Ditto about lifetime.
Antoine Quint
Comment 5 2018-02-27 11:45:57 PST
Antoine Quint
Comment 6 2018-02-27 13:05:12 PST
Radar WebKit Bug Importer
Comment 7 2018-02-27 13:06:27 PST
Note You need to log in before you can comment on or make changes to this bug.