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

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

Issue 2463283002: Replace prepareToSuspend() with onMemoryStateChange(SUSPENDED) (Closed)
Patch Set: Remove prepareToSuspend Created 4 years, 1 month 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, 2008, 2009, 2010, 2011 Apple Inc. All 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
7 rights reserved. 7 rights reserved.
8 8
9 This library is free software; you can redistribute it and/or 9 This library is free software; you can redistribute it and/or
10 modify it under the terms of the GNU Library General Public 10 modify it under the terms of the GNU Library General Public
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 ResourceCallback::callbackHandler().cancel(this); 842 ResourceCallback::callbackHandler().cancel(this);
843 843
844 // Prevent the case when there are clients waiting but no callback scheduled. 844 // Prevent the case when there are clients waiting but no callback scheduled.
845 DCHECK(m_clientsAwaitingCallback.isEmpty() || scheduled); 845 DCHECK(m_clientsAwaitingCallback.isEmpty() || scheduled);
846 } 846 }
847 847
848 void Resource::prune() { 848 void Resource::prune() {
849 destroyDecodedDataIfPossible(); 849 destroyDecodedDataIfPossible();
850 } 850 }
851 851
852 void Resource::prepareToSuspend() { 852 void Resource::onMemoryStateChange(MemoryState state) {
853 if (state != MemoryState::SUSPENDED)
854 return;
853 prune(); 855 prune();
854 if (!m_cacheHandler) 856 if (!m_cacheHandler)
855 return; 857 return;
856 m_cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); 858 m_cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally);
857 } 859 }
858 860
859 void Resource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, 861 void Resource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail,
860 WebProcessMemoryDump* memoryDump) const { 862 WebProcessMemoryDump* memoryDump) const {
861 static const size_t kMaxURLReportLength = 128; 863 static const size_t kMaxURLReportLength = 128;
862 static const int kMaxResourceClientToShowInMemoryInfra = 10; 864 static const int kMaxResourceClientToShowInMemoryInfra = 10;
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 case Resource::TextTrack: 1107 case Resource::TextTrack:
1106 case Resource::Media: 1108 case Resource::Media:
1107 case Resource::Manifest: 1109 case Resource::Manifest:
1108 return false; 1110 return false;
1109 } 1111 }
1110 NOTREACHED(); 1112 NOTREACHED();
1111 return false; 1113 return false;
1112 } 1114 }
1113 1115
1114 } // namespace blink 1116 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698