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/profiler/stack_sampling_profiler.h" | 5 #include "base/profiler/stack_sampling_profiler.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 const StackSamplingProfiler::CallStackProfiles& profiles) { | 76 const StackSamplingProfiler::CallStackProfiles& profiles) { |
77 callback.Run(profiles); | 77 callback.Run(profiles); |
78 // Delete the instance on the original calling thread. | 78 // Delete the instance on the original calling thread. |
79 task_runner->DeleteSoon(FROM_HERE, object_to_be_deleted.release()); | 79 task_runner->DeleteSoon(FROM_HERE, object_to_be_deleted.release()); |
80 } | 80 } |
81 | 81 |
82 } // namespace | 82 } // namespace |
83 | 83 |
84 // StackSamplingProfiler::Module ---------------------------------------------- | 84 // StackSamplingProfiler::Module ---------------------------------------------- |
85 | 85 |
86 StackSamplingProfiler::Module::Module() : base_address(nullptr) {} | 86 StackSamplingProfiler::Module::Module() |
| 87 : base_address(reinterpret_cast<uintptr_t>(nullptr)) {} |
87 StackSamplingProfiler::Module::Module(const void* base_address, | 88 StackSamplingProfiler::Module::Module(const void* base_address, |
88 const std::string& id, | 89 const std::string& id, |
89 const FilePath& filename) | 90 const FilePath& filename) |
90 : base_address(base_address), id(id), filename(filename) {} | 91 : base_address(reinterpret_cast<uintptr_t>(base_address)), |
| 92 id(id), |
| 93 filename(filename) {} |
91 | 94 |
92 StackSamplingProfiler::Module::~Module() {} | 95 StackSamplingProfiler::Module::~Module() {} |
93 | 96 |
94 // StackSamplingProfiler::Frame ----------------------------------------------- | 97 // StackSamplingProfiler::Frame ----------------------------------------------- |
95 | 98 |
| 99 StackSamplingProfiler::Frame::Frame() |
| 100 : instruction_pointer(reinterpret_cast<uintptr_t>(nullptr)) {} |
96 StackSamplingProfiler::Frame::Frame(const void* instruction_pointer, | 101 StackSamplingProfiler::Frame::Frame(const void* instruction_pointer, |
97 size_t module_index) | 102 size_t module_index) |
98 : instruction_pointer(instruction_pointer), | 103 : instruction_pointer(reinterpret_cast<uintptr_t>(instruction_pointer)), |
99 module_index(module_index) {} | 104 module_index(module_index) {} |
100 | 105 |
101 StackSamplingProfiler::Frame::~Frame() {} | 106 StackSamplingProfiler::Frame::~Frame() {} |
102 | 107 |
103 // StackSamplingProfiler::CallStackProfile ------------------------------------ | 108 // StackSamplingProfiler::CallStackProfile ------------------------------------ |
104 | 109 |
105 StackSamplingProfiler::CallStackProfile::CallStackProfile() {} | 110 StackSamplingProfiler::CallStackProfile::CallStackProfile() {} |
106 | 111 |
107 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} | 112 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} |
108 | 113 |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 } | 272 } |
268 | 273 |
269 bool operator<(const StackSamplingProfiler::Frame &a, | 274 bool operator<(const StackSamplingProfiler::Frame &a, |
270 const StackSamplingProfiler::Frame &b) { | 275 const StackSamplingProfiler::Frame &b) { |
271 return (a.module_index < b.module_index) || | 276 return (a.module_index < b.module_index) || |
272 (a.module_index == b.module_index && | 277 (a.module_index == b.module_index && |
273 a.instruction_pointer < b.instruction_pointer); | 278 a.instruction_pointer < b.instruction_pointer); |
274 } | 279 } |
275 | 280 |
276 } // namespace base | 281 } // namespace base |
OLD | NEW |