Initialize things in the same sequence with main process
This commit is contained in:
parent
ed9579a2f7
commit
2d410ede48
5 changed files with 11 additions and 13 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include "base/at_exit.h"
|
#include "base/at_exit.h"
|
||||||
#include "base/i18n/icu_util.h"
|
#include "base/i18n/icu_util.h"
|
||||||
#include "base/mac/bundle_locations.h"
|
#include "base/mac/bundle_locations.h"
|
||||||
|
#include "base/mac/scoped_nsautorelease_pool.h"
|
||||||
#include "brightray/common/mac/main_application_bundle.h"
|
#include "brightray/common/mac/main_application_bundle.h"
|
||||||
#include "content/public/app/content_main.h"
|
#include "content/public/app/content_main.h"
|
||||||
|
|
||||||
|
@ -25,6 +26,7 @@ int AtomMain(int argc, const char* argv[]) {
|
||||||
|
|
||||||
int AtomInitializeICUandStartNode(int argc, char *argv[]) {
|
int AtomInitializeICUandStartNode(int argc, char *argv[]) {
|
||||||
base::AtExitManager atexit_manager;
|
base::AtExitManager atexit_manager;
|
||||||
|
base::mac::ScopedNSAutoreleasePool pool;
|
||||||
base::mac::SetOverrideFrameworkBundlePath(
|
base::mac::SetOverrideFrameworkBundlePath(
|
||||||
brightray::MainApplicationBundlePath()
|
brightray::MainApplicationBundlePath()
|
||||||
.Append("Contents")
|
.Append("Contents")
|
||||||
|
|
|
@ -7,8 +7,8 @@
|
||||||
#include "atom/app/uv_task_runner.h"
|
#include "atom/app/uv_task_runner.h"
|
||||||
#include "atom/browser/javascript_environment.h"
|
#include "atom/browser/javascript_environment.h"
|
||||||
#include "atom/browser/node_debugger.h"
|
#include "atom/browser/node_debugger.h"
|
||||||
#include "atom/common/node_includes.h"
|
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
|
#include "atom/common/node_includes.h"
|
||||||
#include "base/thread_task_runner_handle.h"
|
#include "base/thread_task_runner_handle.h"
|
||||||
#include "gin/array_buffer.h"
|
#include "gin/array_buffer.h"
|
||||||
#include "gin/public/isolate_holder.h"
|
#include "gin/public/isolate_holder.h"
|
||||||
|
@ -19,25 +19,22 @@ namespace atom {
|
||||||
int NodeMain(int argc, char *argv[]) {
|
int NodeMain(int argc, char *argv[]) {
|
||||||
base::CommandLine::Init(argc, argv);
|
base::CommandLine::Init(argc, argv);
|
||||||
|
|
||||||
argv = uv_setup_args(argc, argv);
|
|
||||||
int exec_argc;
|
|
||||||
const char** exec_argv;
|
|
||||||
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
|
|
||||||
|
|
||||||
int exit_code = 1;
|
int exit_code = 1;
|
||||||
{
|
{
|
||||||
// Feed gin::PerIsolateData with a task runner.
|
// Feed gin::PerIsolateData with a task runner.
|
||||||
|
argv = uv_setup_args(argc, argv);
|
||||||
uv_loop_t* loop = uv_default_loop();
|
uv_loop_t* loop = uv_default_loop();
|
||||||
scoped_refptr<UvTaskRunner> uv_task_runner(new UvTaskRunner(loop));
|
scoped_refptr<UvTaskRunner> uv_task_runner(new UvTaskRunner(loop));
|
||||||
base::ThreadTaskRunnerHandle handle(uv_task_runner);
|
base::ThreadTaskRunnerHandle handle(uv_task_runner);
|
||||||
|
|
||||||
gin::V8Initializer::LoadV8Snapshot();
|
gin::V8Initializer::LoadV8Snapshot();
|
||||||
gin::V8Initializer::LoadV8Natives();
|
gin::V8Initializer::LoadV8Natives();
|
||||||
gin::IsolateHolder::Initialize(
|
|
||||||
gin::IsolateHolder::kNonStrictMode,
|
|
||||||
gin::ArrayBufferAllocator::SharedInstance());
|
|
||||||
|
|
||||||
JavascriptEnvironment gin_env;
|
JavascriptEnvironment gin_env;
|
||||||
|
|
||||||
|
int exec_argc;
|
||||||
|
const char** exec_argv;
|
||||||
|
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
|
||||||
|
|
||||||
node::Environment* env = node::CreateEnvironment(
|
node::Environment* env = node::CreateEnvironment(
|
||||||
gin_env.isolate(), loop, gin_env.context(), argc, argv,
|
gin_env.isolate(), loop, gin_env.context(), argc, argv,
|
||||||
exec_argc, exec_argv);
|
exec_argc, exec_argv);
|
||||||
|
|
|
@ -20,7 +20,6 @@ JavascriptEnvironment::JavascriptEnvironment()
|
||||||
}
|
}
|
||||||
|
|
||||||
bool JavascriptEnvironment::Initialize() {
|
bool JavascriptEnvironment::Initialize() {
|
||||||
gin::V8Initializer::LoadV8Snapshot();
|
|
||||||
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode,
|
||||||
gin::ArrayBufferAllocator::SharedInstance());
|
gin::ArrayBufferAllocator::SharedInstance());
|
||||||
return true;
|
return true;
|
||||||
|
|
2
vendor/brightray
vendored
2
vendor/brightray
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit f1cbfd1d457f9b40bca23a2f30948a093d6048a9
|
Subproject commit 49a86c123f4cc43f4dca886ded612104a8a1fec6
|
2
vendor/node
vendored
2
vendor/node
vendored
|
@ -1 +1 @@
|
||||||
Subproject commit f4243f5c84a371632d8d72a1a2210a0e994afdcc
|
Subproject commit edfbc29d09425f2f387c52d77f6351b6ce101659
|
Loading…
Add table
Reference in a new issue