Index: src/wasm/module-compiler.h |
diff --git a/src/wasm/module-compiler.h b/src/wasm/module-compiler.h |
index cac664924eb141e1fc8019d6bd920bb6b9afc0f3..daa82bc5a39b69701074235f76380d922f5a544c 100644 |
--- a/src/wasm/module-compiler.h |
+++ b/src/wasm/module-compiler.h |
@@ -69,8 +69,7 @@ class ModuleCompiler { |
Isolate* isolate_; |
std::unique_ptr<WasmModule> module_; |
- std::shared_ptr<Counters> counters_shared_; |
- Counters* counters_; |
+ const std::shared_ptr<Counters> async_counters_; |
bool is_sync_; |
std::vector<std::unique_ptr<compiler::WasmCompilationUnit>> |
compilation_units_; |
@@ -82,6 +81,8 @@ class ModuleCompiler { |
bool finisher_is_running_ = false; |
CancelableTaskManager background_task_manager_; |
+ Counters* counters() const { return async_counters_.get(); } |
+ |
// Run by each compilation task and by the main thread. The |
// no_finisher_callback is called within the result_mutex_ lock when no |
// finishing task is running, i.e. when the finisher_is_running_ flag is not |
@@ -178,8 +179,7 @@ class InstanceBuilder { |
Isolate* isolate_; |
WasmModule* const module_; |
- std::shared_ptr<Counters> counters_shared_; |
- Counters* counters_; |
+ const std::shared_ptr<Counters> async_counters_; |
ErrorThrower* thrower_; |
Handle<WasmModuleObject> module_object_; |
Handle<JSReceiver> ffi_; // TODO(titzer): Use MaybeHandle |
@@ -191,6 +191,8 @@ class InstanceBuilder { |
JSToWasmWrapperCache js_to_wasm_cache_; |
WeakCallbackInfo<void>::Callback instance_finalizer_callback_; |
+ Counters* counters() const { return async_counters_.get(); } |
+ |
// Helper routines to print out errors with imports. |
#define ERROR_THROWER_WITH_MESSAGE(TYPE) \ |
void Report##TYPE(const char* error, uint32_t index, \ |
@@ -296,8 +298,7 @@ class AsyncCompileJob { |
class FinishModule; |
Isolate* isolate_; |
- std::shared_ptr<Counters> counters_shared_; |
- Counters* counters_; |
+ const std::shared_ptr<Counters> async_counters_; |
std::unique_ptr<byte[]> bytes_copy_; |
ModuleWireBytes wire_bytes_; |
Handle<Context> context_; |
@@ -320,6 +321,8 @@ class AsyncCompileJob { |
int32_t num_pending_foreground_tasks_ = 0; |
#endif |
+ Counters* counters() const { return async_counters_.get(); } |
+ |
void ReopenHandlesInDeferredScope(); |
void AsyncCompileFailed(ErrorThrower& thrower); |