Chromium Code Reviews| Index: base/profiler/native_stack_sampler.h |
| diff --git a/base/profiler/native_stack_sampler.h b/base/profiler/native_stack_sampler.h |
| index 8d7e441b69306b072ed67321a531ac76aee4e28c..c7cfbb34f2a17bdc186f56d95e0aa04286f33c82 100644 |
| --- a/base/profiler/native_stack_sampler.h |
| +++ b/base/profiler/native_stack_sampler.h |
| @@ -21,6 +21,21 @@ class NativeStackSamplerTestDelegate; |
| // given thread. |
| class NativeStackSampler { |
| public: |
| + // This class contains data structures that can be shared across multiple |
| + // instances of NativeStackSampler so long as they do not run concurrently. |
| + // This supports having a single instance of large structures such as copy |
| + // buffers. |
| + class StackBuffer { |
|
Mike Wittman
2017/05/01 20:28:03
Following from the comment below, this can be simp
bcwhite
2017/05/08 14:00:59
If you want the generic base class header file to
Mike Wittman
2017/05/09 01:48:05
The abstraction should cover exactly the known sub
bcwhite
2017/05/09 18:33:33
Done.
|
| + public: |
| + virtual ~StackBuffer() {} |
| + |
| + protected: |
| + StackBuffer() {} |
| + |
| + private: |
| + DISALLOW_COPY_AND_ASSIGN(StackBuffer); |
| + }; |
| + |
| // The callback type used to add annotations to a sample during collection. |
| // This is passed to the native sampler to be applied at the most appropriate |
| // time. It is a simple function-pointer because the generated code must be |
| @@ -39,6 +54,9 @@ class NativeStackSampler { |
| AnnotateCallback annotator, |
| NativeStackSamplerTestDelegate* test_delegate); |
| + // Creates an instance of the necessary stack buffer. |
| + static std::unique_ptr<StackBuffer> CreateStackBuffer(); |
|
Mike Wittman
2017/05/01 20:28:03
From https://codereview.chromium.org/2848683006/di
Mike Wittman
2017/05/10 01:29:56
Please address this comment also.
bcwhite
2017/05/10 13:50:37
Done.
Mike Wittman
2017/05/10 17:17:21
I don't see this change in patch set 10.
bcwhite
2017/05/11 16:56:31
Done.
|
| + |
| // The following functions are all called on the SamplingThread (not the |
| // thread being sampled). |
| @@ -48,11 +66,12 @@ class NativeStackSampler { |
| std::vector<StackSamplingProfiler::Module>* modules) = 0; |
| // Records a stack sample to |sample|. |
| - virtual void RecordStackSample(StackSamplingProfiler::Sample* sample) = 0; |
| + virtual void RecordStackSample(StackBuffer* stackbuffer, |
| + StackSamplingProfiler::Sample* sample) = 0; |
| // Notifies the sampler that we've stopped recording the current |
| // profile. |
| - virtual void ProfileRecordingStopped() = 0; |
| + virtual void ProfileRecordingStopped(StackBuffer* stackbuffer) = 0; |
| protected: |
| NativeStackSampler(); |