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

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

Issue 1369253002: Add Web Resources usage to chrome://tracing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Patch Set: Fixes. Created 5 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, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. 6 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 21 matching lines...) Expand all
32 #include "core/fetch/ResourceClientWalker.h" 32 #include "core/fetch/ResourceClientWalker.h"
33 #include "core/fetch/ResourceFetcher.h" 33 #include "core/fetch/ResourceFetcher.h"
34 #include "core/fetch/ResourceLoader.h" 34 #include "core/fetch/ResourceLoader.h"
35 #include "core/fetch/ResourcePtr.h" 35 #include "core/fetch/ResourcePtr.h"
36 #include "core/inspector/InspectorInstrumentation.h" 36 #include "core/inspector/InspectorInstrumentation.h"
37 #include "platform/Logging.h" 37 #include "platform/Logging.h"
38 #include "platform/SharedBuffer.h" 38 #include "platform/SharedBuffer.h"
39 #include "platform/TraceEvent.h" 39 #include "platform/TraceEvent.h"
40 #include "platform/weborigin/KURL.h" 40 #include "platform/weborigin/KURL.h"
41 #include "public/platform/Platform.h" 41 #include "public/platform/Platform.h"
42 #include "public/platform/WebProcessMemoryDump.h"
42 #include "wtf/CurrentTime.h" 43 #include "wtf/CurrentTime.h"
43 #include "wtf/MathExtras.h" 44 #include "wtf/MathExtras.h"
44 #include "wtf/StdLibExtras.h" 45 #include "wtf/StdLibExtras.h"
45 #include "wtf/Vector.h" 46 #include "wtf/Vector.h"
46 #include "wtf/text/CString.h" 47 #include "wtf/text/CString.h"
47 48
48 using namespace WTF; 49 using namespace WTF;
49 50
50 namespace blink { 51 namespace blink {
51 52
(...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 // Prevent the case when there are clients waiting but no callback scheduled . 711 // Prevent the case when there are clients waiting but no callback scheduled .
711 ASSERT(m_clientsAwaitingCallback.isEmpty() || scheduled); 712 ASSERT(m_clientsAwaitingCallback.isEmpty() || scheduled);
712 } 713 }
713 714
714 void Resource::prune() 715 void Resource::prune()
715 { 716 {
716 destroyDecodedDataIfPossible(); 717 destroyDecodedDataIfPossible();
717 unlock(); 718 unlock();
718 } 719 }
719 720
721 void Resource::onMemoryDump(WebProcessMemoryDump* memoryDump) const
722 {
723 const String dumpName = getMemoryDumpName();
724 WebMemoryAllocatorDump* dump = memoryDump->createMemoryAllocatorDump(dumpNam e);
725 dump->AddScalar("encoded_size", "bytes", m_encodedSize);
726 dump->AddScalar("decoded_size", "bytes", m_decodedSize);
727 if (canDelete()) {
728 dump->AddScalar("dead_size", "bytes", m_encodedSize);
729 } else {
730 dump->AddScalar("live_size", "bytes", m_encodedSize);
731 }
732
733 if (m_data) {
734 dump->AddScalar("purgeable_size", "bytes", isPurgeable() && !wasPurged() ? encodedSize() + overheadSize() : 0);
735 m_data->onMemoryDump(dumpName, memoryDump);
736 }
737
738 const String overheadName = dumpName + "/overhead";
Primiano Tucci (use gerrit) 2015/10/14 13:32:25 by looking at the trace I wonder if "metadata" wou
ssid 2015/10/21 12:42:57 Done.
739 WebMemoryAllocatorDump* overheadDump = memoryDump->createMemoryAllocatorDump (overheadName);
740 overheadDump->AddScalar("size", "bytes", overheadSize());
741 memoryDump->AddSuballocation(overheadDump->guid(), String(WTF::Partitions::k AllocatedObjectPoolName));
742 }
743
744 String Resource::getMemoryDumpName() const
745 {
746 return String::format("web_cache/%s_resources/%ld", resourceTypeToString(typ e(), options().initiatorInfo), m_identifier);
747 }
748
720 void Resource::setResourceToRevalidate(Resource* resource) 749 void Resource::setResourceToRevalidate(Resource* resource)
721 { 750 {
722 ASSERT(resource); 751 ASSERT(resource);
723 ASSERT(!m_resourceToRevalidate); 752 ASSERT(!m_resourceToRevalidate);
724 ASSERT(resource != this); 753 ASSERT(resource != this);
725 ASSERT(m_handlesToRevalidate.isEmpty()); 754 ASSERT(m_handlesToRevalidate.isEmpty());
726 ASSERT(resource->type() == type()); 755 ASSERT(resource->type() == type());
727 756
728 WTF_LOG(ResourceLoading, "Resource %p setResourceToRevalidate %p", this, res ource); 757 WTF_LOG(ResourceLoading, "Resource %p setResourceToRevalidate %p", this, res ource);
729 758
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
1108 return "ImportResource"; 1137 return "ImportResource";
1109 case Resource::Media: 1138 case Resource::Media:
1110 return "Media"; 1139 return "Media";
1111 } 1140 }
1112 ASSERT_NOT_REACHED(); 1141 ASSERT_NOT_REACHED();
1113 return "Unknown"; 1142 return "Unknown";
1114 } 1143 }
1115 #endif // !LOG_DISABLED 1144 #endif // !LOG_DISABLED
1116 1145
1117 } // namespace blink 1146 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/Resource.h ('k') | third_party/WebKit/Source/core/fetch/ScriptResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698