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

Unified Diff: components/tracing/process_metrics_memory_dump_manager.h

Issue 1417003003: [tracing] Dump child processes' memory metrics in browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Patch Set: dNits. Created 5 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 side-by-side diff with in-line comments
Download patch
Index: components/tracing/process_metrics_memory_dump_manager.h
diff --git a/components/tracing/process_metrics_memory_dump_manager.h b/components/tracing/process_metrics_memory_dump_manager.h
new file mode 100644
index 0000000000000000000000000000000000000000..9e138622c42e70994bf8867985512fb0fcb29f65
--- /dev/null
+++ b/components/tracing/process_metrics_memory_dump_manager.h
@@ -0,0 +1,45 @@
+// 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.
+
+#ifndef COMPONENTS_TRACING_PROCESS_METRICS_MEMORY_DUMP_MANAGER_H_
+#define COMPONENTS_TRACING_PROCESS_METRICS_MEMORY_DUMP_MANAGER_H_
+
+#include "base/containers/scoped_ptr_map.h"
+#include "base/macros.h"
+#include "base/memory/singleton.h"
+#include "base/process/process_handle.h"
+#include "components/tracing/tracing_export.h"
+
+namespace tracing {
+
+class ProcessMetricsMemoryDumpProvider;
+
+// Creates and registeres the ProcessMetricsMemoryDumpProvider for current
+// process and its children. Controls the lifetime of the providers.
+class TRACING_EXPORT ProcessMetricsMemoryDumpManager {
Primiano Tucci (use gerrit) 2015/11/17 10:44:12 hmm we have way too many managers in memory-infra.
ssid 2015/11/17 11:13:07 This would mean that there is a global std::map (n
ssid 2015/11/17 13:55:06 Done.
+ public:
+ static ProcessMetricsMemoryDumpManager* GetInstance();
+
+ // Pass base::kNullProcessHandle to register for current process.
+ void RegisterForProcess(base::ProcessHandle process);
+ void UnregisterForProcess(base::ProcessHandle process);
+
+ private:
+ friend struct base::DefaultSingletonTraits<ProcessMetricsMemoryDumpManager>;
+
+ using ProcessMetricsDumpProvidersMap =
+ base::ScopedPtrMap<base::ProcessHandle,
+ scoped_ptr<ProcessMetricsMemoryDumpProvider>>;
+
+ ProcessMetricsMemoryDumpManager();
+ ~ProcessMetricsMemoryDumpManager();
+
+ ProcessMetricsDumpProvidersMap process_metrics_providers_map_;
+
+ DISALLOW_COPY_AND_ASSIGN(ProcessMetricsMemoryDumpManager);
+};
+
+} // namespace tracing
+
+#endif // COMPONENTS_TRACING_PROCESS_METRICS_MEMORY_DUMP_MANAGER_H_

Powered by Google App Engine
This is Rietveld 408576698