Index: base/profiler/stack_sampling_profiler.h |
diff --git a/base/profiler/stack_sampling_profiler.h b/base/profiler/stack_sampling_profiler.h |
index 9489fd0bc128a16cd93707228f72c82b1c462a77..d33ee2525ce0472f7442d908526a086656947ee2 100644 |
--- a/base/profiler/stack_sampling_profiler.h |
+++ b/base/profiler/stack_sampling_profiler.h |
@@ -25,12 +25,19 @@ namespace base { |
class NativeStackSampler; |
class NativeStackSamplerTestDelegate; |
+class WaitableEvent; |
// StackSamplingProfiler periodically stops a thread to sample its stack, for |
// the purpose of collecting information about which code paths are |
// executing. This information is used in aggregate by UMA to identify hot |
// and/or janky code paths. |
// |
+// IMPORTANT: Only threads guaranteed to live beyond the lifetime of the |
+// profiler object can be safely sampled. Sampling the activity of the current |
+// thread within the scope of this object is safe, but sampling any other |
+// thread could cause Bad Things(tm) to occur should that thread exit before |
+// sampling is complete. USE WITH CAUTION! |
+// |
// Sample StackSamplingProfiler usage: |
// |
// // Create and customize params as desired. |
@@ -205,21 +212,15 @@ class BASE_EXPORT StackSamplingProfiler { |
// Stops any profiling currently taking place before destroying the profiler. |
~StackSamplingProfiler(); |
- // The fire-and-forget interface: starts a profiler and allows it to complete |
- // without the caller needing to manage the profiler lifetime. May be invoked |
- // from any thread, but requires that the calling thread has a message loop. |
- static void StartAndRunAsync(PlatformThreadId thread_id, |
- const SamplingParams& params, |
- const CompletedCallback& callback); |
- |
// Initializes the profiler and starts sampling. |
void Start(); |
// Stops the profiler and any ongoing sampling. Calling this function is |
// optional; if not invoked profiling terminates when all the profiling bursts |
// specified in the SamplingParams are completed or the profiler is destroyed, |
- // whichever occurs first. |
- void Stop(); |
+ // whichever occurs first. If |done| is not null, a signal will be sent to it |
+ // once the sampling has stopped and the callback completed. |
+ void Stop(WaitableEvent* done); |
// Stops all active profiles and cleans up any resources in anticipation of |
// a shutdown of the current process. |