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

Unified Diff: components/web_cache/renderer/web_cache_memory_dump_provider.cc

Issue 1304073006: Revert of Add WebCache memory usage in Blink to chrome://tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@discardable_fix
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/web_cache/renderer/web_cache_memory_dump_provider.cc
diff --git a/components/web_cache/renderer/web_cache_memory_dump_provider.cc b/components/web_cache/renderer/web_cache_memory_dump_provider.cc
deleted file mode 100644
index f5f31b85bef22bfb5e0b70b8dba559123bb827f3..0000000000000000000000000000000000000000
--- a/components/web_cache/renderer/web_cache_memory_dump_provider.cc
+++ /dev/null
@@ -1,89 +0,0 @@
-// Copyright 2015 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "components/web_cache/renderer/web_cache_memory_dump_provider.h"
-
-#include "base/trace_event/memory_allocator_dump.h"
-#include "base/trace_event/memory_dump_manager.h"
-#include "base/trace_event/process_memory_dump.h"
-#include "third_party/WebKit/public/web/WebCache.h"
-
-namespace web_cache {
-namespace {
-
-base::LazyInstance<WebCacheMemoryDumpProvider>::Leaky g_wcmdp_instance =
- LAZY_INSTANCE_INITIALIZER;
-
-void DumpResourceStats(const blink::WebCache::ResourceTypeStat& resource_stat,
- const std::string& resource_name,
- base::trace_event::ProcessMemoryDump* pmd) {
- base::trace_event::MemoryAllocatorDump* allocator_dump =
- pmd->CreateAllocatorDump(resource_name);
- allocator_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- resource_stat.size);
- allocator_dump->AddScalar(
- base::trace_event::MemoryAllocatorDump::kNameObjectsCount,
- base::trace_event::MemoryAllocatorDump::kUnitsObjects,
- resource_stat.count);
- allocator_dump->AddScalar("live_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- resource_stat.liveSize);
- allocator_dump->AddScalar("decoded_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- resource_stat.decodedSize);
- allocator_dump->AddScalar("purged_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- resource_stat.purgedSize);
- allocator_dump->AddScalar("purgeable_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- resource_stat.purgeableSize);
-}
-
-} // namespace
-
-// static
-WebCacheMemoryDumpProvider* WebCacheMemoryDumpProvider::GetInstance() {
- return g_wcmdp_instance.Pointer();
-}
-
-WebCacheMemoryDumpProvider::WebCacheMemoryDumpProvider() {}
-
-WebCacheMemoryDumpProvider::~WebCacheMemoryDumpProvider() {}
-
-bool WebCacheMemoryDumpProvider::OnMemoryDump(
- const base::trace_event::MemoryDumpArgs& args,
- base::trace_event::ProcessMemoryDump* pmd) {
- blink::WebCache::UsageStats memory_stats;
- blink::WebCache::getUsageStats(&memory_stats);
-
- const std::string dump_name("web_cache");
- base::trace_event::MemoryAllocatorDump* allocator_dump =
- pmd->CreateAllocatorDump(dump_name);
-
- allocator_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- memory_stats.liveSize + memory_stats.deadSize);
- allocator_dump->AddScalar("live_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- memory_stats.liveSize);
- allocator_dump->AddScalar("dead_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
- memory_stats.deadSize);
-
- blink::WebCache::ResourceTypeStats resource_stats;
- blink::WebCache::getResourceTypeStats(&resource_stats);
- DumpResourceStats(resource_stats.images, dump_name + "/images", pmd);
- DumpResourceStats(resource_stats.cssStyleSheets,
- dump_name + "/css_style_sheets", pmd);
- DumpResourceStats(resource_stats.scripts, dump_name + "/scripts", pmd);
- DumpResourceStats(resource_stats.xslStyleSheets,
- dump_name + "/xsl_style_sheets", pmd);
- DumpResourceStats(resource_stats.fonts, dump_name + "/fonts", pmd);
- DumpResourceStats(resource_stats.other, dump_name + "/other", pmd);
-
- return true;
-}
-
-} // namespace web_cache

Powered by Google App Engine
This is Rietveld 408576698