OLD | NEW |
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 BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 5 #ifndef BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
6 #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 6 #define BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 private: | 84 private: |
85 // Descriptor struct used to hold information about registered MDPs. It is | 85 // Descriptor struct used to hold information about registered MDPs. It is |
86 // deliberately copyable, in order to allow to be used as hash_map value. | 86 // deliberately copyable, in order to allow to be used as hash_map value. |
87 struct MemoryDumpProviderInfo { | 87 struct MemoryDumpProviderInfo { |
88 MemoryDumpProviderInfo( | 88 MemoryDumpProviderInfo( |
89 const scoped_refptr<SingleThreadTaskRunner>& task_runner); | 89 const scoped_refptr<SingleThreadTaskRunner>& task_runner); |
90 ~MemoryDumpProviderInfo(); | 90 ~MemoryDumpProviderInfo(); |
91 | 91 |
92 scoped_refptr<SingleThreadTaskRunner> task_runner; // Optional. | 92 scoped_refptr<SingleThreadTaskRunner> task_runner; // Optional. |
| 93 int consecutive_failures; // Number of times the provider failed (to |
| 94 // disable the MDPs). |
93 bool disabled; // For fail-safe logic (auto-disable failing MDPs). | 95 bool disabled; // For fail-safe logic (auto-disable failing MDPs). |
94 }; | 96 }; |
95 | 97 |
96 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. | 98 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. |
97 friend struct DefaultSingletonTraits<MemoryDumpManager>; | 99 friend struct DefaultSingletonTraits<MemoryDumpManager>; |
98 friend class MemoryDumpManagerDelegate; | 100 friend class MemoryDumpManagerDelegate; |
99 friend class MemoryDumpManagerTest; | 101 friend class MemoryDumpManagerTest; |
| 102 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers); |
| 103 |
| 104 static const int kMaxConsecutiveFailuresCount; |
100 | 105 |
101 static void SetInstanceForTesting(MemoryDumpManager* instance); | 106 static void SetInstanceForTesting(MemoryDumpManager* instance); |
102 | 107 |
103 MemoryDumpManager(); | 108 MemoryDumpManager(); |
104 virtual ~MemoryDumpManager(); | 109 virtual ~MemoryDumpManager(); |
105 | 110 |
106 // Internal, used only by MemoryDumpManagerDelegate. | 111 // Internal, used only by MemoryDumpManagerDelegate. |
107 // Creates a memory dump for the current process and appends it to the trace. | 112 // Creates a memory dump for the current process and appends it to the trace. |
108 // |callback| will be invoked asynchronously upon completion on the same | 113 // |callback| will be invoked asynchronously upon completion on the same |
109 // thread on which CreateProcessDump() was called. | 114 // thread on which CreateProcessDump() was called. |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 } | 166 } |
162 | 167 |
163 private: | 168 private: |
164 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); | 169 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); |
165 }; | 170 }; |
166 | 171 |
167 } // namespace trace_event | 172 } // namespace trace_event |
168 } // namespace base | 173 } // namespace base |
169 | 174 |
170 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ | 175 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ |
OLD | NEW |