[dawn][node] Replace deprecated Data with DataV2 V8 deprecated v8::FunctionCallbackInfo<T>::Data() in favor of DataV2(). Update the callback trampolines in napi_v8.cpp and EventLoopTest.cpp to use DataV2(). Bug: 568742088 Change-Id: Ica1d794f32160224af637f161bb5d41f20c012ed TAG=agy Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/348235 Auto-Submit: Steven Perron <stevenperron@google.com> Reviewed-by: Natalie Chouinard <chouinard@google.com> Commit-Queue: Natalie Chouinard <chouinard@google.com>
diff --git a/src/dawn/node/napi_v8/napi_v8.cpp b/src/dawn/node/napi_v8/napi_v8.cpp index 4c1a4ec..2aa97c5 100644 --- a/src/dawn/node/napi_v8/napi_v8.cpp +++ b/src/dawn/node/napi_v8/napi_v8.cpp
@@ -120,7 +120,7 @@ void DrainFinalizersV8Callback(const v8::FunctionCallbackInfo<v8::Value>& info) { auto* env = static_cast<napi_env>( - info.Data().As<v8::External>()->Value(v8::kExternalPointerTypeTagDefault)); + info.DataV2().As<v8::External>()->Value(v8::kExternalPointerTypeTagDefault)); env->finalizer_drain_scheduled = false; env->DrainFinalizers(); } @@ -358,7 +358,7 @@ // V8 and Node-API use different callback conventions: // - V8 callbacks use `void (const v8::FunctionCallbackInfo<v8::Value>&)` and pass user context via -// an attached `v8::External` value in `v8_info.Data()`. +// an attached `v8::External` value in `v8_info.DataV2()`. // - Node-API callbacks use `napi_value (*)(napi_env, napi_callback_info)` and retrieve user context // via `napi_get_cb_info()`. // @@ -367,7 +367,7 @@ // wrapper referencing the active V8 callback arguments, executes the target `napi_callback`, and // forwards the returned `napi_value` back to V8. void NativeCallbackTrampoline(const v8::FunctionCallbackInfo<v8::Value>& v8_info) { - v8::Local<v8::External> ext = v8_info.Data().As<v8::External>(); + v8::Local<v8::External> ext = v8_info.DataV2().As<v8::External>(); auto* binding = static_cast<CallbackBinding*>(ext->Value(v8::kExternalPointerTypeTagDefault)); napi_env env = binding->env;
diff --git a/src/dawn/node/test/EventLoopTest.cpp b/src/dawn/node/test/EventLoopTest.cpp index 8bc87a4..43b5ec2 100644 --- a/src/dawn/node/test/EventLoopTest.cpp +++ b/src/dawn/node/test/EventLoopTest.cpp
@@ -140,7 +140,7 @@ private: static void Record(const v8::FunctionCallbackInfo<v8::Value>& info) { auto* log = static_cast<std::vector<std::string>*>( - info.Data().As<v8::External>()->Value(v8::kExternalPointerTypeTagDefault)); + info.DataV2().As<v8::External>()->Value(v8::kExternalPointerTypeTagDefault)); v8::String::Utf8Value name(info.GetIsolate(), info[0]); log->emplace_back(*name != nullptr ? *name : ""); }