Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/node.cc')
-rw-r--r--src/node.cc19
1 files changed, 7 insertions, 12 deletions
diff --git a/src/node.cc b/src/node.cc
index bf401ed5c45..21e7afe3a0d 100644
--- a/src/node.cc
+++ b/src/node.cc
@@ -198,8 +198,8 @@ MaybeLocal<Value> ExecuteBootstrapper(Environment* env,
int Environment::InitializeInspector(
std::unique_ptr<inspector::ParentInspectorHandle> parent_handle) {
std::string inspector_path;
+ bool is_main = !parent_handle;
if (parent_handle) {
- DCHECK(!is_main_thread());
inspector_path = parent_handle->url();
inspector_agent_->SetParentHandle(std::move(parent_handle));
} else {
@@ -213,7 +213,7 @@ int Environment::InitializeInspector(
inspector_agent_->Start(inspector_path,
options_->debug_options(),
inspector_host_port(),
- is_main_thread());
+ is_main);
if (options_->debug_options().inspector_enabled &&
!inspector_agent_->IsListening()) {
return 12; // Signal internal error
@@ -402,7 +402,7 @@ MaybeLocal<Value> StartExecution(Environment* env, const char* main_script_id) {
ExecuteBootstrapper(env, main_script_id, &parameters, &arguments));
}
-MaybeLocal<Value> StartMainThreadExecution(Environment* env) {
+MaybeLocal<Value> StartExecution(Environment* env) {
// To allow people to extend Node in different ways, this hook allows
// one to drop a file lib/_third_party_main.js into the build
// directory which will be executed instead of Node's normal loading.
@@ -410,6 +410,10 @@ MaybeLocal<Value> StartMainThreadExecution(Environment* env) {
return StartExecution(env, "internal/main/run_third_party_main");
}
+ if (env->worker_context() != nullptr) {
+ return StartExecution(env, "internal/main/worker_thread");
+ }
+
std::string first_argv;
if (env->argv().size() > 1) {
first_argv = env->argv()[1];
@@ -448,15 +452,6 @@ MaybeLocal<Value> StartMainThreadExecution(Environment* env) {
return StartExecution(env, "internal/main/eval_stdin");
}
-void LoadEnvironment(Environment* env) {
- CHECK(env->is_main_thread());
- // TODO(joyeecheung): Not all of the execution modes in
- // StartMainThreadExecution() make sense for embedders. Pick the
- // useful ones out, and allow embedders to customize the entry
- // point more directly without using _third_party_main.js
- USE(StartMainThreadExecution(env));
-}
-
#ifdef __POSIX__
typedef void (*sigaction_cb)(int signo, siginfo_t* info, void* ucontext);
#endif