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

Side by Side Diff: third_party/WebKit/Source/core/fetch/ImageResource.cpp

Issue 2176603002: Simplify the condition for destroyDecodedData() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (rebase) Created 4 years, 4 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 | « no previous file | 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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void ImageResource::destroyDecodedDataForFailedRevalidation() 202 void ImageResource::destroyDecodedDataForFailedRevalidation()
203 { 203 {
204 clearImage(); 204 clearImage();
205 setDecodedSize(0); 205 setDecodedSize(0);
206 } 206 }
207 207
208 void ImageResource::destroyDecodedDataIfPossible() 208 void ImageResource::destroyDecodedDataIfPossible()
209 { 209 {
210 if (!m_image) 210 if (!m_image)
211 return; 211 return;
212 if ((!hasClientsOrObservers() && !isLoading() && m_image->hasOneRef() && m_i mage->isBitmapImage()) || !errorOccurred()) 212 CHECK(!errorOccurred());
213 m_image->destroyDecodedData(); 213 m_image->destroyDecodedData();
214 } 214 }
215 215
216 void ImageResource::doResetAnimation() 216 void ImageResource::doResetAnimation()
217 { 217 {
218 if (m_image) 218 if (m_image)
219 m_image->resetAnimation(); 219 m_image->resetAnimation();
220 } 220 }
221 221
222 void ImageResource::allClientsAndObserversRemoved() 222 void ImageResource::allClientsAndObserversRemoved()
223 { 223 {
224 if (m_image && !errorOccurred()) { 224 if (m_image) {
225 CHECK(!errorOccurred());
225 // If possible, delay the resetting until back at the event loop. 226 // If possible, delay the resetting until back at the event loop.
226 // Doing so after a conservative GC prevents resetAnimation() from 227 // Doing so after a conservative GC prevents resetAnimation() from
227 // upsetting ongoing animation updates (crbug.com/613709) 228 // upsetting ongoing animation updates (crbug.com/613709)
228 if (!ThreadHeap::willObjectBeLazilySwept(this)) 229 if (!ThreadHeap::willObjectBeLazilySwept(this))
229 Platform::current()->currentThread()->getWebTaskRunner()->postTask(B LINK_FROM_HERE, WTF::bind(&ImageResource::doResetAnimation, wrapWeakPersistent(t his))); 230 Platform::current()->currentThread()->getWebTaskRunner()->postTask(B LINK_FROM_HERE, WTF::bind(&ImageResource::doResetAnimation, wrapWeakPersistent(t his)));
230 else 231 else
231 m_image->resetAnimation(); 232 m_image->resetAnimation();
232 } 233 }
233 if (m_multipartParser) 234 if (m_multipartParser)
234 m_multipartParser->cancel(); 235 m_multipartParser->cancel();
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
593 if (response().wasFetchedViaServiceWorker()) 594 if (response().wasFetchedViaServiceWorker())
594 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 595 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
595 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 596 if (!getImage()->currentFrameHasSingleSecurityOrigin())
596 return false; 597 return false;
597 if (passesAccessControlCheck(securityOrigin)) 598 if (passesAccessControlCheck(securityOrigin))
598 return true; 599 return true;
599 return !securityOrigin->taintsCanvas(response().url()); 600 return !securityOrigin->taintsCanvas(response().url());
600 } 601 }
601 602
602 } // namespace blink 603 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698