refactor: avoid deprecated v8::Context::GetIsolate()
calls (pt 1) (#47843)
* refactor: avoid redundant GetIsolate() calls in NodeBindings::CreateEnvironment()
Xref: 6563615
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: use v8::Isolate::GetCurrent() in Initialize() methods
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: add v8::Isolate* arg to NodeBindings::CreateEnvironment()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fixup! refactor: use v8::Isolate::GetCurrent() in Initialize() methods
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* refactor: add v8::Isolate* arg to RendererClientBase::DidCreateScriptContext()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fixup! refactor: add v8::Isolate* arg to NodeBindings::CreateEnvironment()
Co-authored-by: Charles Kerr <charles@charleskerr.com>
* fixup! fixup! refactor: use v8::Isolate::GetCurrent() in Initialize() methods
refactor: prefer JavascriptEnvironment::GetIsolate() in the browser layer
Co-authored-by: Charles Kerr <charles@charleskerr.com>
---------
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:
parent
673ec5d39e
commit
d426b92326
61 changed files with 136 additions and 110 deletions
|
@ -1856,8 +1856,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("app", electron::api::App::Create(isolate));
|
||||
}
|
||||
|
||||
|
|
|
@ -152,8 +152,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("autoUpdater", AutoUpdater::Create(isolate));
|
||||
}
|
||||
|
||||
|
|
|
@ -1302,7 +1302,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
BaseWindow::SetConstructor(isolate, base::BindRepeating(&BaseWindow::New));
|
||||
|
||||
gin_helper::Dictionary constructor(isolate,
|
||||
|
|
|
@ -341,8 +341,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("BrowserWindow",
|
||||
gin_helper::CreateConstructor<BrowserWindow>(
|
||||
isolate, base::BindRepeating(&BrowserWindow::New)));
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "base/threading/thread_restrictions.h"
|
||||
#include "base/trace_event/trace_config.h"
|
||||
#include "content/public/browser/tracing_controller.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_converters/file_path_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter.h"
|
||||
|
@ -171,7 +172,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("getCategories", &GetCategories);
|
||||
dict.SetMethod("startRecording", &StartTracing);
|
||||
dict.SetMethod("stopRecording", &StopRecording);
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "electron/mas.h"
|
||||
#include "gin/arguments.h"
|
||||
#include "gin/data_object_builder.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/electron_paths.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_converters/file_path_converter.h"
|
||||
|
@ -261,7 +262,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.SetMethod("start", &electron::api::crash_reporter::Start);
|
||||
#if IS_MAS_BUILD()
|
||||
dict.SetMethod("addExtraParameter", &electron::api::crash_reporter::NoOp);
|
||||
|
|
|
@ -539,7 +539,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("createDesktopCapturer",
|
||||
&electron::api::DesktopCapturer::Create);
|
||||
dict.SetMethod(
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/browser/ui/certificate_trust.h"
|
||||
#include "shell/browser/ui/file_dialog.h"
|
||||
#include "shell/browser/ui/message_box.h"
|
||||
|
@ -89,8 +90,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("showMessageBoxSync", &ShowMessageBoxSync);
|
||||
dict.SetMethod("showMessageBox", &ShowMessageBox);
|
||||
dict.SetMethod("_closeMessageBox", &electron::CloseMessageBox);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "base/functional/bind.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "gin/dictionary.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "v8/include/v8.h"
|
||||
|
@ -27,9 +28,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
|
||||
gin::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin::Dictionary dict{isolate, exports};
|
||||
dict.Set("setEventEmitterPrototype",
|
||||
base::BindRepeating(&SetEventEmitterPrototype));
|
||||
}
|
||||
|
|
|
@ -247,8 +247,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin::Dictionary dict{isolate, exports};
|
||||
dict.Set("globalShortcut", electron::api::GlobalShortcut::Create(isolate));
|
||||
}
|
||||
|
||||
|
|
|
@ -216,8 +216,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("inAppPurchase", InAppPurchase::Create(isolate));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -325,9 +325,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("Menu", Menu::GetConstructor(context));
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
dict.SetMethod("setApplicationMenu", &Menu::SetApplicationMenu);
|
||||
|
|
|
@ -137,8 +137,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin::Dictionary dict{isolate, exports};
|
||||
dict.Set("nativeTheme", NativeTheme::Create(isolate));
|
||||
}
|
||||
|
||||
|
|
|
@ -251,8 +251,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("Notification", Notification::GetConstructor(context));
|
||||
dict.SetMethod("isSupported", &Notification::IsSupported);
|
||||
}
|
||||
|
|
|
@ -197,8 +197,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("createPowerMonitor",
|
||||
base::BindRepeating(&PowerMonitor::Create));
|
||||
dict.SetMethod("getSystemIdleState",
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "gin/object_template_builder.h"
|
||||
#include "services/device/public/mojom/wake_lock_provider.mojom.h"
|
||||
#include "services/service_manager/public/cpp/connector.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
namespace gin {
|
||||
|
@ -139,8 +140,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin::Dictionary dict{isolate, exports};
|
||||
dict.Set("powerSaveBlocker",
|
||||
electron::api::PowerSaveBlocker::Create(isolate));
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "chrome/browser/browser_process.h"
|
||||
#include "gin/converter.h"
|
||||
#include "printing/buildflags/buildflags.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "shell/common/thread_restrictions.h"
|
||||
|
@ -78,8 +79,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
dict.SetMethod("getPrinterListAsync",
|
||||
base::BindRepeating(&GetPrinterListAsync));
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "gin/handle.h"
|
||||
#include "gin/object_template_builder.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/browser/protocol_registry.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_converters/net_converter.h"
|
||||
|
@ -359,8 +360,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("Protocol", electron::api::Protocol::GetConstructor(context));
|
||||
dict.SetMethod("registerSchemesAsPrivileged", &RegisterSchemesAsPrivileged);
|
||||
dict.SetMethod("getStandardSchemes", &electron::api::GetStandardSchemes);
|
||||
|
|
|
@ -61,7 +61,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin::Dictionary dict(isolate, exports);
|
||||
dict.Set("pushNotifications",
|
||||
electron::api::PushNotifications::Create(isolate));
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "components/os_crypt/sync/os_crypt.h"
|
||||
#include "shell/browser/browser.h"
|
||||
#include "shell/browser/browser_process_impl.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/gin_converters/base_converter.h"
|
||||
#include "shell/common/gin_converters/callback_converter.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
|
@ -131,7 +132,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.SetMethod("decryptString", &DecryptString);
|
||||
dict.SetMethod("encryptString", &EncryptString);
|
||||
|
|
|
@ -223,7 +223,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.SetMethod("createScreen", base::BindRepeating(&Screen::Create));
|
||||
}
|
||||
|
|
|
@ -354,8 +354,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("ServiceWorkerMain", ServiceWorkerMain::GetConstructor(context));
|
||||
}
|
||||
|
||||
|
|
|
@ -1864,7 +1864,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("Session", Session::GetConstructor(context));
|
||||
dict.SetMethod("fromPartition", &FromPartition);
|
||||
|
|
|
@ -115,7 +115,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
dict.Set("systemPreferences", SystemPreferences::Create(isolate));
|
||||
}
|
||||
|
|
|
@ -445,9 +445,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
|
||||
gin::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin::Dictionary dict{isolate, exports};
|
||||
dict.Set("Tray", Tray::GetConstructor(context));
|
||||
}
|
||||
|
||||
|
|
|
@ -530,8 +530,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("_fork", &electron::api::UtilityProcessWrapper::Create);
|
||||
}
|
||||
|
||||
|
|
|
@ -470,9 +470,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("View", View::GetConstructor(isolate));
|
||||
}
|
||||
|
||||
|
|
|
@ -4653,8 +4653,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("WebContents", WebContents::GetConstructor(context));
|
||||
dict.SetMethod("fromId", &WebContentsFromID);
|
||||
dict.SetMethod("fromFrame", &WebContentsFromFrame);
|
||||
|
|
|
@ -228,8 +228,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("WebContentsView", WebContentsView::GetConstructor(isolate));
|
||||
}
|
||||
|
||||
|
|
|
@ -674,8 +674,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("WebFrameMain", WebFrameMain::GetConstructor(context));
|
||||
dict.SetMethod("fromId", &FromID);
|
||||
dict.SetMethod("_fromIdIfExists", &FromIdIfExists);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// found in the LICENSE file.
|
||||
|
||||
#include "content/public/browser/browser_context.h"
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/browser/web_contents_preferences.h"
|
||||
#include "shell/browser/web_contents_zoom_controller.h"
|
||||
#include "shell/browser/web_view_manager.h"
|
||||
|
@ -40,7 +41,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("addGuest", &AddGuest);
|
||||
dict.SetMethod("removeGuest", &RemoveGuest);
|
||||
}
|
||||
|
|
|
@ -316,8 +316,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("createPair", &CreatePair);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "shell/browser/api/views/electron_api_image_view.h"
|
||||
|
||||
#include "shell/browser/javascript_environment.h"
|
||||
#include "shell/common/gin_converters/image_converter.h"
|
||||
#include "shell/common/gin_helper/constructor.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
|
@ -49,8 +50,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = electron::JavascriptEnvironment::GetIsolate();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("ImageView", gin_helper::CreateConstructor<ImageView>(
|
||||
isolate, base::BindRepeating(&ImageView::New)));
|
||||
}
|
||||
|
|
|
@ -237,8 +237,8 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
|
|||
node_bindings_->Initialize(js_env_->isolate()->GetCurrentContext());
|
||||
// Create the global environment.
|
||||
node_env_ = node_bindings_->CreateEnvironment(
|
||||
js_env_->isolate()->GetCurrentContext(), js_env_->platform(),
|
||||
js_env_->max_young_generation_size_in_bytes());
|
||||
js_env_->isolate(), js_env_->isolate()->GetCurrentContext(),
|
||||
js_env_->platform(), js_env_->max_young_generation_size_in_bytes());
|
||||
|
||||
node_env_->set_trace_sync_io(node_env_->options()->trace_sync_io);
|
||||
|
||||
|
|
|
@ -27,7 +27,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
dict.SetMethod("getCrashdumpSignalFD", &GetCrashdumpSignalFD);
|
||||
dict.SetMethod("getCrashpadHandlerPID", &GetCrashpadHandlerPID);
|
||||
|
|
|
@ -213,7 +213,7 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
auto* isolate = exports->GetIsolate();
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
|
||||
auto cons = Archive::CreateFunctionTemplate(isolate)
|
||||
->GetFunction(context)
|
||||
|
|
|
@ -294,7 +294,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("availableFormats",
|
||||
&electron::api::Clipboard::AvailableFormats);
|
||||
dict.SetMethod("has", &electron::api::Clipboard::Has);
|
||||
|
|
|
@ -64,7 +64,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("hasSwitch", &HasSwitch);
|
||||
dict.SetMethod("getSwitchValue", &GetSwitchValue);
|
||||
dict.SetMethod("appendSwitch", &AppendSwitch);
|
||||
|
|
|
@ -29,7 +29,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("getVar", &GetVar);
|
||||
dict.SetMethod("hasVar", &HasVar);
|
||||
dict.SetMethod("setVar", &SetVar);
|
||||
|
|
|
@ -619,8 +619,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
auto native_image = gin_helper::Dictionary::CreateEmpty(isolate);
|
||||
dict.Set("nativeImage", native_image);
|
||||
|
||||
|
|
|
@ -80,9 +80,9 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("isOnline", &IsOnline);
|
||||
dict.SetMethod("isValidHeaderName", &IsValidHeaderName);
|
||||
dict.SetMethod("isValidHeaderValue", &IsValidHeaderValue);
|
||||
|
|
|
@ -173,7 +173,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("showItemInFolder", &platform_util::ShowItemInFolder);
|
||||
dict.SetMethod("openPath", &OpenPath);
|
||||
dict.SetMethod("openExternal", &OpenExternal);
|
||||
|
|
|
@ -45,7 +45,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("log", &Log);
|
||||
dict.SetMethod("getLoggingDestination", &GetLoggingDestination);
|
||||
}
|
||||
|
|
|
@ -99,7 +99,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("getHiddenValue", &GetHiddenValue);
|
||||
dict.SetMethod("setHiddenValue", &SetHiddenValue);
|
||||
dict.SetMethod("getObjectHash", &GetObjectHash);
|
||||
|
|
|
@ -41,7 +41,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("isBuiltinSpellCheckerEnabled", &IsBuiltinSpellCheckerEnabled);
|
||||
dict.SetMethod("isPDFViewerEnabled", &IsPDFViewerEnabled);
|
||||
dict.SetMethod("isFakeLocationProviderEnabled",
|
||||
|
|
|
@ -641,6 +641,7 @@ void NodeBindings::Initialize(v8::Local<v8::Context> context) {
|
|||
}
|
||||
|
||||
std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
node::MultiIsolatePlatform* platform,
|
||||
size_t max_young_generation_size,
|
||||
|
@ -664,7 +665,6 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
|
|||
break;
|
||||
}
|
||||
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary global(isolate, context->Global());
|
||||
|
||||
if (browser_env_ == BrowserEnvironment::kBrowser) {
|
||||
|
@ -766,7 +766,7 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
|
|||
// could be either kExplicit or kScoped depending on whether we're executing
|
||||
// from within a Node.js or a Blink entrypoint. Instead, the policy is
|
||||
// toggled to kExplicit when entering Node.js through UvRunOnce.
|
||||
is.policy = context->GetIsolate()->GetMicrotasksPolicy();
|
||||
is.policy = isolate->GetMicrotasksPolicy();
|
||||
|
||||
// We do not want to use Node.js' message listener as it interferes with
|
||||
// Blink's.
|
||||
|
@ -775,8 +775,8 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
|
|||
// Isolate message listeners are additive (you can add multiple), so instead
|
||||
// we add an extra one here to ensure that the async hook stack is properly
|
||||
// cleared when errors are thrown.
|
||||
context->GetIsolate()->AddMessageListenerWithErrorLevel(
|
||||
ErrorMessageListener, v8::Isolate::kMessageError);
|
||||
isolate->AddMessageListenerWithErrorLevel(ErrorMessageListener,
|
||||
v8::Isolate::kMessageError);
|
||||
|
||||
// We do not want to use the promise rejection callback that Node.js uses,
|
||||
// because it does not send PromiseRejectionEvents to the global script
|
||||
|
@ -792,15 +792,14 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
|
|||
node::IsolateSettingsFlags::SHOULD_NOT_SET_PREPARE_STACK_TRACE_CALLBACK;
|
||||
}
|
||||
|
||||
node::SetIsolateUpForNode(context->GetIsolate(), is);
|
||||
context->GetIsolate()->SetHostImportModuleDynamicallyCallback(
|
||||
HostImportModuleDynamically);
|
||||
context->GetIsolate()->SetHostImportModuleWithPhaseDynamicallyCallback(
|
||||
node::SetIsolateUpForNode(isolate, is);
|
||||
isolate->SetHostImportModuleDynamicallyCallback(HostImportModuleDynamically);
|
||||
isolate->SetHostImportModuleWithPhaseDynamicallyCallback(
|
||||
HostImportModuleWithPhaseDynamically);
|
||||
context->GetIsolate()->SetHostInitializeImportMetaObjectCallback(
|
||||
isolate->SetHostInitializeImportMetaObjectCallback(
|
||||
HostInitializeImportMetaObject);
|
||||
|
||||
gin_helper::Dictionary process(context->GetIsolate(), env->process_object());
|
||||
gin_helper::Dictionary process(isolate, env->process_object());
|
||||
process.SetReadOnly("type", process_type);
|
||||
|
||||
if (browser_env_ == BrowserEnvironment::kBrowser ||
|
||||
|
@ -833,13 +832,14 @@ std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
|
|||
}
|
||||
|
||||
std::shared_ptr<node::Environment> NodeBindings::CreateEnvironment(
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
node::MultiIsolatePlatform* platform,
|
||||
size_t max_young_generation_size,
|
||||
std::optional<base::RepeatingCallback<void()>> on_app_code_ready) {
|
||||
return CreateEnvironment(context, platform, max_young_generation_size,
|
||||
ElectronCommandLine::AsUtf8(), {},
|
||||
on_app_code_ready);
|
||||
return CreateEnvironment(
|
||||
isolate, context, platform, max_young_generation_size,
|
||||
ElectronCommandLine::AsUtf8(), {}, on_app_code_ready);
|
||||
}
|
||||
|
||||
void NodeBindings::LoadEnvironment(node::Environment* env) {
|
||||
|
|
|
@ -131,6 +131,7 @@ class NodeBindings {
|
|||
|
||||
// Create the environment and load node.js.
|
||||
std::shared_ptr<node::Environment> CreateEnvironment(
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
node::MultiIsolatePlatform* platform,
|
||||
size_t max_young_generation_size,
|
||||
|
@ -140,6 +141,7 @@ class NodeBindings {
|
|||
std::nullopt);
|
||||
|
||||
std::shared_ptr<node::Environment> CreateEnvironment(
|
||||
v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
node::MultiIsolatePlatform* platform,
|
||||
size_t max_young_generation_size = 0,
|
||||
|
|
|
@ -1106,8 +1106,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("executeInWorld", &electron::api::ExecuteInWorld);
|
||||
dict.SetMethod("exposeAPIInWorld", &electron::api::ExposeAPIInWorld);
|
||||
dict.SetMethod("_overrideGlobalValueFromIsolatedWorld",
|
||||
|
|
|
@ -29,7 +29,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
#if IS_MAS_BUILD()
|
||||
dict.SetMethod("addExtraParameter", &SetCrashKeyStub);
|
||||
dict.SetMethod("removeExtraParameter", &ClearCrashKeyStub);
|
||||
|
|
|
@ -267,7 +267,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
gin_helper::Dictionary dict(context->GetIsolate(), exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("createForRenderFrame", &IPCRenderFrame::Create);
|
||||
dict.SetMethod("createForServiceWorker", &IPCServiceWorker::Create);
|
||||
}
|
||||
|
|
|
@ -963,8 +963,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
void* priv) {
|
||||
using namespace electron::api; // NOLINT(build/namespaces)
|
||||
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.Set("mainFrame", WebFrameRenderer::Create(
|
||||
isolate, electron::GetRenderFrame(exports)));
|
||||
}
|
||||
|
|
|
@ -30,8 +30,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("getPathForFile", &electron::api::web_utils::GetPathForFile);
|
||||
}
|
||||
|
||||
|
|
|
@ -123,7 +123,8 @@ void ElectronRenderFrameObserver::DidInstallConditionalFeatures(
|
|||
context, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
||||
|
||||
if (ShouldNotifyClient(world_id))
|
||||
renderer_client_->DidCreateScriptContext(context, render_frame_);
|
||||
renderer_client_->DidCreateScriptContext(v8::Isolate::GetCurrent(), context,
|
||||
render_frame_);
|
||||
|
||||
auto prefs = render_frame_->GetBlinkPreferences();
|
||||
bool use_context_isolation = prefs.context_isolation;
|
||||
|
|
|
@ -90,6 +90,7 @@ void ElectronRendererClient::UndeferLoad(content::RenderFrame* render_frame) {
|
|||
}
|
||||
|
||||
void ElectronRendererClient::DidCreateScriptContext(
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> renderer_context,
|
||||
content::RenderFrame* render_frame) {
|
||||
// TODO(zcbenz): Do not create Node environment if node integration is not
|
||||
|
@ -126,7 +127,7 @@ void ElectronRendererClient::DidCreateScriptContext(
|
|||
blink::LoaderFreezeMode::kStrict);
|
||||
|
||||
std::shared_ptr<node::Environment> env = node_bindings_->CreateEnvironment(
|
||||
renderer_context, nullptr, 0,
|
||||
isolate, renderer_context, nullptr, 0,
|
||||
base::BindRepeating(&ElectronRendererClient::UndeferLoad,
|
||||
base::Unretained(this), render_frame));
|
||||
|
||||
|
@ -134,7 +135,6 @@ void ElectronRendererClient::DidCreateScriptContext(
|
|||
// Node.js deletes the global fetch function when their fetch implementation
|
||||
// is disabled, so we need to save and re-add it after the Node.js environment
|
||||
// is loaded. See corresponding change in node/init.ts.
|
||||
v8::Isolate* isolate = env->isolate();
|
||||
v8::Local<v8::Object> global = renderer_context->Global();
|
||||
|
||||
std::vector<std::string> keys = {"fetch", "Response", "FormData",
|
||||
|
|
|
@ -29,7 +29,8 @@ class ElectronRendererClient : public RendererClientBase {
|
|||
ElectronRendererClient& operator=(const ElectronRendererClient&) = delete;
|
||||
|
||||
// electron::RendererClientBase:
|
||||
void DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
void DidCreateScriptContext(v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) override;
|
||||
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) override;
|
||||
|
|
|
@ -108,6 +108,7 @@ void ElectronSandboxedRendererClient::RunScriptsAtDocumentEnd(
|
|||
}
|
||||
|
||||
void ElectronSandboxedRendererClient::DidCreateScriptContext(
|
||||
v8::Isolate* const isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) {
|
||||
// Only allow preload for the main frame or
|
||||
|
@ -120,7 +121,6 @@ void ElectronSandboxedRendererClient::DidCreateScriptContext(
|
|||
|
||||
// Wrap the bundle into a function that receives the binding object as
|
||||
// argument.
|
||||
auto* isolate = context->GetIsolate();
|
||||
auto binding = v8::Object::New(isolate);
|
||||
InitializeBindings(binding, context, render_frame);
|
||||
|
||||
|
|
|
@ -34,7 +34,8 @@ class ElectronSandboxedRendererClient : public RendererClientBase {
|
|||
v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame);
|
||||
// electron::RendererClientBase:
|
||||
void DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
void DidCreateScriptContext(v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) override;
|
||||
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) override;
|
||||
|
|
|
@ -56,7 +56,8 @@ class RendererClientBase : public content::ContentRendererClient
|
|||
mojo::ScopedMessagePipeHandle interface_pipe) override;
|
||||
#endif
|
||||
|
||||
virtual void DidCreateScriptContext(v8::Local<v8::Context> context,
|
||||
virtual void DidCreateScriptContext(v8::Isolate* isolate,
|
||||
v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) = 0;
|
||||
virtual void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
||||
content::RenderFrame* render_frame) = 0;
|
||||
|
|
|
@ -49,7 +49,7 @@ WebWorkerObserver::~WebWorkerObserver() = default;
|
|||
void WebWorkerObserver::WorkerScriptReadyForEvaluation(
|
||||
v8::Local<v8::Context> worker_context) {
|
||||
v8::Context::Scope context_scope(worker_context);
|
||||
auto* isolate = worker_context->GetIsolate();
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
v8::MicrotasksScope microtasks_scope(
|
||||
worker_context, v8::MicrotasksScope::kDoNotRunMicrotasks);
|
||||
|
||||
|
@ -66,7 +66,7 @@ void WebWorkerObserver::WorkerScriptReadyForEvaluation(
|
|||
v8::Maybe<bool> initialized = node::InitializeContext(worker_context);
|
||||
CHECK(!initialized.IsNothing() && initialized.FromJust());
|
||||
std::shared_ptr<node::Environment> env =
|
||||
node_bindings_->CreateEnvironment(worker_context, nullptr);
|
||||
node_bindings_->CreateEnvironment(isolate, worker_context, nullptr);
|
||||
|
||||
// We need to use the Blink implementation of fetch in web workers
|
||||
// Node.js deletes the global fetch function when their fetch implementation
|
||||
|
|
|
@ -136,9 +136,9 @@ void NodeService::Initialize(
|
|||
|
||||
// Create the global environment.
|
||||
node_env_ = node_bindings_->CreateEnvironment(
|
||||
js_env_->isolate()->GetCurrentContext(), js_env_->platform(),
|
||||
js_env_->max_young_generation_size_in_bytes(), params->args,
|
||||
params->exec_args);
|
||||
js_env_->isolate(), js_env_->isolate()->GetCurrentContext(),
|
||||
js_env_->platform(), js_env_->max_young_generation_size_in_bytes(),
|
||||
params->args, params->exec_args);
|
||||
|
||||
// Override the default handler set by NodeBindings.
|
||||
node_env_->isolate()->SetFatalErrorHandler(V8FatalErrorCallback);
|
||||
|
|
|
@ -131,8 +131,8 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
v8::Local<v8::Value> unused,
|
||||
v8::Local<v8::Context> context,
|
||||
void* priv) {
|
||||
v8::Isolate* isolate = context->GetIsolate();
|
||||
gin_helper::Dictionary dict(isolate, exports);
|
||||
v8::Isolate* const isolate = v8::Isolate::GetCurrent();
|
||||
gin_helper::Dictionary dict{isolate, exports};
|
||||
dict.SetMethod("createParentPort", &electron::ParentPort::Create);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue