Chromium Code Reviews| 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(); |