OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ |
6 #define BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 | 10 |
| 11 #include "base/base_export.h" |
11 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
12 #include "base/trace_event/memory_dump_provider.h" | 13 #include "base/trace_event/memory_dump_provider.h" |
13 | 14 |
14 namespace base { | 15 namespace base { |
15 | 16 |
16 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
17 | 18 |
18 namespace trace_event { | 19 namespace trace_event { |
19 | 20 |
20 // Wraps a MemoryDumpProvider (MDP), which is registered via | 21 // Wraps a MemoryDumpProvider (MDP), which is registered via |
(...skipping 13 matching lines...) Expand all Loading... |
34 // MDM's |dump_providers_| list. | 35 // MDM's |dump_providers_| list. |
35 // - In most cases, the only refptr (in the |dump_providers_| list) is destroyed | 36 // - In most cases, the only refptr (in the |dump_providers_| list) is destroyed |
36 // by MDM::UnregisterDumpProvider(). | 37 // by MDM::UnregisterDumpProvider(). |
37 // - However, when MDM starts a dump, the list of refptrs is copied into the | 38 // - However, when MDM starts a dump, the list of refptrs is copied into the |
38 // ProcessMemoryDumpAsyncState. That list is pruned as MDP(s) are invoked. | 39 // ProcessMemoryDumpAsyncState. That list is pruned as MDP(s) are invoked. |
39 // - If UnregisterDumpProvider() is called on a non-thread-bound MDP while a | 40 // - If UnregisterDumpProvider() is called on a non-thread-bound MDP while a |
40 // dump is in progress, the extar extra of the handle is destroyed in | 41 // dump is in progress, the extar extra of the handle is destroyed in |
41 // MDM::SetupNextMemoryDump() or MDM::InvokeOnMemoryDump(), when the copy | 42 // MDM::SetupNextMemoryDump() or MDM::InvokeOnMemoryDump(), when the copy |
42 // inside ProcessMemoryDumpAsyncState is erase()-d. | 43 // inside ProcessMemoryDumpAsyncState is erase()-d. |
43 // - The PeakDetector can keep extra refptrs when enabled. | 44 // - The PeakDetector can keep extra refptrs when enabled. |
44 struct MemoryDumpProviderInfo | 45 struct BASE_EXPORT MemoryDumpProviderInfo |
45 : public RefCountedThreadSafe<MemoryDumpProviderInfo> { | 46 : public RefCountedThreadSafe<MemoryDumpProviderInfo> { |
46 public: | 47 public: |
47 // Define a total order based on the |task_runner| affinity, so that MDPs | 48 // Define a total order based on the |task_runner| affinity, so that MDPs |
48 // belonging to the same SequencedTaskRunner are adjacent in the set. | 49 // belonging to the same SequencedTaskRunner are adjacent in the set. |
49 struct Comparator { | 50 struct Comparator { |
50 bool operator()(const scoped_refptr<MemoryDumpProviderInfo>& a, | 51 bool operator()(const scoped_refptr<MemoryDumpProviderInfo>& a, |
51 const scoped_refptr<MemoryDumpProviderInfo>& b) const; | 52 const scoped_refptr<MemoryDumpProviderInfo>& b) const; |
52 }; | 53 }; |
53 using OrderedSet = | 54 using OrderedSet = |
54 std::set<scoped_refptr<MemoryDumpProviderInfo>, Comparator>; | 55 std::set<scoped_refptr<MemoryDumpProviderInfo>, Comparator>; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 friend class base::RefCountedThreadSafe<MemoryDumpProviderInfo>; | 99 friend class base::RefCountedThreadSafe<MemoryDumpProviderInfo>; |
99 ~MemoryDumpProviderInfo(); | 100 ~MemoryDumpProviderInfo(); |
100 | 101 |
101 DISALLOW_COPY_AND_ASSIGN(MemoryDumpProviderInfo); | 102 DISALLOW_COPY_AND_ASSIGN(MemoryDumpProviderInfo); |
102 }; | 103 }; |
103 | 104 |
104 } // namespace trace_event | 105 } // namespace trace_event |
105 } // namespace base | 106 } // namespace base |
106 | 107 |
107 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ | 108 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_PROVIDER_INFO_H_ |
OLD | NEW |