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

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

Issue 2393113002: ImageResource: Reset the encoded image size after receiving all data (Closed)
Patch Set: Address on yhirano's review Created 4 years, 2 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
426 if (data()) 426 if (data())
427 updateImageAndClearBuffer(); 427 updateImageAndClearBuffer();
428 } else { 428 } else {
429 updateImage(true); 429 updateImage(true);
430 // As encoded image data can be created from m_image (see 430 // As encoded image data can be created from m_image (see
431 // ImageResource::resourceBuffer(), we don't have to keep m_data. Let's 431 // ImageResource::resourceBuffer(), we don't have to keep m_data. Let's
432 // clear this. As for the lifetimes of m_image and m_data, see this 432 // clear this. As for the lifetimes of m_image and m_data, see this
433 // document: 433 // document:
434 // https://docs.google.com/document/d/1v0yTAZ6wkqX2U_M6BNIGUJpM1s0TIw1Vsqpxo L7aciY/edit?usp=sharing 434 // https://docs.google.com/document/d/1v0yTAZ6wkqX2U_M6BNIGUJpM1s0TIw1Vsqpxo L7aciY/edit?usp=sharing
435 clearData(); 435 clearData();
436 setEncodedSizeMemoryUsage(0);
436 } 437 }
437 Resource::finish(loadFinishTime); 438 Resource::finish(loadFinishTime);
438 } 439 }
439 440
440 void ImageResource::error(const ResourceError& error) { 441 void ImageResource::error(const ResourceError& error) {
441 if (m_multipartParser) 442 if (m_multipartParser)
442 m_multipartParser->cancel(); 443 m_multipartParser->cancel();
443 clear(); 444 clear();
444 Resource::error(error); 445 Resource::error(error);
445 notifyObservers(); 446 notifyObservers();
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
608 return response().serviceWorkerResponseType() != 609 return response().serviceWorkerResponseType() !=
609 WebServiceWorkerResponseTypeOpaque; 610 WebServiceWorkerResponseTypeOpaque;
610 if (!getImage()->currentFrameHasSingleSecurityOrigin()) 611 if (!getImage()->currentFrameHasSingleSecurityOrigin())
611 return false; 612 return false;
612 if (passesAccessControlCheck(securityOrigin)) 613 if (passesAccessControlCheck(securityOrigin))
613 return true; 614 return true;
614 return !securityOrigin->taintsCanvas(response().url()); 615 return !securityOrigin->taintsCanvas(response().url());
615 } 616 }
616 617
617 } // namespace blink 618 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698