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

Unified Diff: src/isolate.h

Issue 2929853003: Fix use of history timers in background threads. (Closed)
Patch Set: Make explicit when async_counters is needed. Created 3 years, 6 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 | « src/counters.cc ('k') | src/isolate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/isolate.h
diff --git a/src/isolate.h b/src/isolate.h
index 66af826b5bb8e169f86d84f5e41a5ce068f50f0f..55a43966d163d28a7efbaf54dad256562579caa8 100644
--- a/src/isolate.h
+++ b/src/isolate.h
@@ -871,13 +871,15 @@ class Isolate {
#undef NATIVE_CONTEXT_FIELD_ACCESSOR
Bootstrapper* bootstrapper() { return bootstrapper_; }
- Counters* counters() {
- // Call InitializeLoggingAndCounters() if logging is needed before
- // the isolate is fully initialized.
- DCHECK_NOT_NULL(counters_shared_.get());
- return counters_shared_.get();
+ // Use for updating counters on a foreground thread.
+ Counters* counters() { return async_counters().get(); }
+ // Use for updating counters on a background thread.
+ const std::shared_ptr<Counters>& async_counters() {
+ DCHECK(!IsIsolateInBackground());
+ // Make sure InitializeCounters() has been called.
+ DCHECK_NOT_NULL(async_counters_.get());
+ return async_counters_;
}
- std::shared_ptr<Counters> counters_shared() { return counters_shared_; }
RuntimeProfiler* runtime_profiler() { return runtime_profiler_; }
CompilationCache* compilation_cache() { return compilation_cache_; }
Logger* logger() {
@@ -1443,7 +1445,7 @@ class Isolate {
Bootstrapper* bootstrapper_;
RuntimeProfiler* runtime_profiler_;
CompilationCache* compilation_cache_;
- std::shared_ptr<Counters> counters_shared_;
+ std::shared_ptr<Counters> async_counters_;
base::RecursiveMutex break_access_;
Logger* logger_;
StackGuard stack_guard_;
« no previous file with comments | « src/counters.cc ('k') | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698