Upgrade to node v9.3.0 (#11507)
* update submodule refs for node v9.3.0 * Define "llvm_version" for Node.js build * NODE_MODULE_CONTEXT_AWARE_BUILTIN -> NODE_BUILTIN_MODULE_CONTEXT_AWARE * update NodePlatform to MultiIsolatePlatform * fix linting error * update node ref * REVIEW: Explicitly register builtin modules https://github.com/nodejs/node/pull/16565 * update libcc ref * switch libcc to c62 * REVIEW: Address node api changes - Always start the inspector agent for https://github.com/nodejs/node/pull/17085 - Set the tracing controller for node https://github.com/nodejs/node/pull/15538 - Isolate data creation now requires plaform https://github.com/nodejs/node/pull/16700
This commit is contained in:
parent
31eb5e26e3
commit
0e5b6f9300
44 changed files with 137 additions and 98 deletions
|
@ -12,6 +12,7 @@
|
|||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/crash_reporter/crash_reporter.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "atom/common/node_bindings.h"
|
||||
#include "base/command_line.h"
|
||||
#include "base/feature_list.h"
|
||||
#include "base/task_scheduler/task_scheduler.h"
|
||||
|
@ -50,14 +51,16 @@ int NodeMain(int argc, char *argv[]) {
|
|||
// Initialize gin::IsolateHolder.
|
||||
JavascriptEnvironment gin_env;
|
||||
|
||||
// Explicitly register electron's builtin modules.
|
||||
NodeBindings::RegisterBuiltinModules();
|
||||
|
||||
int exec_argc;
|
||||
const char** exec_argv;
|
||||
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
|
||||
|
||||
node::IsolateData isolate_data(gin_env.isolate(), loop);
|
||||
node::Environment* env = node::CreateEnvironment(
|
||||
&isolate_data, gin_env.context(), argc, argv,
|
||||
exec_argc, exec_argv);
|
||||
node::CreateIsolateData(gin_env.isolate(), loop, gin_env.platform()),
|
||||
gin_env.context(), argc, argv, exec_argc, exec_argv);
|
||||
|
||||
// Enable support for v8 inspector.
|
||||
NodeDebugger node_debugger(env);
|
||||
|
@ -79,6 +82,7 @@ int NodeMain(int argc, char *argv[]) {
|
|||
bool more;
|
||||
do {
|
||||
more = uv_run(env->event_loop(), UV_RUN_ONCE);
|
||||
gin_env.platform()->DrainBackgroundTasks(env->isolate());
|
||||
if (more == false) {
|
||||
node::EmitBeforeExit(env);
|
||||
|
||||
|
@ -92,6 +96,8 @@ int NodeMain(int argc, char *argv[]) {
|
|||
|
||||
exit_code = node::EmitExit(env);
|
||||
node::RunAtExit(env);
|
||||
gin_env.platform()->DrainBackgroundTasks(env->isolate());
|
||||
gin_env.platform()->CancelPendingDelayedTasks(env->isolate());
|
||||
|
||||
node::FreeEnvironment(env);
|
||||
}
|
||||
|
|
|
@ -1342,4 +1342,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_app, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_app, Initialize)
|
||||
|
|
|
@ -150,4 +150,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_auto_updater, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_auto_updater, Initialize)
|
||||
|
|
|
@ -162,4 +162,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_browser_view, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_browser_view, Initialize)
|
||||
|
|
|
@ -1332,4 +1332,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_window, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_window, Initialize)
|
||||
|
|
|
@ -73,4 +73,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_content_tracing, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_content_tracing, Initialize)
|
||||
|
|
|
@ -178,4 +178,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_debugger, Initialize);
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_debugger, Initialize);
|
||||
|
|
|
@ -114,4 +114,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_desktop_capturer, Initialize);
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_desktop_capturer, Initialize);
|
||||
|
|
|
@ -140,4 +140,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_dialog, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_dialog, Initialize)
|
||||
|
|
|
@ -236,4 +236,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_download_item, Initialize);
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_download_item, Initialize);
|
||||
|
|
|
@ -98,4 +98,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_global_shortcut, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_global_shortcut, Initialize)
|
||||
|
|
|
@ -228,4 +228,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_menu, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_menu, Initialize)
|
||||
|
|
|
@ -58,4 +58,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_net, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_net, Initialize)
|
||||
|
|
|
@ -270,4 +270,4 @@ void Initialize(v8::Local<v8::Object> exports,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_notification, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_notification, Initialize)
|
||||
|
|
|
@ -103,4 +103,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_power_monitor, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_monitor, Initialize)
|
||||
|
|
|
@ -133,4 +133,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_power_save_blocker, Initialize);
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_save_blocker, Initialize);
|
||||
|
|
|
@ -253,4 +253,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_protocol, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_protocol, Initialize)
|
||||
|
|
|
@ -86,5 +86,5 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_render_process_preferences,
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_render_process_preferences,
|
||||
Initialize)
|
||||
|
|
|
@ -144,4 +144,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_screen, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_screen, Initialize)
|
||||
|
|
|
@ -839,4 +839,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_session, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_session, Initialize)
|
||||
|
|
|
@ -96,4 +96,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_system_preferences, Initialize);
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_system_preferences, Initialize);
|
||||
|
|
|
@ -250,4 +250,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_tray, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_tray, Initialize)
|
||||
|
|
|
@ -2034,4 +2034,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_web_contents, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_contents, Initialize)
|
||||
|
|
|
@ -52,4 +52,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_web_view_manager, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_view_manager, Initialize)
|
||||
|
|
|
@ -135,8 +135,8 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
|
|||
node_bindings_->Initialize();
|
||||
|
||||
// Create the global environment.
|
||||
node::Environment* env =
|
||||
node_bindings_->CreateEnvironment(js_env_->context());
|
||||
node::Environment* env = node_bindings_->CreateEnvironment(
|
||||
js_env_->context(), js_env_->platform());
|
||||
node_env_.reset(new NodeEnvironment(env));
|
||||
|
||||
// Enable support for v8 inspector
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "gin/v8_initializer.h"
|
||||
|
||||
#include "atom/common/node_includes.h"
|
||||
#include "vendor/node/src/tracing/trace_event.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -48,10 +49,10 @@ bool JavascriptEnvironment::Initialize() {
|
|||
// The V8Platform of gin relies on Chromium's task schedule, which has not
|
||||
// been started at this point, so we have to rely on Node's V8Platform.
|
||||
platform_ = node::CreatePlatform(
|
||||
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
|
||||
uv_default_loop(), nullptr);
|
||||
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), nullptr);
|
||||
v8::V8::InitializePlatform(platform_);
|
||||
|
||||
node::tracing::TraceEventHelper::SetTracingController(
|
||||
new v8::TracingController());
|
||||
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
||||
gin::IsolateHolder::kStableV8Extras,
|
||||
gin::ArrayBufferAllocator::SharedInstance(),
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
|
||||
namespace node {
|
||||
class Environment;
|
||||
class NodePlatform;
|
||||
class MultiIsolatePlatform;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
@ -23,7 +23,7 @@ class JavascriptEnvironment {
|
|||
void OnMessageLoopCreated();
|
||||
void OnMessageLoopDestroying();
|
||||
|
||||
node::NodePlatform* platform() const { return platform_; }
|
||||
node::MultiIsolatePlatform* platform() const { return platform_; }
|
||||
v8::Isolate* isolate() const { return isolate_; }
|
||||
v8::Local<v8::Context> context() const {
|
||||
return v8::Local<v8::Context>::New(isolate_, context_);
|
||||
|
@ -33,7 +33,7 @@ class JavascriptEnvironment {
|
|||
bool Initialize();
|
||||
|
||||
// Leaked on exit.
|
||||
node::NodePlatform* platform_;
|
||||
node::MultiIsolatePlatform* platform_;
|
||||
|
||||
bool initialized_;
|
||||
gin::IsolateHolder isolate_holder_;
|
||||
|
|
|
@ -20,7 +20,7 @@ NodeDebugger::NodeDebugger(node::Environment* env)
|
|||
NodeDebugger::~NodeDebugger() {
|
||||
}
|
||||
|
||||
void NodeDebugger::Start(node::NodePlatform* platform) {
|
||||
void NodeDebugger::Start(node::MultiIsolatePlatform* platform) {
|
||||
auto inspector = env_->inspector_agent();
|
||||
if (inspector == nullptr)
|
||||
return;
|
||||
|
@ -34,7 +34,6 @@ void NodeDebugger::Start(node::NodePlatform* platform) {
|
|||
#endif
|
||||
}
|
||||
|
||||
if (options.inspector_enabled()) {
|
||||
// Set process._debugWaitConnect if --inspect-brk was specified to stop
|
||||
// the debugger on the first line
|
||||
if (options.wait_for_connect()) {
|
||||
|
@ -42,8 +41,9 @@ void NodeDebugger::Start(node::NodePlatform* platform) {
|
|||
process.Set("_breakFirstLine", true);
|
||||
}
|
||||
|
||||
inspector->Start(platform, nullptr, options);
|
||||
}
|
||||
inspector->Start(static_cast<node::NodePlatform*>(platform), nullptr,
|
||||
options);
|
||||
DCHECK(env_->inspector_agent()->IsStarted());
|
||||
}
|
||||
|
||||
} // namespace atom
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace node {
|
||||
class Environment;
|
||||
class NodePlatform;
|
||||
class MultiIsolatePlatform;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
@ -20,7 +20,7 @@ class NodeDebugger {
|
|||
explicit NodeDebugger(node::Environment* env);
|
||||
~NodeDebugger();
|
||||
|
||||
void Start(node::NodePlatform* platform);
|
||||
void Start(node::MultiIsolatePlatform* platform);
|
||||
|
||||
private:
|
||||
node::Environment* env_;
|
||||
|
|
|
@ -163,4 +163,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_asar, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_asar, Initialize)
|
||||
|
|
|
@ -255,4 +255,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_clipboard, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_clipboard, Initialize)
|
||||
|
|
|
@ -61,4 +61,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_crash_reporter, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_crash_reporter, Initialize)
|
||||
|
|
|
@ -636,4 +636,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_native_image, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_native_image, Initialize)
|
||||
|
|
|
@ -151,4 +151,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_shell, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_shell, Initialize)
|
||||
|
|
|
@ -123,4 +123,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_v8_util, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_v8_util, Initialize)
|
||||
|
|
|
@ -27,45 +27,48 @@
|
|||
|
||||
#include "atom/common/node_includes.h"
|
||||
|
||||
// Force all builtin modules to be referenced so they can actually run their
|
||||
// DSO constructors, see http://git.io/DRIqCg.
|
||||
#define REFERENCE_MODULE(name) \
|
||||
extern "C" void _register_ ## name(void); \
|
||||
void (*fp_register_ ## name)(void) = _register_ ## name
|
||||
// Electron's builtin modules.
|
||||
REFERENCE_MODULE(atom_browser_app);
|
||||
REFERENCE_MODULE(atom_browser_auto_updater);
|
||||
REFERENCE_MODULE(atom_browser_browser_view);
|
||||
REFERENCE_MODULE(atom_browser_content_tracing);
|
||||
REFERENCE_MODULE(atom_browser_debugger);
|
||||
REFERENCE_MODULE(atom_browser_desktop_capturer);
|
||||
REFERENCE_MODULE(atom_browser_dialog);
|
||||
REFERENCE_MODULE(atom_browser_download_item);
|
||||
REFERENCE_MODULE(atom_browser_global_shortcut);
|
||||
REFERENCE_MODULE(atom_browser_in_app_purchase);
|
||||
REFERENCE_MODULE(atom_browser_menu);
|
||||
REFERENCE_MODULE(atom_browser_net);
|
||||
REFERENCE_MODULE(atom_browser_power_monitor);
|
||||
REFERENCE_MODULE(atom_browser_power_save_blocker);
|
||||
REFERENCE_MODULE(atom_browser_protocol);
|
||||
REFERENCE_MODULE(atom_browser_render_process_preferences);
|
||||
REFERENCE_MODULE(atom_browser_session);
|
||||
REFERENCE_MODULE(atom_browser_system_preferences);
|
||||
REFERENCE_MODULE(atom_browser_tray);
|
||||
REFERENCE_MODULE(atom_browser_web_contents);
|
||||
REFERENCE_MODULE(atom_browser_web_view_manager);
|
||||
REFERENCE_MODULE(atom_browser_window);
|
||||
REFERENCE_MODULE(atom_common_asar);
|
||||
REFERENCE_MODULE(atom_common_clipboard);
|
||||
REFERENCE_MODULE(atom_common_crash_reporter);
|
||||
REFERENCE_MODULE(atom_common_native_image);
|
||||
REFERENCE_MODULE(atom_common_notification);
|
||||
REFERENCE_MODULE(atom_common_screen);
|
||||
REFERENCE_MODULE(atom_common_shell);
|
||||
REFERENCE_MODULE(atom_common_v8_util);
|
||||
REFERENCE_MODULE(atom_renderer_ipc);
|
||||
REFERENCE_MODULE(atom_renderer_web_frame);
|
||||
#undef REFERENCE_MODULE
|
||||
#define ELECTRON_BUILTIN_MODULES(V) \
|
||||
V(atom_browser_app) \
|
||||
V(atom_browser_auto_updater) \
|
||||
V(atom_browser_browser_view) \
|
||||
V(atom_browser_content_tracing) \
|
||||
V(atom_browser_debugger) \
|
||||
V(atom_browser_desktop_capturer) \
|
||||
V(atom_browser_dialog) \
|
||||
V(atom_browser_download_item) \
|
||||
V(atom_browser_global_shortcut) \
|
||||
V(atom_browser_in_app_purchase) \
|
||||
V(atom_browser_menu) \
|
||||
V(atom_browser_net) \
|
||||
V(atom_browser_power_monitor) \
|
||||
V(atom_browser_power_save_blocker) \
|
||||
V(atom_browser_protocol) \
|
||||
V(atom_browser_render_process_preferences) \
|
||||
V(atom_browser_session) \
|
||||
V(atom_browser_system_preferences) \
|
||||
V(atom_browser_tray) \
|
||||
V(atom_browser_web_contents) \
|
||||
V(atom_browser_web_view_manager) \
|
||||
V(atom_browser_window) \
|
||||
V(atom_common_asar) \
|
||||
V(atom_common_clipboard) \
|
||||
V(atom_common_crash_reporter) \
|
||||
V(atom_common_native_image) \
|
||||
V(atom_common_notification) \
|
||||
V(atom_common_screen) \
|
||||
V(atom_common_shell) \
|
||||
V(atom_common_v8_util) \
|
||||
V(atom_renderer_ipc) \
|
||||
V(atom_renderer_web_frame)
|
||||
|
||||
// This is used to load built-in modules. Instead of using
|
||||
// __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.
|
||||
#define V(modname) void _register_##modname();
|
||||
ELECTRON_BUILTIN_MODULES(V)
|
||||
#undef V
|
||||
|
||||
namespace {
|
||||
|
||||
|
@ -155,6 +158,12 @@ NodeBindings::~NodeBindings() {
|
|||
stop_and_close_uv_loop(uv_loop_);
|
||||
}
|
||||
|
||||
void NodeBindings::RegisterBuiltinModules() {
|
||||
#define V(modname) _register_##modname();
|
||||
ELECTRON_BUILTIN_MODULES(V)
|
||||
#undef V
|
||||
}
|
||||
|
||||
void NodeBindings::Initialize() {
|
||||
// Open node's error reporting system for browser process.
|
||||
node::g_standalone_mode = browser_env_ == BROWSER;
|
||||
|
@ -166,6 +175,9 @@ void NodeBindings::Initialize() {
|
|||
AtomCommandLine::InitializeFromCommandLine();
|
||||
#endif
|
||||
|
||||
// Explicitly register electron's builtin modules.
|
||||
RegisterBuiltinModules();
|
||||
|
||||
// Init node.
|
||||
// (we assume node::Init would not modify the parameters under embedded mode).
|
||||
node::Init(nullptr, nullptr, nullptr, nullptr);
|
||||
|
@ -180,6 +192,7 @@ void NodeBindings::Initialize() {
|
|||
}
|
||||
|
||||
node::Environment* NodeBindings::CreateEnvironment(
|
||||
<<<<<<< c1acc6cb5c9591122cecfcf3910c73d62d28eaf7
|
||||
v8::Handle<v8::Context> context) {
|
||||
#if defined(OS_WIN)
|
||||
auto& atom_args = AtomCommandLine::argv();
|
||||
|
@ -187,6 +200,10 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
std::transform(atom_args.cbegin(), atom_args.cend(), args.begin(),
|
||||
[](auto& a) { return base::WideToUTF8(a); });
|
||||
#else
|
||||
=======
|
||||
v8::Handle<v8::Context> context,
|
||||
node::MultiIsolatePlatform* platform) {
|
||||
>>>>>>> Upgrade to node v9.3.0 (#11507)
|
||||
auto args = AtomCommandLine::argv();
|
||||
#endif
|
||||
|
||||
|
@ -212,8 +229,8 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
|
||||
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
|
||||
node::Environment* env = node::CreateEnvironment(
|
||||
new node::IsolateData(context->GetIsolate(), uv_loop_), context,
|
||||
args.size(), c_argv.get(), 0, nullptr);
|
||||
node::CreateIsolateData(context->GetIsolate(), uv_loop_, platform),
|
||||
context, args.size(), c_argv.get(), 0, nullptr);
|
||||
|
||||
if (browser_env_ == BROWSER) {
|
||||
// SetAutorunMicrotasks is no longer called in node::CreateEnvironment
|
||||
|
|
|
@ -17,6 +17,7 @@ class MessageLoop;
|
|||
|
||||
namespace node {
|
||||
class Environment;
|
||||
class MultiIsolatePlatform;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
@ -30,6 +31,7 @@ class NodeBindings {
|
|||
};
|
||||
|
||||
static NodeBindings* Create(BrowserEnvironment browser_env);
|
||||
static void RegisterBuiltinModules();
|
||||
|
||||
virtual ~NodeBindings();
|
||||
|
||||
|
@ -37,7 +39,9 @@ class NodeBindings {
|
|||
void Initialize();
|
||||
|
||||
// Create the environment and load node.js.
|
||||
node::Environment* CreateEnvironment(v8::Handle<v8::Context> context);
|
||||
node::Environment* CreateEnvironment(
|
||||
v8::Handle<v8::Context> context,
|
||||
node::MultiIsolatePlatform* platform = nullptr);
|
||||
|
||||
// Load node.js in the environment.
|
||||
void LoadEnvironment(node::Environment* env);
|
||||
|
|
|
@ -76,4 +76,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace atom
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_renderer_ipc, atom::api::Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_renderer_ipc, atom::api::Initialize)
|
||||
|
|
|
@ -429,4 +429,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
|||
|
||||
} // namespace
|
||||
|
||||
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_renderer_web_frame, Initialize)
|
||||
NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_renderer_web_frame, Initialize)
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
|
||||
#include "atom/common/node_includes.h"
|
||||
#include "atom_natives.h" // NOLINT: This file is generated with js2c
|
||||
#include "vendor/node/src/tracing/trace_event.h"
|
||||
|
||||
namespace atom {
|
||||
|
||||
|
@ -95,6 +96,11 @@ void AtomRendererClient::DidCreateScriptContext(
|
|||
node_bindings_->PrepareMessageLoop();
|
||||
}
|
||||
|
||||
// Setup node tracing controller.
|
||||
if (!node::tracing::TraceEventHelper::GetTracingController())
|
||||
node::tracing::TraceEventHelper::SetTracingController(
|
||||
new v8::TracingController());
|
||||
|
||||
// Setup node environment for each window.
|
||||
node::Environment* env = node_bindings_->CreateEnvironment(context);
|
||||
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "atom/common/native_mate_converters/v8_value_converter.h"
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
#include "atom/common/node_bindings.h"
|
||||
#include "atom/common/options_switches.h"
|
||||
#include "atom/renderer/api/atom_api_renderer_ipc.h"
|
||||
#include "atom/renderer/atom_render_view_observer.h"
|
||||
|
@ -136,6 +137,8 @@ class AtomSandboxedRenderViewObserver : public AtomRenderViewObserver {
|
|||
|
||||
|
||||
AtomSandboxedRendererClient::AtomSandboxedRendererClient() {
|
||||
// Explicitly register electron's builtin modules.
|
||||
NodeBindings::RegisterBuiltinModules();
|
||||
}
|
||||
|
||||
AtomSandboxedRendererClient::~AtomSandboxedRendererClient() {
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
'component%': 'static_library',
|
||||
'debug_http2': 'false',
|
||||
'debug_nghttp2': 'false',
|
||||
# XXX(alexeykuzmin): Must match the clang version we use. See `clang -v`.
|
||||
'llvm_version': '6.0',
|
||||
'python': 'python',
|
||||
'openssl_fips': '',
|
||||
'openssl_no_asm': 1,
|
||||
|
|
2
vendor/libchromiumcontent
vendored
2
vendor/libchromiumcontent
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 86a86703137e54b0299bd76421093fdfdb94c531
|
||||
Subproject commit f8ff573e503dea08f8ef05a2773bf3b0aa8dfdb1
|
2
vendor/node
vendored
2
vendor/node
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 618ed0431bbd1a96fc88d2b6b36ad3086d418ffd
|
||||
Subproject commit 7fe5e2f60f6f40363ec0d77fd17b241208663534
|
Loading…
Add table
Add a link
Reference in a new issue