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

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

Issue 1975363002: Add ThreadChecker for V8SamplingProfiler. (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 02dad8e23f854295afbfe00d9b4abb32b840d288..5aca412225c95754137d9b89af2b179bcdffff7a 100644
--- a/content/renderer/devtools/v8_sampling_profiler.cc
+++ b/content/renderer/devtools/v8_sampling_profiler.cc
@@ -581,6 +581,7 @@ V8SamplingProfiler::V8SamplingProfiler(bool underTest)
render_thread_sampler_(Sampler::CreateForCurrentThread()),
weak_factory_(this) {
DCHECK(underTest || RenderThreadImpl::current());
+ DCHECK(thread_checker_.CalledOnValidThread());
// Force the "v8.cpu_profile*" categories to show up in the trace viewer.
TraceLog::GetCategoryGroupEnabled(
TRACE_DISABLED_BY_DEFAULT("v8.cpu_profile"));
@@ -591,18 +592,21 @@ V8SamplingProfiler::V8SamplingProfiler(bool underTest)
}
V8SamplingProfiler::~V8SamplingProfiler() {
+ DCHECK(thread_checker_.CalledOnValidThread());
TraceLog::GetInstance()->RemoveAsyncEnabledStateObserver(this);
DCHECK(!sampling_thread_.get());
}
void V8SamplingProfiler::StartSamplingThread() {
DCHECK(!sampling_thread_.get());
+ DCHECK(thread_checker_.CalledOnValidThread());
sampling_thread_.reset(new V8SamplingThread(
render_thread_sampler_.get(), waitable_event_for_testing_.get()));
sampling_thread_->Start();
}
void V8SamplingProfiler::StopSamplingThread() {
+ DCHECK(thread_checker_.CalledOnValidThread());
if (!sampling_thread_.get())
return;
sampling_thread_->Stop();
« 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