src: fix minor inefficiency in Buffer::New() call

Commit ccb199a ("src: fix deprecation warnings") passes env()->isolate()
to the Buffer::New() call.  It's somewhat inefficient because the callee
looks up the environment from the isolate.  Just pass the env directly.

PR-URL: https://github.com/iojs/io.js/pull/1577
Reviewed-By: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
Ben Noordhuis 2015-05-01 17:25:18 +02:00
parent f696c9efab
commit 2ed10f1349
2 changed files with 4 additions and 4 deletions

View File

@ -165,9 +165,9 @@ void SyncProcessStdioPipe::Close() {
}
Local<Object> SyncProcessStdioPipe::GetOutputAsBuffer(Isolate* isolate) const {
Local<Object> SyncProcessStdioPipe::GetOutputAsBuffer(Environment* env) const {
size_t length = OutputLength();
Local<Object> js_buffer = Buffer::New(isolate, length);
Local<Object> js_buffer = Buffer::New(env, length);
CopyOutput(Buffer::Data(js_buffer));
return js_buffer;
}
@ -679,7 +679,7 @@ Local<Array> SyncProcessRunner::BuildOutputArray() {
for (uint32_t i = 0; i < stdio_count_; i++) {
SyncProcessStdioPipe* h = stdio_pipes_[i];
if (h != nullptr && h->writable())
js_output->Set(i, h->GetOutputAsBuffer(env()->isolate()));
js_output->Set(i, h->GetOutputAsBuffer(env()));
else
js_output->Set(i, Null(env()->isolate()));
}

View File

@ -72,7 +72,7 @@ class SyncProcessStdioPipe {
int Start();
void Close();
Local<Object> GetOutputAsBuffer(Isolate* isolate) const;
Local<Object> GetOutputAsBuffer(Environment* env) const;
inline bool readable() const;
inline bool writable() const;