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:
shelley vohr 2018-01-06 07:58:24 -08:00 committed by Cheng Zhao
parent 31eb5e26e3
commit 0e5b6f9300
44 changed files with 137 additions and 98 deletions

View file

@ -12,6 +12,7 @@
#include "atom/common/api/atom_bindings.h" #include "atom/common/api/atom_bindings.h"
#include "atom/common/crash_reporter/crash_reporter.h" #include "atom/common/crash_reporter/crash_reporter.h"
#include "atom/common/native_mate_converters/string16_converter.h" #include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/node_bindings.h"
#include "base/command_line.h" #include "base/command_line.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/task_scheduler/task_scheduler.h" #include "base/task_scheduler/task_scheduler.h"
@ -50,14 +51,16 @@ int NodeMain(int argc, char *argv[]) {
// Initialize gin::IsolateHolder. // Initialize gin::IsolateHolder.
JavascriptEnvironment gin_env; JavascriptEnvironment gin_env;
// Explicitly register electron's builtin modules.
NodeBindings::RegisterBuiltinModules();
int exec_argc; int exec_argc;
const char** exec_argv; const char** exec_argv;
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &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( node::Environment* env = node::CreateEnvironment(
&isolate_data, gin_env.context(), argc, argv, node::CreateIsolateData(gin_env.isolate(), loop, gin_env.platform()),
exec_argc, exec_argv); gin_env.context(), argc, argv, exec_argc, exec_argv);
// Enable support for v8 inspector. // Enable support for v8 inspector.
NodeDebugger node_debugger(env); NodeDebugger node_debugger(env);
@ -79,6 +82,7 @@ int NodeMain(int argc, char *argv[]) {
bool more; bool more;
do { do {
more = uv_run(env->event_loop(), UV_RUN_ONCE); more = uv_run(env->event_loop(), UV_RUN_ONCE);
gin_env.platform()->DrainBackgroundTasks(env->isolate());
if (more == false) { if (more == false) {
node::EmitBeforeExit(env); node::EmitBeforeExit(env);
@ -92,6 +96,8 @@ int NodeMain(int argc, char *argv[]) {
exit_code = node::EmitExit(env); exit_code = node::EmitExit(env);
node::RunAtExit(env); node::RunAtExit(env);
gin_env.platform()->DrainBackgroundTasks(env->isolate());
gin_env.platform()->CancelPendingDelayedTasks(env->isolate());
node::FreeEnvironment(env); node::FreeEnvironment(env);
} }

View file

@ -1342,4 +1342,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_app, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_app, Initialize)

View file

@ -150,4 +150,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_auto_updater, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_auto_updater, Initialize)

View file

@ -162,4 +162,4 @@ void Initialize(v8::Local<v8::Object> exports,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_browser_view, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_browser_view, Initialize)

View file

@ -1332,4 +1332,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_window, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_window, Initialize)

View file

@ -73,4 +73,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_content_tracing, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_content_tracing, Initialize)

View file

@ -178,4 +178,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_debugger, Initialize); NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_debugger, Initialize);

View file

@ -114,4 +114,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_desktop_capturer, Initialize); NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_desktop_capturer, Initialize);

View file

@ -140,4 +140,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_dialog, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_dialog, Initialize)

View file

@ -236,4 +236,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_download_item, Initialize); NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_download_item, Initialize);

View file

@ -98,4 +98,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_global_shortcut, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_global_shortcut, Initialize)

View file

@ -228,4 +228,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_menu, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_menu, Initialize)

View file

@ -58,4 +58,4 @@ void Initialize(v8::Local<v8::Object> exports,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_net, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_net, Initialize)

View file

@ -270,4 +270,4 @@ void Initialize(v8::Local<v8::Object> exports,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_notification, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_notification, Initialize)

View file

@ -103,4 +103,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_power_monitor, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_monitor, Initialize)

View file

@ -133,4 +133,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_power_save_blocker, Initialize); NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_power_save_blocker, Initialize);

View file

@ -253,4 +253,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_protocol, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_protocol, Initialize)

View file

@ -86,5 +86,5 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_render_process_preferences, NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_render_process_preferences,
Initialize) Initialize)

View file

@ -144,4 +144,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_screen, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_screen, Initialize)

View file

@ -839,4 +839,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_session, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_session, Initialize)

View file

@ -96,4 +96,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_system_preferences, Initialize); NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_system_preferences, Initialize);

View file

@ -250,4 +250,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_tray, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_tray, Initialize)

View file

@ -2034,4 +2034,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_web_contents, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_contents, Initialize)

View file

@ -52,4 +52,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_browser_web_view_manager, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_browser_web_view_manager, Initialize)

View file

@ -135,8 +135,8 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
node_bindings_->Initialize(); node_bindings_->Initialize();
// Create the global environment. // Create the global environment.
node::Environment* env = node::Environment* env = node_bindings_->CreateEnvironment(
node_bindings_->CreateEnvironment(js_env_->context()); js_env_->context(), js_env_->platform());
node_env_.reset(new NodeEnvironment(env)); node_env_.reset(new NodeEnvironment(env));
// Enable support for v8 inspector // Enable support for v8 inspector

View file

@ -15,6 +15,7 @@
#include "gin/v8_initializer.h" #include "gin/v8_initializer.h"
#include "atom/common/node_includes.h" #include "atom/common/node_includes.h"
#include "vendor/node/src/tracing/trace_event.h"
namespace atom { namespace atom {
@ -48,10 +49,10 @@ bool JavascriptEnvironment::Initialize() {
// The V8Platform of gin relies on Chromium's task schedule, which has not // 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. // been started at this point, so we have to rely on Node's V8Platform.
platform_ = node::CreatePlatform( platform_ = node::CreatePlatform(
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0), nullptr);
uv_default_loop(), nullptr);
v8::V8::InitializePlatform(platform_); v8::V8::InitializePlatform(platform_);
node::tracing::TraceEventHelper::SetTracingController(
new v8::TracingController());
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
gin::IsolateHolder::kStableV8Extras, gin::IsolateHolder::kStableV8Extras,
gin::ArrayBufferAllocator::SharedInstance(), gin::ArrayBufferAllocator::SharedInstance(),

View file

@ -10,7 +10,7 @@
namespace node { namespace node {
class Environment; class Environment;
class NodePlatform; class MultiIsolatePlatform;
} }
namespace atom { namespace atom {
@ -23,7 +23,7 @@ class JavascriptEnvironment {
void OnMessageLoopCreated(); void OnMessageLoopCreated();
void OnMessageLoopDestroying(); void OnMessageLoopDestroying();
node::NodePlatform* platform() const { return platform_; } node::MultiIsolatePlatform* platform() const { return platform_; }
v8::Isolate* isolate() const { return isolate_; } v8::Isolate* isolate() const { return isolate_; }
v8::Local<v8::Context> context() const { v8::Local<v8::Context> context() const {
return v8::Local<v8::Context>::New(isolate_, context_); return v8::Local<v8::Context>::New(isolate_, context_);
@ -33,7 +33,7 @@ class JavascriptEnvironment {
bool Initialize(); bool Initialize();
// Leaked on exit. // Leaked on exit.
node::NodePlatform* platform_; node::MultiIsolatePlatform* platform_;
bool initialized_; bool initialized_;
gin::IsolateHolder isolate_holder_; gin::IsolateHolder isolate_holder_;

View file

@ -20,7 +20,7 @@ NodeDebugger::NodeDebugger(node::Environment* env)
NodeDebugger::~NodeDebugger() { NodeDebugger::~NodeDebugger() {
} }
void NodeDebugger::Start(node::NodePlatform* platform) { void NodeDebugger::Start(node::MultiIsolatePlatform* platform) {
auto inspector = env_->inspector_agent(); auto inspector = env_->inspector_agent();
if (inspector == nullptr) if (inspector == nullptr)
return; return;
@ -34,7 +34,6 @@ void NodeDebugger::Start(node::NodePlatform* platform) {
#endif #endif
} }
if (options.inspector_enabled()) {
// Set process._debugWaitConnect if --inspect-brk was specified to stop // Set process._debugWaitConnect if --inspect-brk was specified to stop
// the debugger on the first line // the debugger on the first line
if (options.wait_for_connect()) { if (options.wait_for_connect()) {
@ -42,8 +41,9 @@ void NodeDebugger::Start(node::NodePlatform* platform) {
process.Set("_breakFirstLine", true); 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 } // namespace atom

View file

@ -9,7 +9,7 @@
namespace node { namespace node {
class Environment; class Environment;
class NodePlatform; class MultiIsolatePlatform;
} }
namespace atom { namespace atom {
@ -20,7 +20,7 @@ class NodeDebugger {
explicit NodeDebugger(node::Environment* env); explicit NodeDebugger(node::Environment* env);
~NodeDebugger(); ~NodeDebugger();
void Start(node::NodePlatform* platform); void Start(node::MultiIsolatePlatform* platform);
private: private:
node::Environment* env_; node::Environment* env_;

View file

@ -163,4 +163,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_asar, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_asar, Initialize)

View file

@ -255,4 +255,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_clipboard, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_clipboard, Initialize)

View file

@ -61,4 +61,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_crash_reporter, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_crash_reporter, Initialize)

View file

@ -636,4 +636,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_native_image, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_native_image, Initialize)

View file

@ -151,4 +151,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_shell, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_shell, Initialize)

View file

@ -123,4 +123,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_common_v8_util, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_common_v8_util, Initialize)

View file

@ -27,45 +27,48 @@
#include "atom/common/node_includes.h" #include "atom/common/node_includes.h"
// Force all builtin modules to be referenced so they can actually run their #define ELECTRON_BUILTIN_MODULES(V) \
// DSO constructors, see http://git.io/DRIqCg. V(atom_browser_app) \
#define REFERENCE_MODULE(name) \ V(atom_browser_auto_updater) \
extern "C" void _register_ ## name(void); \ V(atom_browser_browser_view) \
void (*fp_register_ ## name)(void) = _register_ ## name V(atom_browser_content_tracing) \
// Electron's builtin modules. V(atom_browser_debugger) \
REFERENCE_MODULE(atom_browser_app); V(atom_browser_desktop_capturer) \
REFERENCE_MODULE(atom_browser_auto_updater); V(atom_browser_dialog) \
REFERENCE_MODULE(atom_browser_browser_view); V(atom_browser_download_item) \
REFERENCE_MODULE(atom_browser_content_tracing); V(atom_browser_global_shortcut) \
REFERENCE_MODULE(atom_browser_debugger); V(atom_browser_in_app_purchase) \
REFERENCE_MODULE(atom_browser_desktop_capturer); V(atom_browser_menu) \
REFERENCE_MODULE(atom_browser_dialog); V(atom_browser_net) \
REFERENCE_MODULE(atom_browser_download_item); V(atom_browser_power_monitor) \
REFERENCE_MODULE(atom_browser_global_shortcut); V(atom_browser_power_save_blocker) \
REFERENCE_MODULE(atom_browser_in_app_purchase); V(atom_browser_protocol) \
REFERENCE_MODULE(atom_browser_menu); V(atom_browser_render_process_preferences) \
REFERENCE_MODULE(atom_browser_net); V(atom_browser_session) \
REFERENCE_MODULE(atom_browser_power_monitor); V(atom_browser_system_preferences) \
REFERENCE_MODULE(atom_browser_power_save_blocker); V(atom_browser_tray) \
REFERENCE_MODULE(atom_browser_protocol); V(atom_browser_web_contents) \
REFERENCE_MODULE(atom_browser_render_process_preferences); V(atom_browser_web_view_manager) \
REFERENCE_MODULE(atom_browser_session); V(atom_browser_window) \
REFERENCE_MODULE(atom_browser_system_preferences); V(atom_common_asar) \
REFERENCE_MODULE(atom_browser_tray); V(atom_common_clipboard) \
REFERENCE_MODULE(atom_browser_web_contents); V(atom_common_crash_reporter) \
REFERENCE_MODULE(atom_browser_web_view_manager); V(atom_common_native_image) \
REFERENCE_MODULE(atom_browser_window); V(atom_common_notification) \
REFERENCE_MODULE(atom_common_asar); V(atom_common_screen) \
REFERENCE_MODULE(atom_common_clipboard); V(atom_common_shell) \
REFERENCE_MODULE(atom_common_crash_reporter); V(atom_common_v8_util) \
REFERENCE_MODULE(atom_common_native_image); V(atom_renderer_ipc) \
REFERENCE_MODULE(atom_common_notification); V(atom_renderer_web_frame)
REFERENCE_MODULE(atom_common_screen);
REFERENCE_MODULE(atom_common_shell); // This is used to load built-in modules. Instead of using
REFERENCE_MODULE(atom_common_v8_util); // __attribute__((constructor)), we call the _register_<modname>
REFERENCE_MODULE(atom_renderer_ipc); // function for each built-in modules explicitly. This is only
REFERENCE_MODULE(atom_renderer_web_frame); // forward declaration. The definitions are in each module's
#undef REFERENCE_MODULE // implementation when calling the NODE_BUILTIN_MODULE_CONTEXT_AWARE.
#define V(modname) void _register_##modname();
ELECTRON_BUILTIN_MODULES(V)
#undef V
namespace { namespace {
@ -155,6 +158,12 @@ NodeBindings::~NodeBindings() {
stop_and_close_uv_loop(uv_loop_); stop_and_close_uv_loop(uv_loop_);
} }
void NodeBindings::RegisterBuiltinModules() {
#define V(modname) _register_##modname();
ELECTRON_BUILTIN_MODULES(V)
#undef V
}
void NodeBindings::Initialize() { void NodeBindings::Initialize() {
// Open node's error reporting system for browser process. // Open node's error reporting system for browser process.
node::g_standalone_mode = browser_env_ == BROWSER; node::g_standalone_mode = browser_env_ == BROWSER;
@ -166,6 +175,9 @@ void NodeBindings::Initialize() {
AtomCommandLine::InitializeFromCommandLine(); AtomCommandLine::InitializeFromCommandLine();
#endif #endif
// Explicitly register electron's builtin modules.
RegisterBuiltinModules();
// Init node. // Init node.
// (we assume node::Init would not modify the parameters under embedded mode). // (we assume node::Init would not modify the parameters under embedded mode).
node::Init(nullptr, nullptr, nullptr, nullptr); node::Init(nullptr, nullptr, nullptr, nullptr);
@ -180,6 +192,7 @@ void NodeBindings::Initialize() {
} }
node::Environment* NodeBindings::CreateEnvironment( node::Environment* NodeBindings::CreateEnvironment(
<<<<<<< c1acc6cb5c9591122cecfcf3910c73d62d28eaf7
v8::Handle<v8::Context> context) { v8::Handle<v8::Context> context) {
#if defined(OS_WIN) #if defined(OS_WIN)
auto& atom_args = AtomCommandLine::argv(); auto& atom_args = AtomCommandLine::argv();
@ -187,6 +200,10 @@ node::Environment* NodeBindings::CreateEnvironment(
std::transform(atom_args.cbegin(), atom_args.cend(), args.begin(), std::transform(atom_args.cbegin(), atom_args.cend(), args.begin(),
[](auto& a) { return base::WideToUTF8(a); }); [](auto& a) { return base::WideToUTF8(a); });
#else #else
=======
v8::Handle<v8::Context> context,
node::MultiIsolatePlatform* platform) {
>>>>>>> Upgrade to node v9.3.0 (#11507)
auto args = AtomCommandLine::argv(); auto args = AtomCommandLine::argv();
#endif #endif
@ -212,8 +229,8 @@ node::Environment* NodeBindings::CreateEnvironment(
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args); std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
node::Environment* env = node::CreateEnvironment( node::Environment* env = node::CreateEnvironment(
new node::IsolateData(context->GetIsolate(), uv_loop_), context, node::CreateIsolateData(context->GetIsolate(), uv_loop_, platform),
args.size(), c_argv.get(), 0, nullptr); context, args.size(), c_argv.get(), 0, nullptr);
if (browser_env_ == BROWSER) { if (browser_env_ == BROWSER) {
// SetAutorunMicrotasks is no longer called in node::CreateEnvironment // SetAutorunMicrotasks is no longer called in node::CreateEnvironment

View file

@ -17,6 +17,7 @@ class MessageLoop;
namespace node { namespace node {
class Environment; class Environment;
class MultiIsolatePlatform;
} }
namespace atom { namespace atom {
@ -30,6 +31,7 @@ class NodeBindings {
}; };
static NodeBindings* Create(BrowserEnvironment browser_env); static NodeBindings* Create(BrowserEnvironment browser_env);
static void RegisterBuiltinModules();
virtual ~NodeBindings(); virtual ~NodeBindings();
@ -37,7 +39,9 @@ class NodeBindings {
void Initialize(); void Initialize();
// Create the environment and load node.js. // 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. // Load node.js in the environment.
void LoadEnvironment(node::Environment* env); void LoadEnvironment(node::Environment* env);

View file

@ -76,4 +76,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace atom } // namespace atom
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_renderer_ipc, atom::api::Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_renderer_ipc, atom::api::Initialize)

View file

@ -429,4 +429,4 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
} // namespace } // namespace
NODE_MODULE_CONTEXT_AWARE_BUILTIN(atom_renderer_web_frame, Initialize) NODE_BUILTIN_MODULE_CONTEXT_AWARE(atom_renderer_web_frame, Initialize)

View file

@ -25,6 +25,7 @@
#include "atom/common/node_includes.h" #include "atom/common/node_includes.h"
#include "atom_natives.h" // NOLINT: This file is generated with js2c #include "atom_natives.h" // NOLINT: This file is generated with js2c
#include "vendor/node/src/tracing/trace_event.h"
namespace atom { namespace atom {
@ -95,6 +96,11 @@ void AtomRendererClient::DidCreateScriptContext(
node_bindings_->PrepareMessageLoop(); 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. // Setup node environment for each window.
node::Environment* env = node_bindings_->CreateEnvironment(context); node::Environment* env = node_bindings_->CreateEnvironment(context);

View file

@ -11,6 +11,7 @@
#include "atom/common/native_mate_converters/string16_converter.h" #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/v8_value_converter.h"
#include "atom/common/native_mate_converters/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/common/options_switches.h"
#include "atom/renderer/api/atom_api_renderer_ipc.h" #include "atom/renderer/api/atom_api_renderer_ipc.h"
#include "atom/renderer/atom_render_view_observer.h" #include "atom/renderer/atom_render_view_observer.h"
@ -136,6 +137,8 @@ class AtomSandboxedRenderViewObserver : public AtomRenderViewObserver {
AtomSandboxedRendererClient::AtomSandboxedRendererClient() { AtomSandboxedRendererClient::AtomSandboxedRendererClient() {
// Explicitly register electron's builtin modules.
NodeBindings::RegisterBuiltinModules();
} }
AtomSandboxedRendererClient::~AtomSandboxedRendererClient() { AtomSandboxedRendererClient::~AtomSandboxedRendererClient() {

View file

@ -13,6 +13,8 @@
'component%': 'static_library', 'component%': 'static_library',
'debug_http2': 'false', 'debug_http2': 'false',
'debug_nghttp2': 'false', 'debug_nghttp2': 'false',
# XXX(alexeykuzmin): Must match the clang version we use. See `clang -v`.
'llvm_version': '6.0',
'python': 'python', 'python': 'python',
'openssl_fips': '', 'openssl_fips': '',
'openssl_no_asm': 1, 'openssl_no_asm': 1,

@ -1 +1 @@
Subproject commit 86a86703137e54b0299bd76421093fdfdb94c531 Subproject commit f8ff573e503dea08f8ef05a2773bf3b0aa8dfdb1

2
vendor/node vendored

@ -1 +1 @@
Subproject commit 618ed0431bbd1a96fc88d2b6b36ad3086d418ffd Subproject commit 7fe5e2f60f6f40363ec0d77fd17b241208663534