зеркало из https://github.com/electron/electron.git
refactor: load electron builtin modules with process._linkedBinding (#17247)
* refactor: load electron builtin modules with process._linkedBinding NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are removed in https://github.com/nodejs/node/pull/25829. This changes uses the alternative available without any functionality change. * chore: roll node
This commit is contained in:
Родитель
e5e6aa207c
Коммит
5afb7dc715
2
DEPS
2
DEPS
|
@ -12,7 +12,7 @@ vars = {
|
|||
'chromium_version':
|
||||
'73.0.3683.68',
|
||||
'node_version':
|
||||
'70a78f07b1c4d53f3da462b08cef42a4ff8f949f',
|
||||
'5e32b02e3c180c9997d60fe85042d335b6d9a588',
|
||||
|
||||
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
|
||||
'pyyaml_version': '3.12',
|
||||
|
|
|
@ -1425,4 +1425,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_app, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_app, Initialize)
|
||||
|
|
|
@ -154,4 +154,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_auto_updater, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_auto_updater, Initialize)
|
||||
|
|
|
@ -180,4 +180,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_browser_view, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_browser_view, Initialize)
|
||||
|
|
|
@ -481,4 +481,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_window, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_window, Initialize)
|
||||
|
|
|
@ -148,4 +148,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_content_tracing, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_content_tracing, Initialize)
|
||||
|
|
|
@ -205,4 +205,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_debugger, Initialize);
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_debugger, Initialize);
|
||||
|
|
|
@ -232,4 +232,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_desktop_capturer, Initialize);
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_desktop_capturer, Initialize);
|
||||
|
|
|
@ -104,4 +104,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_dialog, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_dialog, Initialize)
|
||||
|
|
|
@ -251,4 +251,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_download_item, Initialize);
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_download_item, Initialize);
|
||||
|
|
|
@ -23,4 +23,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_event, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_event, Initialize)
|
||||
|
|
|
@ -166,4 +166,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_global_shortcut, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_global_shortcut, Initialize)
|
||||
|
|
|
@ -140,4 +140,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_in_app_purchase, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_in_app_purchase, Initialize)
|
||||
|
|
|
@ -257,4 +257,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_menu, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_menu, Initialize)
|
||||
|
|
|
@ -61,4 +61,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_net, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_net, Initialize)
|
||||
|
|
|
@ -272,4 +272,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_notification, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_notification, Initialize)
|
||||
|
|
|
@ -148,4 +148,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_monitor, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_power_monitor, Initialize)
|
||||
|
|
|
@ -151,4 +151,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_save_blocker, Initialize);
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_power_save_blocker, Initialize);
|
||||
|
|
|
@ -317,4 +317,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_protocol, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_protocol, Initialize)
|
||||
|
|
|
@ -87,5 +87,5 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_render_process_preferences,
|
||||
Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_render_process_preferences,
|
||||
Initialize)
|
||||
|
|
|
@ -171,4 +171,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_screen, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_screen, Initialize)
|
||||
|
|
|
@ -826,4 +826,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_session, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_session, Initialize)
|
||||
|
|
|
@ -130,4 +130,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_system_preferences, Initialize);
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_system_preferences, Initialize);
|
||||
|
|
|
@ -1195,4 +1195,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_top_level_window, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_top_level_window, Initialize)
|
||||
|
|
|
@ -261,4 +261,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_tray, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_tray, Initialize)
|
||||
|
|
|
@ -86,4 +86,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_view, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_view, Initialize)
|
||||
|
|
|
@ -2283,4 +2283,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_contents, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_web_contents, Initialize)
|
||||
|
|
|
@ -131,4 +131,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_contents_view, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_web_contents_view, Initialize)
|
||||
|
|
|
@ -55,4 +55,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_view_manager, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_web_view_manager, Initialize)
|
||||
|
|
|
@ -84,4 +84,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_box_layout, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_box_layout, Initialize)
|
||||
|
|
|
@ -57,4 +57,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_button, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_button, Initialize)
|
||||
|
|
|
@ -77,4 +77,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_label_button, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_label_button, Initialize)
|
||||
|
|
|
@ -60,4 +60,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_layout_manager, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_layout_manager, Initialize)
|
||||
|
|
|
@ -54,4 +54,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_md_text_button, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_md_text_button, Initialize)
|
||||
|
|
|
@ -57,4 +57,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_resize_area, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_resize_area, Initialize)
|
||||
|
|
|
@ -64,4 +64,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_text_field, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_browser_text_field, Initialize)
|
||||
|
|
|
@ -144,4 +144,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_asar, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_asar, Initialize)
|
||||
|
|
|
@ -227,4 +227,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_clipboard, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_clipboard, Initialize)
|
||||
|
|
|
@ -58,4 +58,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_command_line, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_command_line, Initialize)
|
||||
|
|
|
@ -66,4 +66,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_crash_reporter, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_crash_reporter, Initialize)
|
||||
|
|
|
@ -623,4 +623,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_native_image, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_native_image, Initialize)
|
||||
|
|
|
@ -170,4 +170,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_shell, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_shell, Initialize)
|
||||
|
|
|
@ -126,4 +126,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_v8_util, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_v8_util, Initialize)
|
||||
|
|
|
@ -61,4 +61,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_features, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_common_features, Initialize)
|
||||
|
|
|
@ -84,7 +84,7 @@
|
|||
// __attribute__((constructor)), we call the _register_<modname>
|
||||
// function for each built-in modules explicitly. This is only
|
||||
// forward declaration. The definitions are in each module's
|
||||
// implementation when calling the NODE_BUILTIN_MODULE_CONTEXT_AWARE.
|
||||
// implementation when calling the NODE_LINKED_MODULE_CONTEXT_AWARE.
|
||||
#define V(modname) void _register_##modname();
|
||||
ELECTRON_BUILTIN_MODULES(V)
|
||||
#if BUILDFLAG(ENABLE_VIEW_API)
|
||||
|
|
|
@ -53,6 +53,12 @@
|
|||
#include "node_options.h"
|
||||
#include "node_platform.h"
|
||||
|
||||
// Alternative to NODE_MODULE_CONTEXT_AWARE_X.
|
||||
// Allows to explicitly register builtin modules instead of using
|
||||
// __attribute__((constructor)).
|
||||
#define NODE_LINKED_MODULE_CONTEXT_AWARE(modname, regfunc) \
|
||||
NODE_MODULE_CONTEXT_AWARE_CPP(modname, regfunc, nullptr, NM_F_LINKED)
|
||||
|
||||
#pragma pop_macro("ASSERT")
|
||||
#pragma pop_macro("CHECK")
|
||||
#pragma pop_macro("CHECK_EQ")
|
||||
|
|
|
@ -107,4 +107,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_renderer_ipc, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_renderer_ipc, Initialize)
|
||||
|
|
|
@ -548,4 +548,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_renderer_web_frame, Initialize)
|
||||
NODE_LINKED_MODULE_CONTEXT_AWARE(atom_renderer_web_frame, Initialize)
|
||||
|
|
|
@ -68,7 +68,7 @@ v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
|
|||
return exports;
|
||||
}
|
||||
|
||||
auto* mod = node::binding::get_builtin_module(module_key.c_str());
|
||||
auto* mod = node::binding::get_linked_module(module_key.c_str());
|
||||
|
||||
if (!mod) {
|
||||
char errmsg[1024];
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
export function atomBindingSetup (binding: typeof process['binding'], processType: typeof process['type']): typeof process['atomBinding'] {
|
||||
export function atomBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['atomBinding'] {
|
||||
return function atomBinding (name: string) {
|
||||
try {
|
||||
return binding(`atom_${processType}_${name}`)
|
||||
|
|
|
@ -3,7 +3,7 @@ import * as util from 'util'
|
|||
|
||||
import { atomBindingSetup } from '@electron/internal/common/atom-binding-setup'
|
||||
|
||||
process.atomBinding = atomBindingSetup(process.binding, process.type)
|
||||
process.atomBinding = atomBindingSetup(process._linkedBinding, process.type)
|
||||
|
||||
type AnyFn = (...args: any[]) => any
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ declare namespace NodeJS {
|
|||
/**
|
||||
* DO NOT USE DIRECTLY, USE process.atomBinding
|
||||
*/
|
||||
binding(name: string): any;
|
||||
_linkedBinding(name: string): any;
|
||||
atomBinding(name: string): any;
|
||||
atomBinding(name: 'features'): FeaturesBinding;
|
||||
atomBinding(name: 'v8_util'): V8UtilBinding;
|
||||
|
|
Загрузка…
Ссылка в новой задаче