summaryrefslogtreecommitdiff
path: root/src/env.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/env.cc')
-rw-r--r--src/env.cc26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/env.cc b/src/env.cc
index 97405fe4b1..9c854f6f3f 100644
--- a/src/env.cc
+++ b/src/env.cc
@@ -48,6 +48,8 @@ IsolateData::IsolateData(Isolate* isolate,
if (platform_ != nullptr)
platform_->RegisterIsolate(this, event_loop);
+ options_.reset(new PerIsolateOptions(*per_process_opts->per_isolate));
+
// Create string and private symbol properties as internalized one byte
// strings after the platform is properly initialized.
//
@@ -136,9 +138,6 @@ Environment::Environment(IsolateData* isolate_data,
makecallback_cntr_(0),
should_abort_on_uncaught_toggle_(isolate_, 1),
trace_category_state_(isolate_, kTraceCategoryCount),
-#if HAVE_INSPECTOR
- inspector_agent_(new inspector::Agent(this)),
-#endif
http_parser_buffer_(nullptr),
fs_stats_field_array_(isolate_, kFsStatsFieldsLength * 2),
fs_stats_field_bigint_array_(isolate_, kFsStatsFieldsLength * 2),
@@ -148,6 +147,19 @@ Environment::Environment(IsolateData* isolate_data,
v8::Context::Scope context_scope(context);
set_as_external(v8::External::New(isolate(), this));
+ // We create new copies of the per-Environment option sets, so that it is
+ // easier to modify them after Environment creation. The defaults are
+ // part of the per-Isolate option set, for which in turn the defaults are
+ // part of the per-process option set.
+ options_.reset(new EnvironmentOptions(*isolate_data->options()->per_env));
+ options_->debug_options.reset(new DebugOptions(*options_->debug_options));
+
+#if HAVE_INSPECTOR
+ // We can only create the inspector agent after having cloned the options.
+ inspector_agent_ =
+ std::unique_ptr<inspector::Agent>(new inspector::Agent(this));
+#endif
+
AssignToContext(context, ContextInfo(""));
if (tracing_agent_writer_ != nullptr) {
@@ -211,10 +223,8 @@ Environment::~Environment() {
delete[] http_parser_buffer_;
}
-void Environment::Start(int argc,
- const char* const* argv,
- int exec_argc,
- const char* const* exec_argv,
+void Environment::Start(const std::vector<std::string>& args,
+ const std::vector<std::string>& exec_args,
bool start_profiler_idle_notifier) {
HandleScope handle_scope(isolate());
Context::Scope context_scope(context());
@@ -260,7 +270,7 @@ void Environment::Start(int argc,
process_template->GetFunction()->NewInstance(context()).ToLocalChecked();
set_process_object(process_object);
- SetupProcessObject(this, argc, argv, exec_argc, exec_argv);
+ SetupProcessObject(this, args, exec_args);
static uv_once_t init_once = UV_ONCE_INIT;
uv_once(&init_once, InitThreadLocalOnce);