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_; |