From d9de48e9c1b39f7faea459166e83b07d7467c35e Mon Sep 17 00:00:00 2001 From: "trop[bot]" <37223003+trop[bot]@users.noreply.github.com> Date: Thu, 25 Jul 2024 12:45:06 +0200 Subject: [PATCH] chore: use v8::Local<>, not v8::Handle<> (#43036) 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 Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr --- shell/browser/api/electron_api_base_window.cc | 2 +- shell/browser/native_window.cc | 2 +- shell/browser/native_window_mac.mm | 2 +- shell/common/api/electron_api_shell.cc | 2 +- shell/common/gin_converters/blink_converter.cc | 12 ++++++------ shell/common/node_bindings.cc | 4 ++-- shell/common/node_bindings.h | 4 ++-- shell/renderer/electron_render_frame_observer.cc | 4 ++-- shell/renderer/electron_render_frame_observer.h | 2 +- shell/renderer/electron_renderer_client.cc | 4 ++-- shell/renderer/electron_renderer_client.h | 4 ++-- shell/renderer/electron_sandboxed_renderer_client.cc | 6 +++--- shell/renderer/electron_sandboxed_renderer_client.h | 4 ++-- shell/renderer/renderer_client_base.cc | 6 +++--- shell/renderer/renderer_client_base.h | 10 +++++----- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/shell/browser/api/electron_api_base_window.cc b/shell/browser/api/electron_api_base_window.cc index ce2d5c3ee92..337c928889d 100644 --- a/shell/browser/api/electron_api_base_window.cc +++ b/shell/browser/api/electron_api_base_window.cc @@ -50,7 +50,7 @@ namespace gin { template <> struct Converter { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, electron::TaskbarHost::ThumbarButton* out) { gin::Dictionary dict(isolate); if (!gin::ConvertFromV8(isolate, val, &dict)) diff --git a/shell/browser/native_window.cc b/shell/browser/native_window.cc index 5e5a6977d55..bb1d82fd825 100644 --- a/shell/browser/native_window.cc +++ b/shell/browser/native_window.cc @@ -47,7 +47,7 @@ namespace gin { template <> struct Converter { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, electron::NativeWindow::TitleBarStyle* out) { using TitleBarStyle = electron::NativeWindow::TitleBarStyle; std::string title_bar_style; diff --git a/shell/browser/native_window_mac.mm b/shell/browser/native_window_mac.mm index 6921a877d9d..55da0502776 100644 --- a/shell/browser/native_window_mac.mm +++ b/shell/browser/native_window_mac.mm @@ -94,7 +94,7 @@ namespace gin { template <> struct Converter { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, electron::NativeWindowMac::VisualEffectState* out) { using VisualEffectState = electron::NativeWindowMac::VisualEffectState; std::string visual_effect_state; diff --git a/shell/common/api/electron_api_shell.cc b/shell/common/api/electron_api_shell.cc index 6881ca78499..e1348bd7e1c 100644 --- a/shell/common/api/electron_api_shell.cc +++ b/shell/common/api/electron_api_shell.cc @@ -24,7 +24,7 @@ namespace gin { template <> struct Converter { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, base::win::ShortcutOperation* out) { std::string operation; if (!ConvertFromV8(isolate, val, &operation)) diff --git a/shell/common/gin_converters/blink_converter.cc b/shell/common/gin_converters/blink_converter.cc index 7e9c6097850..715cea33481 100644 --- a/shell/common/gin_converters/blink_converter.cc +++ b/shell/common/gin_converters/blink_converter.cc @@ -51,7 +51,7 @@ namespace gin { template <> struct Converter { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, char16_t* out) { std::u16string code = base::UTF8ToUTF16(gin::V8ToString(isolate, val)); if (code.length() != 1) @@ -108,7 +108,7 @@ struct Converter { bool Converter::FromV8( v8::Isolate* isolate, - v8::Handle val, + v8::Local 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 Converter::ToV8( template <> struct Converter { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local 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 { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, blink::WebInputEvent::Modifiers* out) { return FromV8WithLowerLookup(isolate, val, Modifiers, out) || FromV8WithLowerLookup(isolate, val, ModifierAliases, out); @@ -661,7 +661,7 @@ v8::Local Converter::ToV8( // static bool Converter::FromV8( v8::Isolate* isolate, - v8::Handle val, + v8::Local val, network::mojom::ReferrerPolicy* out) { return FromV8WithLowerLookup(isolate, val, ReferrerPolicies, out); } @@ -700,7 +700,7 @@ v8::Local Converter::ToV8( } bool Converter::FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, blink::CloneableMessage* out) { return electron::SerializeV8Value(isolate, val, out); } diff --git a/shell/common/node_bindings.cc b/shell/common/node_bindings.cc index a28e4fb20bf..486956cd9d8 100644 --- a/shell/common/node_bindings.cc +++ b/shell/common/node_bindings.cc @@ -578,7 +578,7 @@ void NodeBindings::Initialize(v8::Local context) { } std::shared_ptr NodeBindings::CreateEnvironment( - v8::Handle context, + v8::Local context, node::MultiIsolatePlatform* platform, std::vector args, std::vector exec_args, @@ -780,7 +780,7 @@ std::shared_ptr NodeBindings::CreateEnvironment( } std::shared_ptr NodeBindings::CreateEnvironment( - v8::Handle context, + v8::Local context, node::MultiIsolatePlatform* platform, std::optional> on_app_code_ready) { #if BUILDFLAG(IS_WIN) diff --git a/shell/common/node_bindings.h b/shell/common/node_bindings.h index fce3f39eadf..93363117df4 100644 --- a/shell/common/node_bindings.h +++ b/shell/common/node_bindings.h @@ -93,7 +93,7 @@ class NodeBindings { // Create the environment and load node.js. std::shared_ptr CreateEnvironment( - v8::Handle context, + v8::Local context, node::MultiIsolatePlatform* platform, std::vector args, std::vector exec_args, @@ -101,7 +101,7 @@ class NodeBindings { std::nullopt); std::shared_ptr CreateEnvironment( - v8::Handle context, + v8::Local context, node::MultiIsolatePlatform* platform, std::optional> on_app_code_ready = std::nullopt); diff --git a/shell/renderer/electron_render_frame_observer.cc b/shell/renderer/electron_render_frame_observer.cc index 29d24edd3c9..d099d1493d5 100644 --- a/shell/renderer/electron_render_frame_observer.cc +++ b/shell/renderer/electron_render_frame_observer.cc @@ -81,7 +81,7 @@ void ElectronRenderFrameObserver::DidClearWindowObject() { !web_frame->IsOnInitialEmptyDocument()) { v8::Isolate* isolate = web_frame->GetAgentGroupScheduler()->Isolate(); v8::HandleScope handle_scope{isolate}; - v8::Handle context = web_frame->MainWorldScriptContext(); + v8::Local context = web_frame->MainWorldScriptContext(); v8::MicrotasksScope microtasks_scope( isolate, context->GetMicrotaskQueue(), v8::MicrotasksScope::kDoNotRunMicrotasks); @@ -94,7 +94,7 @@ void ElectronRenderFrameObserver::DidClearWindowObject() { } void ElectronRenderFrameObserver::DidInstallConditionalFeatures( - v8::Handle context, + v8::Local 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 diff --git a/shell/renderer/electron_render_frame_observer.h b/shell/renderer/electron_render_frame_observer.h index 7195e689981..5919cf6d0d8 100644 --- a/shell/renderer/electron_render_frame_observer.h +++ b/shell/renderer/electron_render_frame_observer.h @@ -29,7 +29,7 @@ class ElectronRenderFrameObserver : private content::RenderFrameObserver { private: // content::RenderFrameObserver: void DidClearWindowObject() override; - void DidInstallConditionalFeatures(v8::Handle context, + void DidInstallConditionalFeatures(v8::Local context, int world_id) override; void WillReleaseScriptContext(v8::Local context, int world_id) override; diff --git a/shell/renderer/electron_renderer_client.cc b/shell/renderer/electron_renderer_client.cc index a8e7dfea4f9..d5c4409031a 100644 --- a/shell/renderer/electron_renderer_client.cc +++ b/shell/renderer/electron_renderer_client.cc @@ -72,7 +72,7 @@ void ElectronRendererClient::UndeferLoad(content::RenderFrame* render_frame) { } void ElectronRendererClient::DidCreateScriptContext( - v8::Handle renderer_context, + v8::Local renderer_context, content::RenderFrame* render_frame) { // TODO(zcbenz): Do not create Node environment if node integration is not // enabled. @@ -158,7 +158,7 @@ void ElectronRendererClient::DidCreateScriptContext( } void ElectronRendererClient::WillReleaseScriptContext( - v8::Handle context, + v8::Local context, content::RenderFrame* render_frame) { if (injected_frames_.erase(render_frame) == 0) return; diff --git a/shell/renderer/electron_renderer_client.h b/shell/renderer/electron_renderer_client.h index 0251fcb7a49..5471f872eb3 100644 --- a/shell/renderer/electron_renderer_client.h +++ b/shell/renderer/electron_renderer_client.h @@ -29,9 +29,9 @@ class ElectronRendererClient : public RendererClientBase { ElectronRendererClient& operator=(const ElectronRendererClient&) = delete; // electron::RendererClientBase: - void DidCreateScriptContext(v8::Handle context, + void DidCreateScriptContext(v8::Local context, content::RenderFrame* render_frame) override; - void WillReleaseScriptContext(v8::Handle context, + void WillReleaseScriptContext(v8::Local context, content::RenderFrame* render_frame) override; private: diff --git a/shell/renderer/electron_sandboxed_renderer_client.cc b/shell/renderer/electron_sandboxed_renderer_client.cc index 84355836815..77cb3071288 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.cc +++ b/shell/renderer/electron_sandboxed_renderer_client.cc @@ -98,7 +98,7 @@ double Uptime() { .InSecondsF(); } -void InvokeEmitProcessEvent(v8::Handle context, +void InvokeEmitProcessEvent(v8::Local context, const std::string& event_name) { auto* isolate = context->GetIsolate(); // set by sandboxed_renderer/init.js @@ -170,7 +170,7 @@ void ElectronSandboxedRendererClient::RunScriptsAtDocumentEnd( } void ElectronSandboxedRendererClient::DidCreateScriptContext( - v8::Handle context, + v8::Local context, content::RenderFrame* render_frame) { // Only allow preload for the main frame or // For devtools we still want to run the preload_bundle script @@ -201,7 +201,7 @@ void ElectronSandboxedRendererClient::DidCreateScriptContext( } void ElectronSandboxedRendererClient::WillReleaseScriptContext( - v8::Handle context, + v8::Local context, content::RenderFrame* render_frame) { if (injected_frames_.erase(render_frame) == 0) return; diff --git a/shell/renderer/electron_sandboxed_renderer_client.h b/shell/renderer/electron_sandboxed_renderer_client.h index a80573efb80..bc01047803a 100644 --- a/shell/renderer/electron_sandboxed_renderer_client.h +++ b/shell/renderer/electron_sandboxed_renderer_client.h @@ -34,9 +34,9 @@ class ElectronSandboxedRendererClient : public RendererClientBase { v8::Local context, content::RenderFrame* render_frame); // electron::RendererClientBase: - void DidCreateScriptContext(v8::Handle context, + void DidCreateScriptContext(v8::Local context, content::RenderFrame* render_frame) override; - void WillReleaseScriptContext(v8::Handle context, + void WillReleaseScriptContext(v8::Local context, content::RenderFrame* render_frame) override; // content::ContentRendererClient: void RenderFrameCreated(content::RenderFrame*) override; diff --git a/shell/renderer/renderer_client_base.cc b/shell/renderer/renderer_client_base.cc index d89a3ddff48..c958c3fa223 100644 --- a/shell/renderer/renderer_client_base.cc +++ b/shell/renderer/renderer_client_base.cc @@ -214,7 +214,7 @@ void RendererClientBase::BindProcess(v8::Isolate* isolate, } bool RendererClientBase::ShouldLoadPreload( - v8::Handle context, + v8::Local 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 context, + v8::Local context, content::RenderFrame* render_frame) const { auto* isolate = context->GetIsolate(); @@ -601,7 +601,7 @@ bool RendererClientBase::IsWebViewFrame( } void RendererClientBase::SetupMainWorldOverrides( - v8::Handle context, + v8::Local context, content::RenderFrame* render_frame) { auto prefs = render_frame->GetBlinkPreferences(); // We only need to run the isolated bundle if webview is enabled diff --git a/shell/renderer/renderer_client_base.h b/shell/renderer/renderer_client_base.h index 67562c60ede..845fda02232 100644 --- a/shell/renderer/renderer_client_base.h +++ b/shell/renderer/renderer_client_base.h @@ -61,12 +61,12 @@ class RendererClientBase : public content::ContentRendererClient mojo::ScopedMessagePipeHandle interface_pipe) override; #endif - virtual void DidCreateScriptContext(v8::Handle context, + virtual void DidCreateScriptContext(v8::Local context, content::RenderFrame* render_frame) = 0; - virtual void WillReleaseScriptContext(v8::Handle context, + virtual void WillReleaseScriptContext(v8::Local context, content::RenderFrame* render_frame) = 0; virtual void DidClearWindowObject(content::RenderFrame* render_frame); - virtual void SetupMainWorldOverrides(v8::Handle context, + virtual void SetupMainWorldOverrides(v8::Local context, content::RenderFrame* render_frame); std::unique_ptr CreatePrescientNetworking( @@ -81,7 +81,7 @@ class RendererClientBase : public content::ContentRendererClient v8::Local context, v8::Local register_cb); - bool IsWebViewFrame(v8::Handle context, + bool IsWebViewFrame(v8::Local context, content::RenderFrame* render_frame) const; #if BUILDFLAG(ENABLE_BUILTIN_SPELLCHECKER) @@ -93,7 +93,7 @@ class RendererClientBase : public content::ContentRendererClient gin_helper::Dictionary* process, content::RenderFrame* render_frame); - bool ShouldLoadPreload(v8::Handle context, + bool ShouldLoadPreload(v8::Local context, content::RenderFrame* render_frame) const; // content::ContentRendererClient: