| Index: base/trace_event/heap_profiler_allocation_context_tracker.h
|
| diff --git a/base/trace_event/heap_profiler_allocation_context_tracker.h b/base/trace_event/heap_profiler_allocation_context_tracker.h
|
| index 9c9a3132abab1e395a94d5632dc253845f43efa4..1d609f6d2e3188a0f136656548b7c4f0d22aaa08 100644
|
| --- a/base/trace_event/heap_profiler_allocation_context_tracker.h
|
| +++ b/base/trace_event/heap_profiler_allocation_context_tracker.h
|
| @@ -23,11 +23,23 @@ namespace trace_event {
|
| // details.
|
| class BASE_EXPORT AllocationContextTracker {
|
| public:
|
| + enum InitializationState { kNotInitialized = 0, kInitializing, kInitialized };
|
| +
|
| // Globally enables capturing allocation context.
|
| // TODO(ruuda): Should this be replaced by |EnableCapturing| in the future?
|
| // Or at least have something that guards agains enable -> disable -> enable?
|
| static void SetCaptureEnabled(bool enabled);
|
|
|
| + // Exposes the initialization state of the tracker. This is to avoid
|
| + // re-entrancy in the malloc heap profiler, which will lazily initialize the
|
| + // thread-local context tracker on the first encountered malloc, causing a
|
| + // nested allocation.
|
| + static InitializationState GetStateForCurrentThread();
|
| +
|
| + // Enforces the initialization of the tracker. Subsequent calls to the other
|
| + // methods of this class are supposed to not cause any further malloc/new.
|
| + static AllocationContextTracker* InitializeForCurrentThread();
|
| +
|
| // Returns whether capturing allocation context is enabled globally.
|
| inline static bool capture_enabled() {
|
| // A little lag after heap profiling is enabled or disabled is fine, it is
|
|
|