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

Unified Diff: components/web_cache/browser/web_cache_manager.h

Issue 1283793004: [tracing] Add WebCache memory usage in Blink to chrome://tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unregister. Created 5 years, 4 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/browser/web_cache_manager.h
diff --git a/components/web_cache/browser/web_cache_manager.h b/components/web_cache/browser/web_cache_manager.h
index 0d2d3ffb644a6f05234b4e54a06a6390b3007e52..0aba07fa1821c7ea6e943cfa9905f8221298ad90 100644
--- a/components/web_cache/browser/web_cache_manager.h
+++ b/components/web_cache/browser/web_cache_manager.h
@@ -17,6 +17,7 @@
#include "base/gtest_prod_util.h"
#include "base/memory/weak_ptr.h"
#include "base/time/time.h"
+#include "base/trace_event/memory_dump_provider.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "third_party/WebKit/public/web/WebCache.h"
@@ -27,7 +28,8 @@ class PrefRegistrySimple;
namespace web_cache {
-class WebCacheManager : public content::NotificationObserver {
+class WebCacheManager : public content::NotificationObserver,
+ public base::trace_event::MemoryDumpProvider {
friend class WebCacheManagerTest;
FRIEND_TEST_ALL_PREFIXES(
WebCacheManagerTest,
@@ -98,6 +100,10 @@ class WebCacheManager : public content::NotificationObserver {
const content::NotificationSource& source,
const content::NotificationDetails& details) override;
+ // base::trace_event::MemoryDUmpProvider implementation.
+ bool OnMemoryDump(const base::trace_event::MemoryDumpArgs& args,
+ base::trace_event::ProcessMemoryDump* pmd) override;
+
// Gets the default global size limit. This interrogates system metrics to
// tune the default size to the current system.
static size_t GetDefaultGlobalSizeLimit();
@@ -217,6 +223,10 @@ class WebCacheManager : public content::NotificationObserver {
// Check to see if any active renderers have fallen inactive.
void FindInactiveRenderers();
+ // Helper method to dump the cache usage stats of given renderer.
+ void DumpUsageStats(int renderer_id,
+ base::trace_event::ProcessMemoryDump* pmd);
+
// The global size limit for all in-memory caches.
size_t global_size_limit_;

Powered by Google App Engine
This is Rietveld 408576698