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

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

Issue 2202473002: DO NOT COMMIT: Experimental removal of encoded image data Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: (rebase) Created 4 years, 3 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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 } 201 }
202 202
203 void ImageResource::destroyDecodedDataIfPossible() 203 void ImageResource::destroyDecodedDataIfPossible()
204 { 204 {
205 if (!m_image) 205 if (!m_image)
206 return; 206 return;
207 CHECK(!errorOccurred()); 207 CHECK(!errorOccurred());
208 m_image->destroyDecodedData(); 208 m_image->destroyDecodedData();
209 } 209 }
210 210
211 void ImageResource::myPrune()
212 {
213 if (!m_image)
214 return;
215 if (hasCacheControlNoStoreHeader())
216 return;
217 if (getStatus() != Resource::Cached)
218 return;
219 // Don't call clearImage(). Observers should be kept.
220 m_image->clear();
221 }
222
211 void ImageResource::doResetAnimation() 223 void ImageResource::doResetAnimation()
212 { 224 {
213 if (m_image) 225 if (m_image)
214 m_image->resetAnimation(); 226 m_image->resetAnimation();
215 } 227 }
216 228
217 void ImageResource::allClientsAndObserversRemoved() 229 void ImageResource::allClientsAndObserversRemoved()
218 { 230 {
219 if (m_image) { 231 if (m_image) {
220 CHECK(!errorOccurred()); 232 CHECK(!errorOccurred());
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 fetcher->startLoad(this); 553 fetcher->startLoad(this);
542 } 554 }
543 555
544 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect ) 556 void ImageResource::changedInRect(const blink::Image* image, const IntRect& rect )
545 { 557 {
546 if (!image || image != m_image) 558 if (!image || image != m_image)
547 return; 559 return;
548 notifyObservers(&rect); 560 notifyObservers(&rect);
549 } 561 }
550 562
563 void ImageResource::requireReloading(const blink::Image* image)
564 {
565 for (auto* observer : m_finishedObservers.asVector()) {
566 observer->requireReloading();
567 }
568 }
569
551 void ImageResource::onePartInMultipartReceived(const ResourceResponse& response) 570 void ImageResource::onePartInMultipartReceived(const ResourceResponse& response)
552 { 571 {
553 ASSERT(m_multipartParser); 572 ASSERT(m_multipartParser);
554 573
555 setResponse(response); 574 setResponse(response);
556 if (m_multipartParsingState == MultipartParsingState::WaitingForFirstPart) { 575 if (m_multipartParsingState == MultipartParsingState::WaitingForFirstPart) {
557 // We have nothing to do because we don't have any data. 576 // We have nothing to do because we don't have any data.
558 m_multipartParsingState = MultipartParsingState::ParsingFirstPart; 577 m_multipartParsingState = MultipartParsingState::ParsingFirstPart;
559 return; 578 return;
560 } 579 }
(...skipping 24 matching lines...) Expand all
585 if (response().wasFetchedViaServiceWorker()) 604 if (response().wasFetchedViaServiceWorker())
586 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque; 605 return response().serviceWorkerResponseType() != WebServiceWorkerRespons eTypeOpaque;
587 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 606 if (!getImage()->currentFrameHasSingleSecurityOrigin())
588 return false; 607 return false;
589 if (passesAccessControlCheck(securityOrigin)) 608 if (passesAccessControlCheck(securityOrigin))
590 return true; 609 return true;
591 return !securityOrigin->taintsCanvas(response().url()); 610 return !securityOrigin->taintsCanvas(response().url());
592 } 611 }
593 612
594 } // namespace blink 613 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/ImageResource.h ('k') | third_party/WebKit/Source/core/fetch/ImageResourceObserver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698