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

Side by Side Diff: base/trace_event/memory_dump_manager.h

Issue 1308403002: [Tracing] Disable registration of regular dump providers during tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@reland-content-browsertest
Patch Set: Fix indentation Created 5 years, 2 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
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 <set> 8 #include <set>
9 9
10 #include "base/atomicops.h" 10 #include "base/atomicops.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 uint64 GetTracingProcessId() const; 97 uint64 GetTracingProcessId() const;
98 98
99 // Returns the name for a the allocated_objects dump. Use this to declare 99 // Returns the name for a the allocated_objects dump. Use this to declare
100 // suballocator dumps from other dump providers. 100 // suballocator dumps from other dump providers.
101 // It will return nullptr if there is no dump provider for the system 101 // It will return nullptr if there is no dump provider for the system
102 // allocator registered (which is currently the case for Mac OS). 102 // allocator registered (which is currently the case for Mac OS).
103 const char* system_allocator_pool_name() const { 103 const char* system_allocator_pool_name() const {
104 return kSystemAllocatorPoolName; 104 return kSystemAllocatorPoolName;
105 }; 105 };
106 106
107 // When set to true, calling |RegisterMemoryDumpProvider| is a no-op.
108 void set_dumper_registrations_ignored_for_testing(bool ignored) {
109 dumper_registrations_ignored_for_testing_ = ignored;
110 }
111
107 private: 112 private:
108 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. 113 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance.
109 friend struct DefaultSingletonTraits<MemoryDumpManager>; 114 friend struct DefaultSingletonTraits<MemoryDumpManager>;
110 friend class MemoryDumpManagerDelegate; 115 friend class MemoryDumpManagerDelegate;
111 friend class MemoryDumpManagerTest; 116 friend class MemoryDumpManagerTest;
112 117
113 // Descriptor struct used to hold information about registered MDPs. It is 118 // Descriptor struct used to hold information about registered MDPs. It is
114 // deliberately copyable, in order to allow it to be used as std::set value. 119 // deliberately copyable, in order to allow it to be used as std::set value.
115 struct MemoryDumpProviderInfo { 120 struct MemoryDumpProviderInfo {
116 MemoryDumpProviderInfo( 121 MemoryDumpProviderInfo(
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // dump_providers_enabled_ list) when tracing is not enabled. 222 // dump_providers_enabled_ list) when tracing is not enabled.
218 subtle::AtomicWord memory_tracing_enabled_; 223 subtle::AtomicWord memory_tracing_enabled_;
219 224
220 // For time-triggered periodic dumps. 225 // For time-triggered periodic dumps.
221 RepeatingTimer periodic_dump_timer_; 226 RepeatingTimer periodic_dump_timer_;
222 227
223 // The unique id of the child process. This is created only for tracing and is 228 // The unique id of the child process. This is created only for tracing and is
224 // expected to be valid only when tracing is enabled. 229 // expected to be valid only when tracing is enabled.
225 uint64 tracing_process_id_; 230 uint64 tracing_process_id_;
226 231
227 // Skips the auto-registration of the core dumpers during Initialize(). 232 // When true, calling |RegisterMemoryDumpProvider| is a no-op.
228 bool skip_core_dumpers_auto_registration_for_testing_; 233 bool dumper_registrations_ignored_for_testing_;
229 234
230 // Whether new memory dump providers should be told to enable heap profiling. 235 // Whether new memory dump providers should be told to enable heap profiling.
231 bool heap_profiling_enabled_; 236 bool heap_profiling_enabled_;
232 237
233 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager); 238 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager);
234 }; 239 };
235 240
236 // The delegate is supposed to be long lived (read: a Singleton) and thread 241 // The delegate is supposed to be long lived (read: a Singleton) and thread
237 // safe (i.e. should expect calls from any thread and handle thread hopping). 242 // safe (i.e. should expect calls from any thread and handle thread hopping).
238 class BASE_EXPORT MemoryDumpManagerDelegate { 243 class BASE_EXPORT MemoryDumpManagerDelegate {
(...skipping 15 matching lines...) Expand all
254 } 259 }
255 260
256 private: 261 private:
257 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); 262 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate);
258 }; 263 };
259 264
260 } // namespace trace_event 265 } // namespace trace_event
261 } // namespace base 266 } // namespace base
262 267
263 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ 268 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_
OLDNEW
« no previous file with comments | « no previous file | base/trace_event/memory_dump_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698