Chromium Code Reviews

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

Issue 2499263002: Add UMA to estimate deroppable memory usage of encoded data size in Resources (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff |
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 841 matching lines...)
852 852
853 void Resource::onMemoryStateChange(MemoryState state) { 853 void Resource::onMemoryStateChange(MemoryState state) {
854 if (state != MemoryState::SUSPENDED) 854 if (state != MemoryState::SUSPENDED)
855 return; 855 return;
856 prune(); 856 prune();
857 if (!m_cacheHandler) 857 if (!m_cacheHandler)
858 return; 858 return;
859 m_cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally); 859 m_cacheHandler->clearCachedMetadata(CachedMetadataHandler::CacheLocally);
860 } 860 }
861 861
862 bool Resource::isReloadable() const {
863 ResourceClientWalker<ResourceClient> w(m_finishedClients);
864 while (ResourceClient* c = w.next()) {
865 if (!c->isReloadable())
866 return false;
867 }
868 return true;
869 }
870
862 void Resource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, 871 void Resource::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail,
863 WebProcessMemoryDump* memoryDump) const { 872 WebProcessMemoryDump* memoryDump) const {
864 static const size_t kMaxURLReportLength = 128; 873 static const size_t kMaxURLReportLength = 128;
865 static const int kMaxResourceClientToShowInMemoryInfra = 10; 874 static const int kMaxResourceClientToShowInMemoryInfra = 10;
866 875
867 const String dumpName = getMemoryDumpName(); 876 const String dumpName = getMemoryDumpName();
868 WebMemoryAllocatorDump* dump = 877 WebMemoryAllocatorDump* dump =
869 memoryDump->createMemoryAllocatorDump(dumpName); 878 memoryDump->createMemoryAllocatorDump(dumpName);
870 dump->addScalar("encoded_size", "bytes", m_encodedSizeMemoryUsage); 879 dump->addScalar("encoded_size", "bytes", m_encodedSizeMemoryUsage);
871 if (hasClientsOrObservers()) 880 if (hasClientsOrObservers())
(...skipping 236 matching lines...)
1108 case Resource::TextTrack: 1117 case Resource::TextTrack:
1109 case Resource::Media: 1118 case Resource::Media:
1110 case Resource::Manifest: 1119 case Resource::Manifest:
1111 return false; 1120 return false;
1112 } 1121 }
1113 NOTREACHED(); 1122 NOTREACHED();
1114 return false; 1123 return false;
1115 } 1124 }
1116 1125
1117 } // namespace blink 1126 } // namespace blink
OLDNEW

Powered by Google App Engine