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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
6 #define COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
7
8 #include "base/trace_event/memory_dump_manager.h"
9
10 #include "base/memory/ref_counted.h"
11 #include "base/memory/singleton.h"
12
13 namespace base {
14 class SingleThreadTaskRunner;
15 } // namespace base
16
17 namespace tracing {
18
19 class ChildTraceMessageFilter;
20
21 // This class is a simple proxy class between the MemoryDumpManager and the
22 // ChildTraceMessageFilter. It's only purpose is to adapt the lifetime of
23 // CTMF to the demands of MDM, which expects the delegate to be thread-safe
24 // and long lived. CTMF, instead, can be torn down during browser shutdown.
25 // This class is registered as MDM delegate in child processes and handles
26 // gracefully (and thread-safely) failures in the case of a lack of the CTMF.
27 class ChildMemoryDumpManagerDelegateImpl
28 : public base::trace_event::MemoryDumpManagerDelegate {
29 public:
30 static ChildMemoryDumpManagerDelegateImpl* GetInstance();
31
32 // base::trace_event::MemoryDumpManagerDelegate implementation.
33 void RequestGlobalMemoryDump(
34 const base::trace_event::MemoryDumpRequestArgs& args,
35 const base::trace_event::MemoryDumpCallback& callback) override;
36
37 void SetChildTraceMessageFilter(ChildTraceMessageFilter* ctmf);
38
39 private:
40 friend struct DefaultSingletonTraits<ChildMemoryDumpManagerDelegateImpl>;
41
42 ChildMemoryDumpManagerDelegateImpl();
43 ~ChildMemoryDumpManagerDelegateImpl() override;
44
45 ChildTraceMessageFilter* ctmf_; // Not owned.
46
47 // The SingleThreadTaskRunner where the |ctmf_| lives.
48 // It is NULL iff |cmtf_| is NULL.
49 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner_;
50
51 DISALLOW_COPY_AND_ASSIGN(ChildMemoryDumpManagerDelegateImpl);
52 };
53
54 } // namespace tracing
55
56 #endif // COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
OLDNEW
« 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