mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
src: fix calls to v8::Object::wrap
PR-URL: https://github.com/nodejs/node/pull/59805 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Richard Lau <richard.lau@ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
This commit is contained in:
committed by
Michaël Zasso
parent
308de27255
commit
37a3df3556
@@ -15,7 +15,8 @@ void CppgcMixin::Wrap(T* ptr, Realm* realm, v8::Local<v8::Object> obj) {
|
||||
v8::Isolate* isolate = realm->isolate();
|
||||
ptr->traced_reference_ = v8::TracedReference<v8::Object>(isolate, obj);
|
||||
// Note that ptr must be of concrete type T in Wrap.
|
||||
v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(isolate, obj, ptr);
|
||||
auto* wrappable = static_cast<v8::Object::Wrappable*>(ptr);
|
||||
v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(isolate, obj, wrappable);
|
||||
// Keep the layout consistent with BaseObjects.
|
||||
obj->SetAlignedPointerInInternalField(
|
||||
kEmbedderType, realm->isolate_data()->embedder_id_for_cppgc());
|
||||
|
||||
@@ -155,7 +155,7 @@ class CppgcMixin : public cppgc::GarbageCollectedMixin, public MemoryRetainer {
|
||||
*/
|
||||
#define CPPGC_MIXIN(Klass) \
|
||||
public /* NOLINT(whitespace/indent) */ \
|
||||
cppgc::GarbageCollected<Klass>, public cppgc::NameProvider, public CppgcMixin
|
||||
v8::Object::Wrappable, public CppgcMixin
|
||||
|
||||
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
|
||||
|
||||
|
||||
@@ -617,7 +617,7 @@ IsolateData::~IsolateData() {}
|
||||
// Deprecated API, embedders should use v8::Object::Wrap() directly instead.
|
||||
void SetCppgcReference(Isolate* isolate,
|
||||
Local<Object> object,
|
||||
void* wrappable) {
|
||||
v8::Object::Wrappable* wrappable) {
|
||||
v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(
|
||||
isolate, object, wrappable);
|
||||
}
|
||||
|
||||
@@ -1565,10 +1565,11 @@ void RegisterSignalHandler(int signal,
|
||||
// objects on Node.js versions without v8::Object::Wrap(). Addons created to
|
||||
// work with only Node.js versions with v8::Object::Wrap() should use that
|
||||
// instead.
|
||||
NODE_DEPRECATED("Use v8::Object::Wrap()",
|
||||
NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
|
||||
v8::Local<v8::Object> object,
|
||||
void* wrappable));
|
||||
NODE_DEPRECATED(
|
||||
"Use v8::Object::Wrap()",
|
||||
NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
|
||||
v8::Local<v8::Object> object,
|
||||
v8::Object::Wrappable* wrappable));
|
||||
|
||||
} // namespace node
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <v8.h>
|
||||
#include <algorithm>
|
||||
|
||||
class CppGCed : public cppgc::GarbageCollected<CppGCed> {
|
||||
class CppGCed : public v8::Object::Wrappable {
|
||||
public:
|
||||
static uint16_t states[2];
|
||||
static constexpr int kDestructCount = 0;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
// This tests that Node.js can work with an existing CppHeap.
|
||||
|
||||
// Mimic a class that does not know about Node.js.
|
||||
class CppGCed : public cppgc::GarbageCollected<CppGCed> {
|
||||
class CppGCed : public v8::Object::Wrappable {
|
||||
public:
|
||||
static int kConstructCount;
|
||||
static int kDestructCount;
|
||||
|
||||
Reference in New Issue
Block a user