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..b5b07b148e6c88b2d1fafa405a3a8f6810ace697 100644 |
--- a/base/profiler/native_stack_sampler.h |
+++ b/base/profiler/native_stack_sampler.h |
@@ -21,6 +21,18 @@ 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 Common { |
Mike Wittman
2017/01/24 17:20:56
We should just call this StackBuffer. If the conce
bcwhite
2017/02/07 15:16:35
Done.
|
+ public: |
+ virtual ~Common() {} |
+ |
+ protected: |
+ Common() {} |
+ }; |
Mike Wittman
2017/01/24 17:20:56
DISALLOW_COPY_AND_ASSIGN
bcwhite
2017/02/07 15:16:35
Done.
|
+ |
// 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 |
@@ -42,17 +54,22 @@ class NativeStackSampler { |
// The following functions are all called on the SamplingThread (not the |
// thread being sampled). |
+ // Creates an instance of "common" data buffers. |
+ virtual std::unique_ptr<Common> CreateCommon(); |
Mike Wittman
2017/01/24 17:20:56
This function doesn't depend on the instance so sh
bcwhite
2017/02/07 15:16:35
Done.
|
+ |
// Notifies the sampler that we're starting to record a new profile. Modules |
// shared across samples in the profile should be recorded in |modules|. |
virtual void ProfileRecordingStarting( |
+ Common* common, |
Mike Wittman
2017/01/24 17:20:57
No need to pass this to ProfileRecordingStarting o
bcwhite
2017/02/07 15:16:35
Done.
|
std::vector<StackSamplingProfiler::Module>* modules) = 0; |
// Records a stack sample to |sample|. |
- virtual void RecordStackSample(StackSamplingProfiler::Sample* sample) = 0; |
+ virtual void RecordStackSample(Common* common, |
Mike Wittman
2017/01/24 17:20:57
Doesn't the calling code need to be updated?
bcwhite
2017/02/07 15:16:35
Yes but since the calling code is in the middle of
|
+ StackSamplingProfiler::Sample* sample) = 0; |
// Notifies the sampler that we've stopped recording the current |
// profile. |
- virtual void ProfileRecordingStopped() = 0; |
+ virtual void ProfileRecordingStopped(Common* common) = 0; |
protected: |
NativeStackSampler(); |