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

Side by Side Diff: components/tracing/child_memory_dump_manager_delegate_impl.h

Issue 1549993003: Switch to standard integer types in components/, part 4 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_ 5 #ifndef COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
6 #define COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_ 6 #define COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
7 7
8 #include "base/trace_event/memory_dump_manager.h" 8 #include "base/trace_event/memory_dump_manager.h"
9 9
10 #include <stdint.h>
11
12 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
11 #include "base/memory/singleton.h" 14 #include "base/memory/singleton.h"
12 #include "base/synchronization/lock.h" 15 #include "base/synchronization/lock.h"
13 #include "components/tracing/tracing_export.h" 16 #include "components/tracing/tracing_export.h"
14 17
15 namespace base { 18 namespace base {
16 class SingleThreadTaskRunner; 19 class SingleThreadTaskRunner;
17 } // namespace base 20 } // namespace base
18 21
19 namespace tracing { 22 namespace tracing {
20 23
21 class ChildTraceMessageFilter; 24 class ChildTraceMessageFilter;
22 25
23 // This class is a simple proxy class between the MemoryDumpManager and the 26 // This class is a simple proxy class between the MemoryDumpManager and the
24 // ChildTraceMessageFilter. It's only purpose is to adapt the lifetime of 27 // ChildTraceMessageFilter. It's only purpose is to adapt the lifetime of
25 // CTMF to the demands of MDM, which expects the delegate to be thread-safe 28 // CTMF to the demands of MDM, which expects the delegate to be thread-safe
26 // and long lived. CTMF, instead, can be torn down during browser shutdown. 29 // and long lived. CTMF, instead, can be torn down during browser shutdown.
27 // This class is registered as MDM delegate in child processes and handles 30 // This class is registered as MDM delegate in child processes and handles
28 // gracefully (and thread-safely) failures in the case of a lack of the CTMF. 31 // gracefully (and thread-safely) failures in the case of a lack of the CTMF.
29 class TRACING_EXPORT ChildMemoryDumpManagerDelegateImpl 32 class TRACING_EXPORT ChildMemoryDumpManagerDelegateImpl
30 : public base::trace_event::MemoryDumpManagerDelegate { 33 : public base::trace_event::MemoryDumpManagerDelegate {
31 public: 34 public:
32 static ChildMemoryDumpManagerDelegateImpl* GetInstance(); 35 static ChildMemoryDumpManagerDelegateImpl* GetInstance();
33 36
34 // base::trace_event::MemoryDumpManagerDelegate implementation. 37 // base::trace_event::MemoryDumpManagerDelegate implementation.
35 void RequestGlobalMemoryDump( 38 void RequestGlobalMemoryDump(
36 const base::trace_event::MemoryDumpRequestArgs& args, 39 const base::trace_event::MemoryDumpRequestArgs& args,
37 const base::trace_event::MemoryDumpCallback& callback) override; 40 const base::trace_event::MemoryDumpCallback& callback) override;
38 uint64 GetTracingProcessId() const override; 41 uint64_t GetTracingProcessId() const override;
39 42
40 void SetChildTraceMessageFilter(ChildTraceMessageFilter* ctmf); 43 void SetChildTraceMessageFilter(ChildTraceMessageFilter* ctmf);
41 44
42 // Pass kInvalidTracingProcessId to invalidate the id. 45 // Pass kInvalidTracingProcessId to invalidate the id.
43 void set_tracing_process_id(uint64 id) { 46 void set_tracing_process_id(uint64_t id) {
44 DCHECK(tracing_process_id_ == 47 DCHECK(tracing_process_id_ ==
45 base::trace_event::MemoryDumpManager::kInvalidTracingProcessId || 48 base::trace_event::MemoryDumpManager::kInvalidTracingProcessId ||
46 id == 49 id ==
47 base::trace_event::MemoryDumpManager::kInvalidTracingProcessId || 50 base::trace_event::MemoryDumpManager::kInvalidTracingProcessId ||
48 id == tracing_process_id_); 51 id == tracing_process_id_);
49 tracing_process_id_ = id; 52 tracing_process_id_ = id;
50 } 53 }
51 54
52 protected: 55 protected:
53 // Make CreateProcessDump() visible to ChildTraceMessageFilter. 56 // Make CreateProcessDump() visible to ChildTraceMessageFilter.
(...skipping 11 matching lines...) Expand all
65 // The SingleThreadTaskRunner where the |ctmf_| lives. 68 // The SingleThreadTaskRunner where the |ctmf_| lives.
66 // It is NULL iff |cmtf_| is NULL. 69 // It is NULL iff |cmtf_| is NULL.
67 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner_; 70 scoped_refptr<base::SingleThreadTaskRunner> ctmf_task_runner_;
68 71
69 // Protects from concurrent access to |ctmf_task_runner_| to allow 72 // Protects from concurrent access to |ctmf_task_runner_| to allow
70 // RequestGlobalMemoryDump to be called from arbitrary threads. 73 // RequestGlobalMemoryDump to be called from arbitrary threads.
71 base::Lock lock_; 74 base::Lock lock_;
72 75
73 // The unique id of the child process, created for tracing and is expected to 76 // The unique id of the child process, created for tracing and is expected to
74 // be valid only when tracing is enabled. 77 // be valid only when tracing is enabled.
75 uint64 tracing_process_id_; 78 uint64_t tracing_process_id_;
76 79
77 DISALLOW_COPY_AND_ASSIGN(ChildMemoryDumpManagerDelegateImpl); 80 DISALLOW_COPY_AND_ASSIGN(ChildMemoryDumpManagerDelegateImpl);
78 }; 81 };
79 82
80 } // namespace tracing 83 } // namespace tracing
81 84
82 #endif // COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_ 85 #endif // COMPONENTS_TRACING_CHILD_MEMORY_DUMP_MANAGER_DELEGATE_IMPL_H_
OLDNEW
« no previous file with comments | « components/toolbar/toolbar_model.h ('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