Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(243)

Unified Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 2004263003: Delay resetting image animation, if possible. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: expand the comment Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/fetch/ImageResource.cpp
diff --git a/third_party/WebKit/Source/core/fetch/ImageResource.cpp b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
index 81db13640f8150ed4554bcf6542607cb4925b564..956fc6db413a3f5e040b309bc22dc98338aad73a 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -206,10 +206,23 @@ void ImageResource::destroyDecodedDataIfPossible()
}
}
-void ImageResource::allClientsAndObserversRemoved()
+void ImageResource::doResetAnimation()
{
- if (m_image && !errorOccurred())
+ if (m_image)
m_image->resetAnimation();
+}
+
+void ImageResource::allClientsAndObserversRemoved()
+{
+ if (m_image && !errorOccurred()) {
+ // If possible, delay the resetting until back at the event loop.
+ // Doing so after a conservative GC prevents resetAnimation() from
+ // upsetting ongoing animation updates (crbug.com/613709)
+ if (!ThreadHeap::willObjectBeLazilySwept(this))
haraken 2016/05/24 15:40:54 Hmm, I'm not really happy about using ThreadHeap::
sof 2016/05/24 15:47:20 As this method will be called by another object's
+ Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&ImageResource::doResetAnimation, CrossThreadWeakPersistentThisPointer<ImageResource>(this)));
+ else
+ m_image->resetAnimation();
+ }
if (m_multipartParser)
m_multipartParser->cancel();
Resource::allClientsAndObserversRemoved();
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698