summaryrefslogtreecommitdiff
path: root/src/req_wrap.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/req_wrap.h')
-rw-r--r--src/req_wrap.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/req_wrap.h b/src/req_wrap.h
index b8530e8950..c478ce0cdb 100644
--- a/src/req_wrap.h
+++ b/src/req_wrap.h
@@ -24,14 +24,35 @@
namespace node {
+static v8::Persistent<v8::String> process_symbol;
+static v8::Persistent<v8::String> domain_symbol;
+
template <typename T>
class ReqWrap {
public:
ReqWrap() {
v8::HandleScope scope;
object_ = v8::Persistent<v8::Object>::New(v8::Object::New());
+
+ // TODO: grab a handle to the current process.domain
+ if (process_symbol.IsEmpty()) {
+ process_symbol = NODE_PSYMBOL("process");
+ domain_symbol = NODE_PSYMBOL("domain");
+ }
+
+ v8::Local<v8::Value> domain = v8::Context::GetCurrent()
+ ->Global()
+ ->Get(process_symbol)
+ ->ToObject()
+ ->Get(domain_symbol);
+
+ if (!domain->IsUndefined()) {
+ // fprintf(stderr, "setting domain on ReqWrap\n");
+ object_->Set(domain_symbol, domain);
+ }
}
+
~ReqWrap() {
// Assert that someone has called Dispatched()
assert(req_.data == this);