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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org) 3 Copyright (C) 2001 Dirk Mueller (mueller@kde.org)
4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org) 4 Copyright (C) 2002 Waldo Bastian (bastian@kde.org)
5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 5 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 void ImageResource::destroyDecodedDataIfPossible() 197 void ImageResource::destroyDecodedDataIfPossible()
198 { 198 {
199 if (!hasClientsOrObservers() && !isLoading() && (!m_image || (m_image->hasOn eRef() && m_image->isBitmapImage()))) { 199 if (!hasClientsOrObservers() && !isLoading() && (!m_image || (m_image->hasOn eRef() && m_image->isBitmapImage()))) {
200 m_image = nullptr; 200 m_image = nullptr;
201 setDecodedSize(0); 201 setDecodedSize(0);
202 } else if (m_image && !errorOccurred()) { 202 } else if (m_image && !errorOccurred()) {
203 m_image->destroyDecodedData(); 203 m_image->destroyDecodedData();
204 } 204 }
205 } 205 }
206 206
207 void ImageResource::doResetAnimation()
208 {
209 if (m_image)
210 m_image->resetAnimation();
211 }
212
207 void ImageResource::allClientsAndObserversRemoved() 213 void ImageResource::allClientsAndObserversRemoved()
208 { 214 {
209 if (m_image && !errorOccurred()) 215 if (m_image && !errorOccurred()) {
210 m_image->resetAnimation(); 216 // If possible, delay the resetting until back at the event loop.
217 // Doing so after a conservative GC prevents resetAnimation() from
218 // upsetting ongoing animation updates (crbug.com/613709)
219 if (!ThreadHeap::willObjectBeLazilySwept(this))
220 Platform::current()->currentThread()->getWebTaskRunner()->postTask(B LINK_FROM_HERE, bind(&ImageResource::doResetAnimation, WeakPersistentThisPointer <ImageResource>(this)));
221 else
222 m_image->resetAnimation();
223 }
211 if (m_multipartParser) 224 if (m_multipartParser)
212 m_multipartParser->cancel(); 225 m_multipartParser->cancel();
213 Resource::allClientsAndObserversRemoved(); 226 Resource::allClientsAndObserversRemoved();
214 } 227 }
215 228
216 void ImageResource::appendData(const char* data, size_t length) 229 void ImageResource::appendData(const char* data, size_t length)
217 { 230 {
218 if (m_multipartParser) { 231 if (m_multipartParser) {
219 m_multipartParser->appendData(data, length); 232 m_multipartParser->appendData(data, length);
220 } else { 233 } else {
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 if (response().wasFetchedViaServiceWorker()) 564 if (response().wasFetchedViaServiceWorker())
552 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 565 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
553 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 566 if (!getImage()->currentFrameHasSingleSecurityOrigin())
554 return false; 567 return false;
555 if (passesAccessControlCheck(securityOrigin)) 568 if (passesAccessControlCheck(securityOrigin))
556 return true; 569 return true;
557 return !securityOrigin->taintsCanvas(response().url()); 570 return !securityOrigin->taintsCanvas(response().url());
558 } 571 }
559 572
560 } // namespace blink 573 } // namespace blink
OLDNEW
« 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