| 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 #ifndef BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ | 5 #ifndef BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ |
| 6 #define BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ | 6 #define BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ |
| 7 | 7 |
| 8 #include <memory> |
| 9 |
| 8 #include "base/base_export.h" | 10 #include "base/base_export.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "base/memory/scoped_ptr.h" | |
| 11 #include "base/profiler/stack_sampling_profiler.h" | 12 #include "base/profiler/stack_sampling_profiler.h" |
| 12 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 | 16 |
| 16 class NativeStackSamplerTestDelegate; | 17 class NativeStackSamplerTestDelegate; |
| 17 | 18 |
| 18 // NativeStackSampler is an implementation detail of StackSamplingProfiler. It | 19 // NativeStackSampler is an implementation detail of StackSamplingProfiler. It |
| 19 // abstracts the native implementation required to record a stack sample for a | 20 // abstracts the native implementation required to record a stack sample for a |
| 20 // given thread. | 21 // given thread. |
| 21 class NativeStackSampler { | 22 class NativeStackSampler { |
| 22 public: | 23 public: |
| 23 virtual ~NativeStackSampler(); | 24 virtual ~NativeStackSampler(); |
| 24 | 25 |
| 25 // Creates a stack sampler that records samples for |thread_handle|. Returns | 26 // Creates a stack sampler that records samples for |thread_handle|. Returns |
| 26 // null if this platform does not support stack sampling. | 27 // null if this platform does not support stack sampling. |
| 27 static scoped_ptr<NativeStackSampler> Create( | 28 static std::unique_ptr<NativeStackSampler> Create( |
| 28 PlatformThreadId thread_id, | 29 PlatformThreadId thread_id, |
| 29 NativeStackSamplerTestDelegate* test_delegate); | 30 NativeStackSamplerTestDelegate* test_delegate); |
| 30 | 31 |
| 31 // The following functions are all called on the SamplingThread (not the | 32 // The following functions are all called on the SamplingThread (not the |
| 32 // thread being sampled). | 33 // thread being sampled). |
| 33 | 34 |
| 34 // Notifies the sampler that we're starting to record a new profile. Modules | 35 // Notifies the sampler that we're starting to record a new profile. Modules |
| 35 // shared across samples in the profile should be recorded in |modules|. | 36 // shared across samples in the profile should be recorded in |modules|. |
| 36 virtual void ProfileRecordingStarting( | 37 virtual void ProfileRecordingStarting( |
| 37 std::vector<StackSamplingProfiler::Module>* modules) = 0; | 38 std::vector<StackSamplingProfiler::Module>* modules) = 0; |
| (...skipping 26 matching lines...) Expand all Loading... |
| 64 NativeStackSamplerTestDelegate(); | 65 NativeStackSamplerTestDelegate(); |
| 65 | 66 |
| 66 private: | 67 private: |
| 67 DISALLOW_COPY_AND_ASSIGN(NativeStackSamplerTestDelegate); | 68 DISALLOW_COPY_AND_ASSIGN(NativeStackSamplerTestDelegate); |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 } // namespace base | 71 } // namespace base |
| 71 | 72 |
| 72 #endif // BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ | 73 #endif // BASE_PROFILER_NATIVE_STACK_SAMPLER_H_ |
| 73 | 74 |
| OLD | NEW |