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

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 <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2024-07-25 11:00:05 +02:00 committed by GitHub
parent 9e14f8d828
commit 097a3e9024
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 <> template <>
struct Converter<electron::TaskbarHost::ThumbarButton> { struct Converter<electron::TaskbarHost::ThumbarButton> {
static bool FromV8(v8::Isolate* isolate, static bool FromV8(v8::Isolate* isolate,
v8::Handle<v8::Value> val, v8::Local<v8::Value> val,
electron::TaskbarHost::ThumbarButton* out) { electron::TaskbarHost::ThumbarButton* out) {
gin::Dictionary dict(isolate); gin::Dictionary dict(isolate);
if (!gin::ConvertFromV8(isolate, val, &dict)) if (!gin::ConvertFromV8(isolate, val, &dict))

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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