| Index: base/profiler/native_stack_sampler.h
|
| diff --git a/base/profiler/native_stack_sampler.h b/base/profiler/native_stack_sampler.h
|
| index bc170dcf933e6e9bc7554fda261182a142178f75..8ef8c24e13d3c96298c568270bb45dfdf8786ff2 100644
|
| --- a/base/profiler/native_stack_sampler.h
|
| +++ b/base/profiler/native_stack_sampler.h
|
| @@ -5,12 +5,15 @@
|
| #ifndef BASE_PROFILER_NATIVE_STACK_SAMPLER_H_
|
| #define BASE_PROFILER_NATIVE_STACK_SAMPLER_H_
|
|
|
| +#include "base/base_export.h"
|
| #include "base/memory/scoped_ptr.h"
|
| #include "base/profiler/stack_sampling_profiler.h"
|
| #include "base/threading/platform_thread.h"
|
|
|
| namespace base {
|
|
|
| +class NativeStackSamplerTestDelegate;
|
| +
|
| // NativeStackSampler is an implementation detail of StackSamplingProfiler. It
|
| // abstracts the native implementation required to record a stack sample for a
|
| // given thread.
|
| @@ -20,7 +23,9 @@ class NativeStackSampler {
|
|
|
| // Creates a stack sampler that records samples for |thread_handle|. Returns
|
| // null if this platform does not support stack sampling.
|
| - static scoped_ptr<NativeStackSampler> Create(PlatformThreadId thread_id);
|
| + static scoped_ptr<NativeStackSampler> Create(
|
| + PlatformThreadId thread_id,
|
| + NativeStackSamplerTestDelegate* test_delegate);
|
|
|
| // The following functions are all called on the SamplingThread (not the
|
| // thread being sampled).
|
| @@ -44,6 +49,23 @@ class NativeStackSampler {
|
| DISALLOW_COPY_AND_ASSIGN(NativeStackSampler);
|
| };
|
|
|
| +// NativeStackSamplerTestDelegate provides seams for test code to execute during
|
| +// stack collection.
|
| +class BASE_EXPORT NativeStackSamplerTestDelegate {
|
| + public:
|
| + virtual ~NativeStackSamplerTestDelegate();
|
| +
|
| + // Called after copying the stack and resuming the target thread, but prior to
|
| + // walking the stack. Invoked on the SamplingThread.
|
| + virtual void OnPreStackWalk() = 0;
|
| +
|
| + protected:
|
| + NativeStackSamplerTestDelegate();
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(NativeStackSamplerTestDelegate);
|
| +};
|
| +
|
| } // namespace base
|
|
|
| #endif // BASE_PROFILER_NATIVE_STACK_SAMPLER_H_
|
|
|