chore: use v8::Local<>, not v8::Handle<> (#43019)

v8::Handle is an alias for v8::Local that "is kept around for historical
reasons" and is disabled when V8_IMMINENT_DEPRECATION_WARNING is defined
This commit is contained in:
Charles Kerr 2024-07-24 18:24:07 -05:00 committed by GitHub
parent 5669a40d5c
commit df524c6eca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
15 changed files with 34 additions and 34 deletions

View file

@ -50,7 +50,7 @@ namespace gin {
template <>
struct Converter<electron::TaskbarHost::ThumbarButton> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
electron::TaskbarHost::ThumbarButton* out) {
gin::Dictionary dict(isolate);
if (!gin::ConvertFromV8(isolate, val, &dict))

View file

@ -47,7 +47,7 @@ namespace gin {
template <>
struct Converter<electron::NativeWindow::TitleBarStyle> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
electron::NativeWindow::TitleBarStyle* out) {
using TitleBarStyle = electron::NativeWindow::TitleBarStyle;
std::string title_bar_style;

View file

@ -93,7 +93,7 @@ namespace gin {
template <>
struct Converter<electron::NativeWindowMac::VisualEffectState> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
electron::NativeWindowMac::VisualEffectState* out) {
using VisualEffectState = electron::NativeWindowMac::VisualEffectState;
std::string visual_effect_state;

View file

@ -24,7 +24,7 @@ namespace gin {
template <>
struct Converter<base::win::ShortcutOperation> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
base::win::ShortcutOperation* out) {
std::string operation;
if (!ConvertFromV8(isolate, val, &operation))

View file

@ -51,7 +51,7 @@ namespace gin {
template <>
struct Converter<char16_t> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
char16_t* out) {
std::u16string code = base::UTF8ToUTF16(gin::V8ToString(isolate, val));
if (code.length() != 1)
@ -108,7 +108,7 @@ struct Converter<char16_t> {
bool Converter<blink::WebInputEvent::Type>::FromV8(
v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
blink::WebInputEvent::Type* out) {
std::string type = gin::V8ToString(isolate, val);
#define CASE_TYPE(event_type, js_name) \
@ -134,7 +134,7 @@ v8::Local<v8::Value> Converter<blink::WebInputEvent::Type>::ToV8(
template <>
struct Converter<blink::WebMouseEvent::Button> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
blink::WebMouseEvent::Button* out) {
using Val = blink::WebMouseEvent::Button;
static constexpr auto Lookup =
@ -193,7 +193,7 @@ static constexpr auto ReferrerPolicies =
template <>
struct Converter<blink::WebInputEvent::Modifiers> {
static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
blink::WebInputEvent::Modifiers* out) {
return FromV8WithLowerLookup(isolate, val, Modifiers, out) ||
FromV8WithLowerLookup(isolate, val, ModifierAliases, out);
@ -661,7 +661,7 @@ v8::Local<v8::Value> Converter<network::mojom::ReferrerPolicy>::ToV8(
// static
bool Converter<network::mojom::ReferrerPolicy>::FromV8(
v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
network::mojom::ReferrerPolicy* out) {
return FromV8WithLowerLookup(isolate, val, ReferrerPolicies, out);
}
@ -700,7 +700,7 @@ v8::Local<v8::Value> Converter<blink::CloneableMessage>::ToV8(
}
bool Converter<blink::CloneableMessage>::FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val,
v8::Local<v8::Value> val,
blink::CloneableMessage* out) {
return electron::SerializeV8Value(isolate, val, out);
}

View file

@ -577,7 +577,7 @@ void NodeBindings::Initialize(v8::Local<v8::Context> context) {
}
std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
node::MultiIsolatePlatform* platform,
std::vector<std::string> args,
std::vector<std::string> exec_args,
@ -779,7 +779,7 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
}
std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
node::MultiIsolatePlatform* platform,
std::optional<base::RepeatingCallback<void()>> on_app_code_ready) {
#if BUILDFLAG(IS_WIN)

View file

@ -93,7 +93,7 @@ class NodeBindings {
// Create the environment and load node.js.
std::shared_ptr<node::Environment> CreateEnvironment(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
node::MultiIsolatePlatform* platform,
std::vector<std::string> args,
std::vector<std::string> exec_args,
@ -101,7 +101,7 @@ class NodeBindings {
std::nullopt);
std::shared_ptr<node::Environment> CreateEnvironment(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
node::MultiIsolatePlatform* platform,
std::optional<base::RepeatingCallback<void()>> on_app_code_ready =
std::nullopt);

View file

@ -78,7 +78,7 @@ void ElectronRenderFrameObserver::DidClearWindowObject() {
!web_frame->IsOnInitialEmptyDocument()) {
v8::Isolate* isolate = web_frame->GetAgentGroupScheduler()->Isolate();
v8::HandleScope handle_scope{isolate};
v8::Handle<v8::Context> context = web_frame->MainWorldScriptContext();
v8::Local<v8::Context> context = web_frame->MainWorldScriptContext();
v8::MicrotasksScope microtasks_scope(
isolate, context->GetMicrotaskQueue(),
v8::MicrotasksScope::kDoNotRunMicrotasks);
@ -91,7 +91,7 @@ void ElectronRenderFrameObserver::DidClearWindowObject() {
}
void ElectronRenderFrameObserver::DidInstallConditionalFeatures(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
int world_id) {
// When a child window is created with window.open, its WebPreferences will
// be copied from its parent, and Chromium will initialize JS context in it

View file

@ -29,7 +29,7 @@ class ElectronRenderFrameObserver : private content::RenderFrameObserver {
private:
// content::RenderFrameObserver:
void DidClearWindowObject() override;
void DidInstallConditionalFeatures(v8::Handle<v8::Context> context,
void DidInstallConditionalFeatures(v8::Local<v8::Context> context,
int world_id) override;
void WillReleaseScriptContext(v8::Local<v8::Context> context,
int world_id) override;

View file

@ -71,7 +71,7 @@ void ElectronRendererClient::UndeferLoad(content::RenderFrame* render_frame) {
}
void ElectronRendererClient::DidCreateScriptContext(
v8::Handle<v8::Context> renderer_context,
v8::Local<v8::Context> renderer_context,
content::RenderFrame* render_frame) {
// TODO(zcbenz): Do not create Node environment if node integration is not
// enabled.
@ -157,7 +157,7 @@ void ElectronRendererClient::DidCreateScriptContext(
}
void ElectronRendererClient::WillReleaseScriptContext(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
content::RenderFrame* render_frame) {
if (injected_frames_.erase(render_frame) == 0)
return;

View file

@ -29,9 +29,9 @@ class ElectronRendererClient : public RendererClientBase {
ElectronRendererClient& operator=(const ElectronRendererClient&) = delete;
// electron::RendererClientBase:
void DidCreateScriptContext(v8::Handle<v8::Context> context,
void DidCreateScriptContext(v8::Local<v8::Context> context,
content::RenderFrame* render_frame) override;
void WillReleaseScriptContext(v8::Handle<v8::Context> context,
void WillReleaseScriptContext(v8::Local<v8::Context> context,
content::RenderFrame* render_frame) override;
private:

View file

@ -95,7 +95,7 @@ double Uptime() {
.InSecondsF();
}
void InvokeEmitProcessEvent(v8::Handle<v8::Context> context,
void InvokeEmitProcessEvent(v8::Local<v8::Context> context,
const std::string& event_name) {
auto* isolate = context->GetIsolate();
// set by sandboxed_renderer/init.js
@ -167,7 +167,7 @@ void ElectronSandboxedRendererClient::RunScriptsAtDocumentEnd(
}
void ElectronSandboxedRendererClient::DidCreateScriptContext(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
content::RenderFrame* render_frame) {
// Only allow preload for the main frame or
// For devtools we still want to run the preload_bundle script
@ -198,7 +198,7 @@ void ElectronSandboxedRendererClient::DidCreateScriptContext(
}
void ElectronSandboxedRendererClient::WillReleaseScriptContext(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
content::RenderFrame* render_frame) {
if (injected_frames_.erase(render_frame) == 0)
return;

View file

@ -34,9 +34,9 @@ class ElectronSandboxedRendererClient : public RendererClientBase {
v8::Local<v8::Context> context,
content::RenderFrame* render_frame);
// electron::RendererClientBase:
void DidCreateScriptContext(v8::Handle<v8::Context> context,
void DidCreateScriptContext(v8::Local<v8::Context> context,
content::RenderFrame* render_frame) override;
void WillReleaseScriptContext(v8::Handle<v8::Context> context,
void WillReleaseScriptContext(v8::Local<v8::Context> context,
content::RenderFrame* render_frame) override;
// content::ContentRendererClient:
void RenderFrameCreated(content::RenderFrame*) override;

View file

@ -214,7 +214,7 @@ void RendererClientBase::BindProcess(v8::Isolate* isolate,
}
bool RendererClientBase::ShouldLoadPreload(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
content::RenderFrame* render_frame) const {
auto prefs = render_frame->GetBlinkPreferences();
bool is_main_frame = render_frame->IsMainFrame();
@ -580,7 +580,7 @@ extensions::ExtensionsClient* RendererClientBase::CreateExtensionsClient() {
#endif
bool RendererClientBase::IsWebViewFrame(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
content::RenderFrame* render_frame) const {
auto* isolate = context->GetIsolate();
@ -601,7 +601,7 @@ bool RendererClientBase::IsWebViewFrame(
}
void RendererClientBase::SetupMainWorldOverrides(
v8::Handle<v8::Context> context,
v8::Local<v8::Context> context,
content::RenderFrame* render_frame) {
auto prefs = render_frame->GetBlinkPreferences();
// We only need to run the isolated bundle if webview is enabled

View file

@ -64,12 +64,12 @@ class RendererClientBase : public content::ContentRendererClient
mojo::ScopedMessagePipeHandle interface_pipe) override;
#endif
virtual void DidCreateScriptContext(v8::Handle<v8::Context> context,
virtual void DidCreateScriptContext(v8::Local<v8::Context> context,
content::RenderFrame* render_frame) = 0;
virtual void WillReleaseScriptContext(v8::Handle<v8::Context> context,
virtual void WillReleaseScriptContext(v8::Local<v8::Context> context,
content::RenderFrame* render_frame) = 0;
virtual void DidClearWindowObject(content::RenderFrame* render_frame);
virtual void SetupMainWorldOverrides(v8::Handle<v8::Context> context,
virtual void SetupMainWorldOverrides(v8::Local<v8::Context> context,
content::RenderFrame* render_frame);
std::unique_ptr<blink::WebPrescientNetworking> CreatePrescientNetworking(
@ -84,7 +84,7 @@ class RendererClientBase : public content::ContentRendererClient
v8::Local<v8::Object> context,
v8::Local<v8::Function> register_cb);
bool IsWebViewFrame(v8::Handle<v8::Context> context,
bool IsWebViewFrame(v8::Local<v8::Context> context,
content::RenderFrame* render_frame) const;
#if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER)
@ -96,7 +96,7 @@ class RendererClientBase : public content::ContentRendererClient
gin_helper::Dictionary* process,
content::RenderFrame* render_frame);
bool ShouldLoadPreload(v8::Handle<v8::Context> context,
bool ShouldLoadPreload(v8::Local<v8::Context> context,
content::RenderFrame* render_frame) const;
// content::ContentRendererClient: