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 #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 Loading... |
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 |
OLD | NEW |