diff --git a/src/env-inl.h b/src/env-inl.h index 4af5add4c8f52c..8703abb39dcd08 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -590,8 +590,7 @@ void Environment::CreateImmediate(native_immediate_callback cb, native_immediate_callbacks_.push_back({ cb, data, - std::unique_ptr>(obj.IsEmpty() ? - nullptr : new Persistent(isolate_, obj)), + v8::Global(isolate_, obj), ref }); immediate_info()->count_inc(1); diff --git a/src/env.h b/src/env.h index 66c69e8d00b9da..2c57b54989bcd8 100644 --- a/src/env.h +++ b/src/env.h @@ -977,7 +977,7 @@ class Environment { struct NativeImmediateCallback { native_immediate_callback cb_; void* data_; - std::unique_ptr> keep_alive_; + v8::Global keep_alive_; bool refed_; }; std::vector native_immediate_callbacks_;