Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1330)

Unified Diff: content/renderer/devtools/v8_sampling_profiler.cc

Issue 1967793004: Change base class of V8SamplingProfiler to AsyncEnabledStateObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/devtools/v8_sampling_profiler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
« no previous file with comments | « content/renderer/devtools/v8_sampling_profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698