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

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

Issue 1925533003: High CPU and increased memory usage fix for high-res (GIF, WEBP...) animations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 m_image = nullptr; 186 m_image = nullptr;
187 setDecodedSize(0); 187 setDecodedSize(0);
188 } 188 }
189 189
190 void ImageResource::destroyDecodedDataIfPossible() 190 void ImageResource::destroyDecodedDataIfPossible()
191 { 191 {
192 if (!hasClientsOrObservers() && !isLoading() && (!m_image || (m_image->hasOn eRef() && m_image->isBitmapImage()))) { 192 if (!hasClientsOrObservers() && !isLoading() && (!m_image || (m_image->hasOn eRef() && m_image->isBitmapImage()))) {
193 m_image = nullptr; 193 m_image = nullptr;
194 setDecodedSize(0); 194 setDecodedSize(0);
195 } else if (m_image && !errorOccurred()) { 195 } else if (m_image && !errorOccurred()) {
196 m_image->destroyDecodedData(true); 196 m_image->destroyDecodedData();
197 } 197 }
198 } 198 }
199 199
200 void ImageResource::allClientsAndObserversRemoved() 200 void ImageResource::allClientsAndObserversRemoved()
201 { 201 {
202 if (m_image && !errorOccurred()) 202 if (m_image && !errorOccurred())
203 m_image->resetAnimation(); 203 m_image->resetAnimation();
204 if (m_multipartParser) 204 if (m_multipartParser)
205 m_multipartParser->cancel(); 205 m_multipartParser->cancel();
206 Resource::allClientsAndObserversRemoved(); 206 Resource::allClientsAndObserversRemoved();
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 if (response().wasFetchedViaServiceWorker()) 544 if (response().wasFetchedViaServiceWorker())
545 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 545 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
546 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 546 if (!getImage()->currentFrameHasSingleSecurityOrigin())
547 return false; 547 return false;
548 if (passesAccessControlCheck(securityOrigin)) 548 if (passesAccessControlCheck(securityOrigin))
549 return true; 549 return true;
550 return !securityOrigin->taintsCanvas(response().url()); 550 return !securityOrigin->taintsCanvas(response().url());
551 } 551 }
552 552
553 } // namespace blink 553 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698