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

Unified Diff: components/tracing/child_memory_dump_manager_delegate_impl.h

Issue 1039963003: [tracing] child-process-side impl for inter-process memory dumps (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ipc_3_messages
Patch Set: Add temporary workaround for crbug.com/474973 Created 5 years, 8 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
« no previous file with comments | « components/tracing/BUILD.gn ('k') | components/tracing/child_memory_dump_manager_delegate_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/tracing/child_memory_dump_manager_delegate_impl.h
diff --git a/components/tracing/child_memory_dump_manager_delegate_impl.h b/components/tracing/child_memory_dump_manager_delegate_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..03069537daa334b65ae98fade8265780819d9258
--- /dev/null
+++ b/components/tracing/child_memory_dump_manager_delegate_impl.h
@@ -0,0 +1,56 @@
+// 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_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
+#define COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
+
+#include "base/trace_event/memory_dump_manager.h"
+
+#include "base/memory/ref_counted.h"
+#include "base/memory/singleton.h"
+
+namespace base {
+class SingleThreadTaskRunner;
+} // namespace base
+
+namespace tracing {
+
+class ChildTraceMessageFilter;
+
+// This class is a simple proxy class between the MemoryDumpManager and the
+// ChildTraceMessageFilter. It's only purpose is to adapt the lifetime of
+// CTMF to the demands of MDM, which expects the delegate to be thread-safe
+// and long lived. CTMF, instead, can be torn down during browser shutdown.
+// This class is registered as MDM delegate in child processes and handles
+// gracefully (and thread-safely) failures in the case of a lack of the CTMF.
+class ChildMemoryDumpManagerDelegateImpl
+ : public base::trace_event::MemoryDumpManagerDelegate {
+ public:
+ static ChildMemoryDumpManagerDelegateImpl* GetInstance();
+
+ // base::trace_event::MemoryDumpManagerDelegate implementation.
+ void RequestGlobalMemoryDump(
+ const base::trace_event::MemoryDumpRequestArgs& args,
+ const base::trace_event::MemoryDumpCallback& callback) override;
+
+ void SetChildTraceMessageFilter(ChildTraceMessageFilter* ctmf);
+
+ private:
+ friend struct DefaultSingletonTraits<ChildMemoryDumpManagerDelegateImpl>;
+
+ ChildMemoryDumpManagerDelegateImpl();
+ ~ChildMemoryDumpManagerDelegateImpl() override;
+
+ ChildTraceMessageFilter* ctmf_; // Not owned.
+
+ // The SingleThreadTaskRunner where the |ctmf_| lives.
+ // It is NULL iff |cmtf_| is NULL.
+ scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChildMemoryDumpManagerDelegateImpl);
+};
+
+} // namespace tracing
+
+#endif // COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
« no previous file with comments | « components/tracing/BUILD.gn ('k') | components/tracing/child_memory_dump_manager_delegate_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698