Browse Source

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 <[email protected]>
trop[bot] 9 months ago
parent
commit
d9de48e9c1

+ 1 - 1
shell/browser/api/electron_api_base_window.cc

@@ -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))

+ 1 - 1
shell/browser/native_window.cc

@@ -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;

+ 1 - 1
shell/browser/native_window_mac.mm

@@ -94,7 +94,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;

+ 1 - 1
shell/common/api/electron_api_shell.cc

@@ -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))

+ 6 - 6
shell/common/gin_converters/blink_converter.cc

@@ -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);
 }

+ 2 - 2
shell/common/node_bindings.cc

@@ -578,7 +578,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,
@@ -780,7 +780,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)

+ 2 - 2
shell/common/node_bindings.h

@@ -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);

+ 2 - 2
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<v8::Context> context = web_frame->MainWorldScriptContext();
+    v8::Local<v8::Context> 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<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

+ 1 - 1
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<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;

+ 2 - 2
shell/renderer/electron_renderer_client.cc

@@ -72,7 +72,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.
@@ -158,7 +158,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;

+ 2 - 2
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<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:

+ 3 - 3
shell/renderer/electron_sandboxed_renderer_client.cc

@@ -98,7 +98,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
@@ -170,7 +170,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
@@ -201,7 +201,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;

+ 2 - 2
shell/renderer/electron_sandboxed_renderer_client.h

@@ -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;

+ 3 - 3
shell/renderer/renderer_client_base.cc

@@ -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

+ 5 - 5
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<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(
@@ -81,7 +81,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)
@@ -93,7 +93,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: