| Index: content/renderer/devtools/v8_sampling_profiler.cc
|
| diff --git a/content/renderer/devtools/v8_sampling_profiler.cc b/content/renderer/devtools/v8_sampling_profiler.cc
|
| index c27f29b6990317682b100d84ddfe5de6a22bd633..dd806a8ac90ada217dca07f6ff2f4a7507b6475f 100644
|
| --- a/content/renderer/devtools/v8_sampling_profiler.cc
|
| +++ b/content/renderer/devtools/v8_sampling_profiler.cc
|
| @@ -580,18 +580,20 @@ void V8SamplingThread::Stop() {
|
| V8SamplingProfiler::V8SamplingProfiler(bool underTest)
|
| : sampling_thread_(nullptr),
|
| render_thread_sampler_(Sampler::CreateForCurrentThread()),
|
| - task_runner_(base::ThreadTaskRunnerHandle::Get()) {
|
| + task_runner_(base::ThreadTaskRunnerHandle::Get()),
|
| + weak_factory_(this) {
|
| DCHECK(underTest || RenderThreadImpl::current());
|
| // Force the "v8.cpu_profile*" categories to show up in the trace viewer.
|
| TraceLog::GetCategoryGroupEnabled(
|
| TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"));
|
| TraceLog::GetCategoryGroupEnabled(
|
| TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile.hires"));
|
| - TraceLog::GetInstance()->AddEnabledStateObserver(this);
|
| + TraceLog::GetInstance()->AddAsyncEnabledStateObserver(
|
| + weak_factory_.GetWeakPtr());
|
| }
|
|
|
| V8SamplingProfiler::~V8SamplingProfiler() {
|
| - TraceLog::GetInstance()->RemoveEnabledStateObserver(this);
|
| + TraceLog::GetInstance()->RemoveAsyncEnabledStateObserver(this);
|
| DCHECK(!sampling_thread_.get());
|
| }
|
|
|
|
|