Skip to content

Commit 37a3df3

Browse files
gahaastargos
authored andcommitted
src: fix calls to v8::Object::wrap
PR-URL: #59805 Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 308de27 commit 37a3df3

File tree

6 files changed

+11
-9
lines changed

6 files changed

+11
-9
lines changed

src/cppgc_helpers-inl.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ void CppgcMixin::Wrap(T* ptr, Realm* realm, v8::Local<v8::Object> obj) {
1515
v8::Isolate* isolate = realm->isolate();
1616
ptr->traced_reference_ = v8::TracedReference<v8::Object>(isolate, obj);
1717
// Note that ptr must be of concrete type T in Wrap.
18-
v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(isolate, obj, ptr);
18+
auto* wrappable = static_cast<v8::Object::Wrappable*>(ptr);
19+
v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(isolate, obj, wrappable);
1920
// Keep the layout consistent with BaseObjects.
2021
obj->SetAlignedPointerInInternalField(
2122
kEmbedderType, realm->isolate_data()->embedder_id_for_cppgc());

src/cppgc_helpers.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ class CppgcMixin : public cppgc::GarbageCollectedMixin, public MemoryRetainer {
155155
*/
156156
#define CPPGC_MIXIN(Klass) \
157157
public /* NOLINT(whitespace/indent) */ \
158-
cppgc::GarbageCollected<Klass>, public cppgc::NameProvider, public CppgcMixin
158+
v8::Object::Wrappable, public CppgcMixin
159159

160160
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
161161

src/env.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ IsolateData::~IsolateData() {}
617617
// Deprecated API, embedders should use v8::Object::Wrap() directly instead.
618618
void SetCppgcReference(Isolate* isolate,
619619
Local<Object> object,
620-
void* wrappable) {
620+
v8::Object::Wrappable* wrappable) {
621621
v8::Object::Wrap<v8::CppHeapPointerTag::kDefaultTag>(
622622
isolate, object, wrappable);
623623
}

src/node.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1565,10 +1565,11 @@ void RegisterSignalHandler(int signal,
15651565
// objects on Node.js versions without v8::Object::Wrap(). Addons created to
15661566
// work with only Node.js versions with v8::Object::Wrap() should use that
15671567
// instead.
1568-
NODE_DEPRECATED("Use v8::Object::Wrap()",
1569-
NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
1570-
v8::Local<v8::Object> object,
1571-
void* wrappable));
1568+
NODE_DEPRECATED(
1569+
"Use v8::Object::Wrap()",
1570+
NODE_EXTERN void SetCppgcReference(v8::Isolate* isolate,
1571+
v8::Local<v8::Object> object,
1572+
v8::Object::Wrappable* wrappable));
15721573

15731574
} // namespace node
15741575

test/addons/cppgc-object/binding.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
#include <v8.h>
99
#include <algorithm>
1010

11-
class CppGCed : public cppgc::GarbageCollected<CppGCed> {
11+
class CppGCed : public v8::Object::Wrappable {
1212
public:
1313
static uint16_t states[2];
1414
static constexpr int kDestructCount = 0;

test/cctest/test_cppgc.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// This tests that Node.js can work with an existing CppHeap.
1111

1212
// Mimic a class that does not know about Node.js.
13-
class CppGCed : public cppgc::GarbageCollected<CppGCed> {
13+
class CppGCed : public v8::Object::Wrappable {
1414
public:
1515
static int kConstructCount;
1616
static int kDestructCount;

0 commit comments

Comments
 (0)