Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 06d592c

Browse filesBrowse files
committed
src: simplify native immediate by using v8::Global
Unlike `node::Persistent`, `v8::Global` has move semantics and can be used directly in STL containers. PR-URL: #26254 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent ea26ac0 commit 06d592c
Copy full SHA for 06d592c

File tree

Expand file treeCollapse file tree

2 files changed

+2
-3
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+2
-3
lines changed
Open diff view settings
Collapse file

‎src/env-inl.h‎

Copy file name to clipboardExpand all lines: src/env-inl.h
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -625,8 +625,7 @@ void Environment::CreateImmediate(native_immediate_callback cb,
625625
native_immediate_callbacks_.push_back({
626626
cb,
627627
data,
628-
std::unique_ptr<Persistent<v8::Object>>(obj.IsEmpty() ?
629-
nullptr : new Persistent<v8::Object>(isolate_, obj)),
628+
v8::Global<v8::Object>(isolate_, obj),
630629
ref
631630
});
632631
immediate_info()->count_inc(1);
Collapse file

‎src/env.h‎

Copy file name to clipboardExpand all lines: src/env.h
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,7 @@ class Environment {
11431143
struct NativeImmediateCallback {
11441144
native_immediate_callback cb_;
11451145
void* data_;
1146-
std::unique_ptr<Persistent<v8::Object>> keep_alive_;
1146+
v8::Global<v8::Object> keep_alive_;
11471147
bool refed_;
11481148
};
11491149
std::vector<NativeImmediateCallback> native_immediate_callbacks_;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.