req_wrap: only grab domain object if in use

pull/5010/head
Trevor Norris 2013-04-09 15:31:22 -07:00 committed by Ben Noordhuis
parent deda899d77
commit 8428b52e25
1 changed files with 10 additions and 8 deletions

View File

@ -23,6 +23,7 @@
#define REQ_WRAP_H_ #define REQ_WRAP_H_
#include "ngx-queue.h" #include "ngx-queue.h"
#include "node_internals.h"
namespace node { namespace node {
@ -38,15 +39,16 @@ class ReqWrap {
v8::HandleScope scope(node_isolate); v8::HandleScope scope(node_isolate);
object_ = v8::Persistent<v8::Object>::New(node_isolate, v8::Object::New()); object_ = v8::Persistent<v8::Object>::New(node_isolate, v8::Object::New());
v8::Local<v8::Value> domain = v8::Context::GetCurrent() if (using_domains) {
->Global() v8::Local<v8::Value> domain = v8::Context::GetCurrent()
->Get(process_symbol) ->Global()
->ToObject() ->Get(process_symbol)
->Get(domain_symbol); ->ToObject()
->Get(domain_symbol);
if (!domain->IsUndefined()) { if (!domain->IsUndefined()) {
// fprintf(stderr, "setting domain on ReqWrap\n"); object_->Set(domain_symbol, domain);
object_->Set(domain_symbol, domain); }
} }
ngx_queue_insert_tail(&req_wrap_queue, &req_wrap_queue_); ngx_queue_insert_tail(&req_wrap_queue, &req_wrap_queue_);