Index: src/isolate.h |
diff --git a/src/isolate.h b/src/isolate.h |
index aad853dc0851fe670179a8fab4ebe720744e40a0..7a376b1a3a3003f385d7513a9a7bb814d1bae6ce 100644 |
--- a/src/isolate.h |
+++ b/src/isolate.h |
@@ -866,13 +866,20 @@ class Isolate { |
#undef NATIVE_CONTEXT_FIELD_ACCESSOR |
Bootstrapper* bootstrapper() { return bootstrapper_; } |
+ // Use for updating counters on a foreground thread. |
Counters* counters() { |
jochen (gone - plz use gerrit)
2017/06/12 09:18:34
why not have counters() always return the shared_p
kschimpf
2017/06/12 16:47:05
Because too much code accesses it like this:
C
|
- // Call InitializeLoggingAndCounters() if logging is needed before |
- // the isolate is fully initialized. |
+ DCHECK(!IsIsolateInBackground()); |
+ // Make sure InitializeCounters() has been called. |
DCHECK_NOT_NULL(counters_shared_.get()); |
return counters_shared_.get(); |
} |
- std::shared_ptr<Counters> counters_shared() { return counters_shared_; } |
+ // Use for updating counters on a background thread. |
+ std::shared_ptr<Counters> counters_shared() { |
+ DCHECK(!IsIsolateInBackground()); |
+ // Make sure InitializeCounters() has been called. |
+ DCHECK_NOT_NULL(counters_shared_.get()); |
+ return counters_shared_; |
+ } |
RuntimeProfiler* runtime_profiler() { return runtime_profiler_; } |
CompilationCache* compilation_cache() { return compilation_cache_; } |
Logger* logger() { |