OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/trace_event_memory.h" | 5 #include "base/trace_event/trace_event_memory.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/debug/leak_annotations.h" | 9 #include "base/debug/leak_annotations.h" |
8 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
9 #include "base/location.h" | 11 #include "base/location.h" |
10 #include "base/logging.h" | 12 #include "base/logging.h" |
11 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
12 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
13 #include "base/strings/string_number_conversions.h" | 15 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/string_split.h" | 16 #include "base/strings/string_split.h" |
15 #include "base/strings/string_util.h" | 17 #include "base/strings/string_util.h" |
16 #include "base/threading/thread_local_storage.h" | 18 #include "base/threading/thread_local_storage.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 144 |
143 } // namespace | 145 } // namespace |
144 | 146 |
145 ////////////////////////////////////////////////////////////////////////////// | 147 ////////////////////////////////////////////////////////////////////////////// |
146 | 148 |
147 TraceMemoryController::TraceMemoryController( | 149 TraceMemoryController::TraceMemoryController( |
148 scoped_refptr<SingleThreadTaskRunner> task_runner, | 150 scoped_refptr<SingleThreadTaskRunner> task_runner, |
149 HeapProfilerStartFunction heap_profiler_start_function, | 151 HeapProfilerStartFunction heap_profiler_start_function, |
150 HeapProfilerStopFunction heap_profiler_stop_function, | 152 HeapProfilerStopFunction heap_profiler_stop_function, |
151 GetHeapProfileFunction get_heap_profile_function) | 153 GetHeapProfileFunction get_heap_profile_function) |
152 : task_runner_(task_runner.Pass()), | 154 : task_runner_(std::move(task_runner)), |
153 heap_profiler_start_function_(heap_profiler_start_function), | 155 heap_profiler_start_function_(heap_profiler_start_function), |
154 heap_profiler_stop_function_(heap_profiler_stop_function), | 156 heap_profiler_stop_function_(heap_profiler_stop_function), |
155 get_heap_profile_function_(get_heap_profile_function), | 157 get_heap_profile_function_(get_heap_profile_function), |
156 weak_factory_(this) { | 158 weak_factory_(this) { |
157 // Force the "memory" category to show up in the trace viewer. | 159 // Force the "memory" category to show up in the trace viewer. |
158 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("memory"), "init"); | 160 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("memory"), "init"); |
159 // Watch for the tracing system being enabled. | 161 // Watch for the tracing system being enabled. |
160 TraceLog::GetInstance()->AddEnabledStateObserver(this); | 162 TraceLog::GetInstance()->AddEnabledStateObserver(this); |
161 } | 163 } |
162 | 164 |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 if (!base::HexStringToUInt64(hex_address, &address)) | 429 if (!base::HexStringToUInt64(hex_address, &address)) |
428 return "error"; | 430 return "error"; |
429 if (!address) | 431 if (!address) |
430 return "null"; | 432 return "null"; |
431 // Note that this cast handles 64-bit to 32-bit conversion if necessary. | 433 // Note that this cast handles 64-bit to 32-bit conversion if necessary. |
432 return reinterpret_cast<const char*>(address); | 434 return reinterpret_cast<const char*>(address); |
433 } | 435 } |
434 | 436 |
435 } // namespace trace_event | 437 } // namespace trace_event |
436 } // namespace base | 438 } // namespace base |
OLD | NEW |