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

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

Issue 1308443002: Reland of "[tracing] Add browser-side tests for memory dumps." (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase onto https://crrev.com/1289793007 Created 5 years, 3 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 // child-process side, without having to know its own child process id. 90 // child-process side, without having to know its own child process id.
91 uint64 GetTracingProcessId() const; 91 uint64 GetTracingProcessId() const;
92 92
93 // Returns the name for a the allocated_objects dump. Use this to declare 93 // Returns the name for a the allocated_objects dump. Use this to declare
94 // suballocator dumps from other dump providers. 94 // suballocator dumps from other dump providers.
95 // It should not return nullptr after the manager has been initialized. 95 // It should not return nullptr after the manager has been initialized.
96 const char* system_allocator_pool_name() const { 96 const char* system_allocator_pool_name() const {
97 return system_allocator_pool_name_; 97 return system_allocator_pool_name_;
98 }; 98 };
99 99
100 // Tells the initialization phase to skip scheduling periodic memory dumps.
101 void DisablePeriodicDumpsForTesting() {
102 disable_periodic_dumps_for_testing_ = true;
103 }
104
100 private: 105 private:
101 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance. 106 friend struct DefaultDeleter<MemoryDumpManager>; // For the testing instance.
102 friend struct DefaultSingletonTraits<MemoryDumpManager>; 107 friend struct DefaultSingletonTraits<MemoryDumpManager>;
103 friend class MemoryDumpManagerDelegate; 108 friend class MemoryDumpManagerDelegate;
104 friend class MemoryDumpManagerTest; 109 friend class MemoryDumpManagerTest;
105 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers); 110 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, DisableFailingDumpers);
106 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest, 111 FRIEND_TEST_ALL_PREFIXES(MemoryDumpManagerTest,
107 UnregisterDumperFromThreadWhileDumping); 112 UnregisterDumperFromThreadWhileDumping);
108 113
109 // Descriptor struct used to hold information about registered MDPs. It is 114 // Descriptor struct used to hold information about registered MDPs. It is
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // The unique id of the child process. This is created only for tracing and is 220 // The unique id of the child process. This is created only for tracing and is
216 // expected to be valid only when tracing is enabled. 221 // expected to be valid only when tracing is enabled.
217 uint64 tracing_process_id_; 222 uint64 tracing_process_id_;
218 223
219 // Name of the allocated_objects dump. 224 // Name of the allocated_objects dump.
220 const char* system_allocator_pool_name_; 225 const char* system_allocator_pool_name_;
221 226
222 // Skips the auto-registration of the core dumpers during Initialize(). 227 // Skips the auto-registration of the core dumpers during Initialize().
223 bool skip_core_dumpers_auto_registration_for_testing_; 228 bool skip_core_dumpers_auto_registration_for_testing_;
224 229
230 // When true, the initialization phase does not start the periodic memory
231 // dumps.
232 // TODO(primiano): This should go into TraceConfig. https://goo.gl/5Hj3o0.
233 bool disable_periodic_dumps_for_testing_;
234
225 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager); 235 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManager);
226 }; 236 };
227 237
228 // The delegate is supposed to be long lived (read: a Singleton) and thread 238 // The delegate is supposed to be long lived (read: a Singleton) and thread
229 // safe (i.e. should expect calls from any thread and handle thread hopping). 239 // safe (i.e. should expect calls from any thread and handle thread hopping).
230 class BASE_EXPORT MemoryDumpManagerDelegate { 240 class BASE_EXPORT MemoryDumpManagerDelegate {
231 public: 241 public:
232 virtual void RequestGlobalMemoryDump(const MemoryDumpRequestArgs& args, 242 virtual void RequestGlobalMemoryDump(const MemoryDumpRequestArgs& args,
233 const MemoryDumpCallback& callback) = 0; 243 const MemoryDumpCallback& callback) = 0;
234 244
(...skipping 15 matching lines...) Expand all
250 } 260 }
251 261
252 private: 262 private:
253 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate); 263 DISALLOW_COPY_AND_ASSIGN(MemoryDumpManagerDelegate);
254 }; 264 };
255 265
256 } // namespace trace_event 266 } // namespace trace_event
257 } // namespace base 267 } // namespace base
258 268
259 #endif // BASE_TRACE_EVENT_MEMORY_DUMP_MANAGER_H_ 269 #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