Chromium Code Reviews| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 99 } | 99 } |
| 100 | 100 |
| 101 void MemoryDumpManager::RequestDumpPoint(DumpPointType dump_point_type) { | 101 void MemoryDumpManager::RequestDumpPoint(DumpPointType dump_point_type) { |
| 102 // TODO(primiano): this will have more logic to coordinate dump points across | 102 // TODO(primiano): this will have more logic to coordinate dump points across |
| 103 // multiple processes via IPC. See crbug.com/462930. | 103 // multiple processes via IPC. See crbug.com/462930. |
| 104 | 104 |
| 105 // Bail out immediately if tracing is not enabled at all. | 105 // Bail out immediately if tracing is not enabled at all. |
| 106 if (!UNLIKELY(subtle::NoBarrier_Load(&memory_tracing_enabled_))) | 106 if (!UNLIKELY(subtle::NoBarrier_Load(&memory_tracing_enabled_))) |
| 107 return; | 107 return; |
| 108 | 108 |
| 109 // TODO(primiano): Make guid actually unique (cross-process) by hashing it | 109 const uint64 guid = base::trace_event::TraceLog::GetInstance()->HashEventId( |
|
Primiano Tucci (use gerrit)
2015/04/13 22:13:58
nit: no need for base::trace_event as you are alre
| |
| 110 // with the PID. See crbug.com/462931 for details. | 110 g_next_guid.GetNext()); |
| 111 const uint64 guid = g_next_guid.GetNext(); | |
| 112 CreateLocalDumpPoint(dump_point_type, guid); | 111 CreateLocalDumpPoint(dump_point_type, guid); |
| 113 } | 112 } |
| 114 | 113 |
| 115 void MemoryDumpManager::BroadcastDumpRequest() { | 114 void MemoryDumpManager::BroadcastDumpRequest() { |
| 116 NOTREACHED(); // TODO(primiano): implement IPC synchronization. | 115 NOTREACHED(); // TODO(primiano): implement IPC synchronization. |
| 117 } | 116 } |
| 118 | 117 |
| 119 // Creates a dump point for the current process and appends it to the trace. | 118 // Creates a dump point for the current process and appends it to the trace. |
| 120 void MemoryDumpManager::CreateLocalDumpPoint(DumpPointType dump_point_type, | 119 void MemoryDumpManager::CreateLocalDumpPoint(DumpPointType dump_point_type, |
| 121 uint64 guid) { | 120 uint64 guid) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 } | 174 } |
| 176 | 175 |
| 177 void MemoryDumpManager::OnTraceLogDisabled() { | 176 void MemoryDumpManager::OnTraceLogDisabled() { |
| 178 AutoLock lock(lock_); | 177 AutoLock lock(lock_); |
| 179 dump_providers_enabled_.clear(); | 178 dump_providers_enabled_.clear(); |
| 180 subtle::NoBarrier_Store(&memory_tracing_enabled_, 0); | 179 subtle::NoBarrier_Store(&memory_tracing_enabled_, 0); |
| 181 } | 180 } |
| 182 | 181 |
| 183 } // namespace trace_event | 182 } // namespace trace_event |
| 184 } // namespace base | 183 } // namespace base |
| OLD | NEW |