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

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: rebased Created 4 years, 6 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 9d49d113f60ecde90d37167e3f1fdeadbb0c09a3..516fed78f528dadcb49927b73ec2c0e43fcd3ecb 100644
--- a/third_party/WebKit/Source/core/fetch/ImageResource.cpp
+++ b/third_party/WebKit/Source/core/fetch/ImageResource.cpp
@@ -204,10 +204,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))
+ Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&ImageResource::doResetAnimation, WeakPersistentThisPointer<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