summaryrefslogtreecommitdiff
path: root/src/process_wrap.cc
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2015-01-07 14:13:35 -0800
committerTrevor Norris <trev.norris@gmail.com>2015-01-07 14:21:02 -0800
commitcbf76c1f2f0e36a707e70cf9c6a8a251b6ac3f26 (patch)
tree5f7d34980bae628553d0ef83b786f8b5166201e4 /src/process_wrap.cc
parentd55338662329ac37386783ef1aa88f099eff86b2 (diff)
downloadandroid-node-v8-cbf76c1f2f0e36a707e70cf9c6a8a251b6ac3f26.tar.gz
android-node-v8-cbf76c1f2f0e36a707e70cf9c6a8a251b6ac3f26.tar.bz2
android-node-v8-cbf76c1f2f0e36a707e70cf9c6a8a251b6ac3f26.zip
src: pass Isolate to node::Utf8Value constructor
Initial attempt to remove all uses of Isolate::GetCurrent(). Still exists a few locations, but this works out a heavy usage. PR-URL: https://github.com/iojs/io.js/pull/244 Reviewed-by: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'src/process_wrap.cc')
-rw-r--r--src/process_wrap.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/process_wrap.cc b/src/process_wrap.cc
index 5368e2803b..c1bffcb11f 100644
--- a/src/process_wrap.cc
+++ b/src/process_wrap.cc
@@ -167,7 +167,8 @@ class ProcessWrap : public HandleWrap {
// options.file
Local<Value> file_v = js_options->Get(env->file_string());
- node::Utf8Value file(file_v->IsString() ? file_v : Local<Value>());
+ node::Utf8Value file(env->isolate(),
+ file_v->IsString() ? file_v : Local<Value>());
if (file.length() > 0) {
options.file = *file;
} else {
@@ -182,7 +183,7 @@ class ProcessWrap : public HandleWrap {
// Heap allocate to detect errors. +1 is for nullptr.
options.args = new char*[argc + 1];
for (int i = 0; i < argc; i++) {
- node::Utf8Value arg(js_argv->Get(i));
+ node::Utf8Value arg(env->isolate(), js_argv->Get(i));
options.args[i] = strdup(*arg);
}
options.args[argc] = nullptr;
@@ -190,7 +191,8 @@ class ProcessWrap : public HandleWrap {
// options.cwd
Local<Value> cwd_v = js_options->Get(env->cwd_string());
- node::Utf8Value cwd(cwd_v->IsString() ? cwd_v : Local<Value>());
+ node::Utf8Value cwd(env->isolate(),
+ cwd_v->IsString() ? cwd_v : Local<Value>());
if (cwd.length() > 0) {
options.cwd = *cwd;
}
@@ -198,11 +200,11 @@ class ProcessWrap : public HandleWrap {
// options.env
Local<Value> env_v = js_options->Get(env->env_pairs_string());
if (!env_v.IsEmpty() && env_v->IsArray()) {
- Local<Array> env = Local<Array>::Cast(env_v);
- int envc = env->Length();
+ Local<Array> env_opt = Local<Array>::Cast(env_v);
+ int envc = env_opt->Length();
options.env = new char*[envc + 1]; // Heap allocated to detect errors.
for (int i = 0; i < envc; i++) {
- node::Utf8Value pair(env->Get(i));
+ node::Utf8Value pair(env->isolate(), env_opt->Get(i));
options.env[i] = strdup(*pair);
}
options.env[envc] = nullptr;