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

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

Issue 1095003002: [tracing] Simplify design of MemoryAllocatorDump (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@matr_2_sess
Patch Set: Rebase Created 5 years, 8 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 #include "base/trace_event/memory_dump_manager.h" 5 #include "base/trace_event/memory_dump_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/atomic_sequence_num.h" 9 #include "base/atomic_sequence_num.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 void MemoryDumpManager::OnTraceLogEnabled() { 304 void MemoryDumpManager::OnTraceLogEnabled() {
305 // TODO(primiano): at this point we query TraceLog::GetCurrentCategoryFilter 305 // TODO(primiano): at this point we query TraceLog::GetCurrentCategoryFilter
306 // to figure out (and cache) which dumpers should be enabled or not. 306 // to figure out (and cache) which dumpers should be enabled or not.
307 // For the moment piggy back everything on the generic "memory" category. 307 // For the moment piggy back everything on the generic "memory" category.
308 bool enabled; 308 bool enabled;
309 TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &enabled); 309 TRACE_EVENT_CATEGORY_GROUP_ENABLED(kTraceCategory, &enabled);
310 310
311 AutoLock lock(lock_); 311 AutoLock lock(lock_);
312 dump_providers_enabled_.clear(); 312 dump_providers_enabled_.clear();
313 if (enabled) { 313 if (enabled) {
314 // Merge the dictionary of allocator attributes from all dump providers
315 // into the session state.
314 session_state_ = new MemoryDumpSessionState(); 316 session_state_ = new MemoryDumpSessionState();
317 for (const MemoryDumpProvider* mdp : dump_providers_registered_) {
318 session_state_->allocators_attributes_type_info.Update(
319 mdp->allocator_attributes_type_info());
320 }
315 dump_providers_enabled_ = dump_providers_registered_; 321 dump_providers_enabled_ = dump_providers_registered_;
316 } 322 }
317 subtle::NoBarrier_Store(&memory_tracing_enabled_, 1); 323 subtle::NoBarrier_Store(&memory_tracing_enabled_, 1);
318 } 324 }
319 325
320 void MemoryDumpManager::OnTraceLogDisabled() { 326 void MemoryDumpManager::OnTraceLogDisabled() {
321 AutoLock lock(lock_); 327 AutoLock lock(lock_);
322 dump_providers_enabled_.clear(); 328 dump_providers_enabled_.clear();
323 subtle::NoBarrier_Store(&memory_tracing_enabled_, 0); 329 subtle::NoBarrier_Store(&memory_tracing_enabled_, 0);
324 session_state_ = nullptr; 330 session_state_ = nullptr;
325 } 331 }
326 332
327 } // namespace trace_event 333 } // namespace trace_event
328 } // namespace base 334 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/memory_allocator_dump_unittest.cc ('k') | base/trace_event/memory_dump_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698