Chromium Code Reviews| 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_ |