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/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 StackSamplingProfiler::Module::Module(const void* base_address, | 87 : base_address(reinterpret_cast<uintptr_t>(nullptr)) {} |
|
Mike Wittman
2015/09/01 01:42:15
nit: just base_address(0u)
sydli
2015/09/03 16:21:15
Done.
| |
| 88 StackSamplingProfiler::Module::Module(const uintptr_t 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(base_address), id(id), filename(filename) {} |
| 91 | 92 |
| 92 StackSamplingProfiler::Module::~Module() {} | 93 StackSamplingProfiler::Module::~Module() {} |
| 93 | 94 |
| 94 // StackSamplingProfiler::Frame ----------------------------------------------- | 95 // StackSamplingProfiler::Frame ----------------------------------------------- |
| 95 | 96 |
| 96 StackSamplingProfiler::Frame::Frame(const void* instruction_pointer, | 97 StackSamplingProfiler::Frame::Frame(uintptr_t instruction_pointer, |
| 97 size_t module_index) | 98 size_t module_index) |
| 98 : instruction_pointer(instruction_pointer), | 99 : instruction_pointer(instruction_pointer), |
| 99 module_index(module_index) {} | 100 module_index(module_index) {} |
| 100 | 101 |
| 101 StackSamplingProfiler::Frame::~Frame() {} | 102 StackSamplingProfiler::Frame::~Frame() {} |
| 102 | 103 |
| 104 StackSamplingProfiler::Frame::Frame() {} | |
| 105 | |
| 103 // StackSamplingProfiler::CallStackProfile ------------------------------------ | 106 // StackSamplingProfiler::CallStackProfile ------------------------------------ |
| 104 | 107 |
| 105 StackSamplingProfiler::CallStackProfile::CallStackProfile() {} | 108 StackSamplingProfiler::CallStackProfile::CallStackProfile() {} |
| 106 | 109 |
| 107 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} | 110 StackSamplingProfiler::CallStackProfile::~CallStackProfile() {} |
| 108 | 111 |
| 109 // StackSamplingProfiler::SamplingThread -------------------------------------- | 112 // StackSamplingProfiler::SamplingThread -------------------------------------- |
| 110 | 113 |
| 111 StackSamplingProfiler::SamplingThread::SamplingThread( | 114 StackSamplingProfiler::SamplingThread::SamplingThread( |
| 112 scoped_ptr<NativeStackSampler> native_sampler, | 115 scoped_ptr<NativeStackSampler> native_sampler, |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 267 } | 270 } |
| 268 | 271 |
| 269 bool operator<(const StackSamplingProfiler::Frame &a, | 272 bool operator<(const StackSamplingProfiler::Frame &a, |
| 270 const StackSamplingProfiler::Frame &b) { | 273 const StackSamplingProfiler::Frame &b) { |
| 271 return (a.module_index < b.module_index) || | 274 return (a.module_index < b.module_index) || |
| 272 (a.module_index == b.module_index && | 275 (a.module_index == b.module_index && |
| 273 a.instruction_pointer < b.instruction_pointer); | 276 a.instruction_pointer < b.instruction_pointer); |
| 274 } | 277 } |
| 275 | 278 |
| 276 } // namespace base | 279 } // namespace base |
| OLD | NEW |