Upgrade to node 7.4
This commit is contained in:
parent
43067e01e9
commit
54e2c480cb
10 changed files with 35 additions and 15 deletions
|
@ -48,8 +48,9 @@ int NodeMain(int argc, char *argv[]) {
|
|||
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(
|
||||
gin_env.isolate(), loop, gin_env.context(), argc, argv,
|
||||
&isolate_data, gin_env.context(), argc, argv,
|
||||
exec_argc, exec_argv);
|
||||
|
||||
// Start our custom debugger implementation.
|
||||
|
|
|
@ -129,9 +129,13 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
|
|||
// Support the "--debug" switch.
|
||||
node_debugger_.reset(new NodeDebugger(js_env_->isolate()));
|
||||
|
||||
isolate_data_.reset(
|
||||
new node::IsolateData(js_env_->isolate(), uv_default_loop()));
|
||||
|
||||
// Create the global environment.
|
||||
node::Environment* env =
|
||||
node_bindings_->CreateEnvironment(js_env_->context());
|
||||
node_bindings_->CreateEnvironment(isolate_data_.get(),
|
||||
js_env_->context());
|
||||
|
||||
// Make sure node can get correct environment when debugging.
|
||||
if (node_debugger_->IsRunning())
|
||||
|
|
|
@ -15,6 +15,10 @@
|
|||
|
||||
class BrowserProcess;
|
||||
|
||||
namespace node {
|
||||
class IsolateData;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
||||
class AtomBindings;
|
||||
|
@ -82,6 +86,7 @@ class AtomBrowserMainParts : public brightray::BrowserMainParts {
|
|||
std::unique_ptr<NodeBindings> node_bindings_;
|
||||
std::unique_ptr<AtomBindings> atom_bindings_;
|
||||
std::unique_ptr<NodeDebugger> node_debugger_;
|
||||
std::unique_ptr<node::IsolateData> isolate_data_;
|
||||
|
||||
base::Timer gc_timer_;
|
||||
|
||||
|
|
|
@ -132,12 +132,12 @@ void InitAsarSupport(v8::Isolate* isolate,
|
|||
v8::Local<v8::Value> require) {
|
||||
// Evaluate asar_init.coffee.
|
||||
const char* asar_init_native = reinterpret_cast<const char*>(
|
||||
static_cast<const unsigned char*>(node::asar_init_native));
|
||||
static_cast<const unsigned char*>(node::asar_init_data));
|
||||
v8::Local<v8::Script> asar_init = v8::Script::Compile(v8::String::NewFromUtf8(
|
||||
isolate,
|
||||
asar_init_native,
|
||||
v8::String::kNormalString,
|
||||
sizeof(node::asar_init_native) -1));
|
||||
sizeof(node::asar_init_data) -1));
|
||||
v8::Local<v8::Value> result = asar_init->Run();
|
||||
|
||||
// Initialize asar support.
|
||||
|
@ -146,10 +146,10 @@ void InitAsarSupport(v8::Isolate* isolate,
|
|||
std::string)> init;
|
||||
if (mate::ConvertFromV8(isolate, result, &init)) {
|
||||
const char* asar_native = reinterpret_cast<const char*>(
|
||||
static_cast<const unsigned char*>(node::asar_native));
|
||||
static_cast<const unsigned char*>(node::asar_data));
|
||||
init.Run(process,
|
||||
require,
|
||||
std::string(asar_native, sizeof(node::asar_native) - 1));
|
||||
std::string(asar_native, sizeof(node::asar_data) - 1));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -144,7 +144,7 @@ void NodeBindings::Initialize() {
|
|||
}
|
||||
|
||||
node::Environment* NodeBindings::CreateEnvironment(
|
||||
v8::Handle<v8::Context> context) {
|
||||
node::IsolateData* isolate_data, v8::Handle<v8::Context> context) {
|
||||
auto args = AtomCommandLine::argv();
|
||||
|
||||
// Feed node the path to initialization script.
|
||||
|
@ -160,7 +160,7 @@ node::Environment* NodeBindings::CreateEnvironment(
|
|||
|
||||
std::unique_ptr<const char*[]> c_argv = StringVectorToArgArray(args);
|
||||
node::Environment* env = node::CreateEnvironment(
|
||||
context->GetIsolate(), uv_default_loop(), context,
|
||||
isolate_data, context,
|
||||
args.size(), c_argv.get(), 0, nullptr);
|
||||
|
||||
// Node uses the deprecated SetAutorunMicrotasks(false) mode, we should switch
|
||||
|
|
|
@ -16,6 +16,7 @@ class MessageLoop;
|
|||
|
||||
namespace node {
|
||||
class Environment;
|
||||
class IsolateData;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
@ -30,7 +31,8 @@ class NodeBindings {
|
|||
void Initialize();
|
||||
|
||||
// Create the environment and load node.js.
|
||||
node::Environment* CreateEnvironment(v8::Handle<v8::Context> context);
|
||||
node::Environment* CreateEnvironment(node::IsolateData* isolate_data,
|
||||
v8::Handle<v8::Context> context);
|
||||
|
||||
// Load node.js in the environment.
|
||||
void LoadEnvironment(node::Environment* env);
|
||||
|
|
|
@ -103,8 +103,8 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
|||
|
||||
// Wrap the bundle into a function that receives the binding object as
|
||||
// an argument.
|
||||
std::string bundle(node::isolated_bundle_native,
|
||||
node::isolated_bundle_native + sizeof(node::isolated_bundle_native));
|
||||
std::string bundle(node::isolated_bundle_data,
|
||||
node::isolated_bundle_data + sizeof(node::isolated_bundle_data));
|
||||
std::string wrapper = "(function (binding) {\n" + bundle + "\n})";
|
||||
auto script = v8::Script::Compile(
|
||||
mate::ConvertToV8(isolate, wrapper)->ToString());
|
||||
|
@ -349,10 +349,13 @@ void AtomRendererClient::DidCreateScriptContext(
|
|||
if (first_time) {
|
||||
node_bindings_->Initialize();
|
||||
node_bindings_->PrepareMessageLoop();
|
||||
isolate_data_.reset(new node::IsolateData(context->GetIsolate(),
|
||||
uv_default_loop()));
|
||||
}
|
||||
|
||||
// Setup node environment for each window.
|
||||
node::Environment* env = node_bindings_->CreateEnvironment(context);
|
||||
node::Environment* env =
|
||||
node_bindings_->CreateEnvironment(isolate_data_.get(), context);
|
||||
|
||||
// Add Electron extended APIs.
|
||||
atom_bindings_->BindTo(env->isolate(), env->process_object());
|
||||
|
|
|
@ -10,6 +10,10 @@
|
|||
|
||||
#include "content/public/renderer/content_renderer_client.h"
|
||||
|
||||
namespace node {
|
||||
class IsolateData;
|
||||
}
|
||||
|
||||
namespace atom {
|
||||
|
||||
class AtomBindings;
|
||||
|
@ -69,6 +73,7 @@ class AtomRendererClient : public content::ContentRendererClient {
|
|||
std::unique_ptr<NodeBindings> node_bindings_;
|
||||
std::unique_ptr<AtomBindings> atom_bindings_;
|
||||
std::unique_ptr<PreferencesManager> preferences_manager_;
|
||||
std::unique_ptr<node::IsolateData> isolate_data_;
|
||||
bool isolated_world_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomRendererClient);
|
||||
|
|
|
@ -144,8 +144,8 @@ void AtomSandboxedRendererClient::DidCreateScriptContext(
|
|||
v8::Context::Scope context_scope(context);
|
||||
// Wrap the bundle into a function that receives the binding object and the
|
||||
// preload script path as arguments.
|
||||
std::string preload_bundle_native(node::preload_bundle_native,
|
||||
node::preload_bundle_native + sizeof(node::preload_bundle_native));
|
||||
std::string preload_bundle_native(node::preload_bundle_data,
|
||||
node::preload_bundle_data + sizeof(node::preload_bundle_data));
|
||||
std::stringstream ss;
|
||||
ss << "(function(binding, preloadPath) {\n";
|
||||
ss << preload_bundle_native << "\n";
|
||||
|
|
2
vendor/node
vendored
2
vendor/node
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 811cfe3fcd360179d3dd436e3d80e1b045adf633
|
||||
Subproject commit b1069b6dd5321a6e5cf2f7fea68a85ac4a2df24b
|
Loading…
Reference in a new issue