src: prefer v8::Global over node::Persistent

`v8::Global` is essentially a nicer variant of `node::Persistent` that,
in addition to reset-on-destroy, also implements move semantics.

This commit makes the necessary replacements, removes
`node::Persistent` and (now-)unnecessary inclusions of the
`node_persistent.h` header, and makes some of the functions that
take Persistents as arguments more generic so that they work with all
`v8::PersistentBase` flavours.

PR-URL: https://github.com/nodejs/node/pull/27287
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Eugene Ostroukhov <eostroukhov@google.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
Anna Henningsen committed 2019-04-30 00:23:33 +02:00
1 parent 095bd569ae
commit 723d5c058f
23 files changed
+81 -106

No files matched your search

+2 -1
View File
@@ -62,6 +62,7 @@ using v8::ArrayBufferView;
using v8::Context;
using v8::EscapableHandleScope;
using v8::FunctionCallbackInfo;
using v8::Global;
using v8::Integer;
using v8::Isolate;
using v8::Just;
@@ -99,7 +100,7 @@ class CallbackInfo {
FreeCallback callback,
char* data,
void* hint);
Persistent<ArrayBuffer> persistent_;
Global<ArrayBuffer> persistent_;
FreeCallback const callback_;
char* const data_;
void* const hint_;