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 75b8d7a

Browse filesBrowse files
gahaasRafaelGSS
authored andcommitted
test: add type tags to uses of v8::External
PR-URL: #61898 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> (cherry picked from commit 9b67b06)
1 parent 5334433 commit 75b8d7a
Copy full SHA for 75b8d7a

1 file changed

+16-9Lines changed: 16 additions & 9 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎test/addons/async-resource/binding.cc‎

Copy file name to clipboardExpand all lines: test/addons/async-resource/binding.cc
+16-9Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,22 @@ void CreateAsyncResource(const FunctionCallbackInfo<Value>& args) {
3939
r = new AsyncResource(isolate, args[0].As<Object>(), "foobär");
4040
}
4141

42-
args.GetReturnValue().Set(
43-
External::New(isolate, static_cast<void*>(r)));
42+
args.GetReturnValue().Set(External::New(
43+
isolate, static_cast<void*>(r), v8::kExternalPointerTypeTagDefault));
4444
}
4545

4646
void DestroyAsyncResource(const FunctionCallbackInfo<Value>& args) {
4747
assert(args[0]->IsExternal());
48-
auto r = static_cast<AsyncResource*>(args[0].As<External>()->Value());
48+
auto r = static_cast<AsyncResource*>(
49+
args[0].As<External>()->Value(v8::kExternalPointerTypeTagDefault));
4950
delete r;
5051
}
5152

5253
void CallViaFunction(const FunctionCallbackInfo<Value>& args) {
5354
Isolate* isolate = args.GetIsolate();
5455
assert(args[0]->IsExternal());
55-
auto r = static_cast<AsyncResource*>(args[0].As<External>()->Value());
56+
auto r = static_cast<AsyncResource*>(
57+
args[0].As<External>()->Value(v8::kExternalPointerTypeTagDefault));
5658

5759
Local<String> name =
5860
String::NewFromUtf8(isolate, "methöd").ToLocalChecked();
@@ -69,7 +71,8 @@ void CallViaFunction(const FunctionCallbackInfo<Value>& args) {
6971
void CallViaString(const FunctionCallbackInfo<Value>& args) {
7072
Isolate* isolate = args.GetIsolate();
7173
assert(args[0]->IsExternal());
72-
auto r = static_cast<AsyncResource*>(args[0].As<External>()->Value());
74+
auto r = static_cast<AsyncResource*>(
75+
args[0].As<External>()->Value(v8::kExternalPointerTypeTagDefault));
7376

7477
Local<String> name =
7578
String::NewFromUtf8(isolate, "methöd").ToLocalChecked();
@@ -82,7 +85,8 @@ void CallViaString(const FunctionCallbackInfo<Value>& args) {
8285
void CallViaUtf8Name(const FunctionCallbackInfo<Value>& args) {
8386
Isolate* isolate = args.GetIsolate();
8487
assert(args[0]->IsExternal());
85-
auto r = static_cast<AsyncResource*>(args[0].As<External>()->Value());
88+
auto r = static_cast<AsyncResource*>(
89+
args[0].As<External>()->Value(v8::kExternalPointerTypeTagDefault));
8690

8791
Local<Value> arg = Integer::New(isolate, 42);
8892
MaybeLocal<Value> ret = r->MakeCallback("methöd", 1, &arg);
@@ -91,19 +95,22 @@ void CallViaUtf8Name(const FunctionCallbackInfo<Value>& args) {
9195

9296
void GetAsyncId(const FunctionCallbackInfo<Value>& args) {
9397
assert(args[0]->IsExternal());
94-
auto r = static_cast<AsyncResource*>(args[0].As<External>()->Value());
98+
auto r = static_cast<AsyncResource*>(
99+
args[0].As<External>()->Value(v8::kExternalPointerTypeTagDefault));
95100
args.GetReturnValue().Set(r->get_async_id());
96101
}
97102

98103
void GetTriggerAsyncId(const FunctionCallbackInfo<Value>& args) {
99104
assert(args[0]->IsExternal());
100-
auto r = static_cast<AsyncResource*>(args[0].As<External>()->Value());
105+
auto r = static_cast<AsyncResource*>(
106+
args[0].As<External>()->Value(v8::kExternalPointerTypeTagDefault));
101107
args.GetReturnValue().Set(r->get_trigger_async_id());
102108
}
103109

104110
void GetResource(const FunctionCallbackInfo<Value>& args) {
105111
assert(args[0]->IsExternal());
106-
auto r = static_cast<AsyncResource*>(args[0].As<External>()->Value());
112+
auto r = static_cast<AsyncResource*>(
113+
args[0].As<External>()->Value(v8::kExternalPointerTypeTagDefault));
107114
args.GetReturnValue().Set(r->get_resource());
108115
}
109116

0 commit comments

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