diff --git a/shell/common/gin_helper/function_template.cc b/shell/common/gin_helper/function_template.cc index 54019899bb..6c19caf4c5 100644 --- a/shell/common/gin_helper/function_template.cc +++ b/shell/common/gin_helper/function_template.cc @@ -5,6 +5,7 @@ #include "shell/common/gin_helper/function_template.h" #include "base/strings/strcat.h" +#include "gin/public/gin_embedders.h" namespace gin_helper { @@ -29,7 +30,10 @@ void CallbackHolderBase::DisposeObserver::OnDisposed() { } CallbackHolderBase::CallbackHolderBase(v8::Isolate* isolate) - : v8_ref_(isolate, v8::External::New(isolate, this)), + : v8_ref_(isolate, + v8::External::New(isolate, + this, + gin::kGinInternalCallbackHolderBaseTag)), dispose_observer_(gin::PerIsolateData::From(isolate), this) { v8_ref_.SetWeak(this, &CallbackHolderBase::FirstWeakCallback, v8::WeakCallbackType::kParameter); diff --git a/shell/common/gin_helper/function_template.h b/shell/common/gin_helper/function_template.h index c9d82747ce..1c4f5430b4 100644 --- a/shell/common/gin_helper/function_template.h +++ b/shell/common/gin_helper/function_template.h @@ -13,6 +13,7 @@ #include "base/memory/raw_ptr.h" #include "gin/arguments.h" #include "gin/per_isolate_data.h" +#include "gin/public/gin_embedders.h" #include "shell/common/gin_helper/destroyable.h" #include "shell/common/gin_helper/error_thrower.h" #include "v8/include/v8-context.h" @@ -289,8 +290,8 @@ struct Dispatcher { static void DispatchToCallbackImpl(gin::Arguments* args) { v8::Local v8_holder; CHECK(args->GetData(&v8_holder)); - CallbackHolderBase* holder_base = - reinterpret_cast(v8_holder->Value()); + CallbackHolderBase* holder_base = reinterpret_cast( + v8_holder->Value(gin::kGinInternalCallbackHolderBaseTag)); typedef CallbackHolder HolderT; HolderT* holder = static_cast(holder_base);