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..b958894dbe95e2986a1f456046b5ba45b4ec27a8 100644 |
--- a/base/profiler/native_stack_sampler.h |
+++ b/base/profiler/native_stack_sampler.h |
@@ -21,6 +21,17 @@ class NativeStackSamplerTestDelegate; |
// given thread. |
class NativeStackSampler { |
public: |
+ // The thread state as determined by the sampler during it's last attempt. |
Mike Wittman
2017/02/13 22:35:57
All changes in this file and native_stack_sampler_
bcwhite
2017/02/14 14:33:01
Done.
|
+ enum ThreadState { |
+ THREAD_UNCHECKED, |
+ THREAD_RUNNING, |
+ THREAD_EXITED, |
+ THREAD_UNSUSPENDABLE, |
+ THREAD_NO_INFO, |
+ THREAD_STACK_TOO_BIG, |
+ THREAD_INACCESSIBLE, |
+ }; |
+ |
// 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 |
@@ -54,10 +65,17 @@ class NativeStackSampler { |
// profile. |
virtual void ProfileRecordingStopped() = 0; |
+ // Gets the last-known thread state. |
+ ThreadState thread_state() { return thread_state_; } |
+ |
protected: |
NativeStackSampler(); |
+ void set_thread_state(ThreadState state) { thread_state_ = state; } |
+ |
private: |
+ ThreadState thread_state_ = THREAD_UNCHECKED; |
+ |
DISALLOW_COPY_AND_ASSIGN(NativeStackSampler); |
}; |
@@ -69,7 +87,10 @@ class BASE_EXPORT 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; |
+ virtual void OnPreStackWalk(){}; |
+ |
+ // Called after the sampling is complete. |
+ virtual void OnPostRecordSample(NativeStackSampler::ThreadState state){}; |
protected: |
NativeStackSamplerTestDelegate(); |