diff --git a/src/env-inl.h b/src/env-inl.h index 9752613b292368..824b7529a9945d 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -625,8 +625,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 f0c57fe3fb60f8..87b2d3abd38cd8 100644 --- a/src/env.h +++ b/src/env.h @@ -1143,7 +1143,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_;