summaryrefslogtreecommitdiff
path: root/src/req_wrap.h
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2012-04-13 16:27:23 -0700
committerisaacs <i@izs.me>2012-04-17 13:14:55 -0700
commit10ce3d129d4e466842a03545fdfdfc011e0b9fba (patch)
treef77a5ab8cd316a3503c6117a94d28538a8e6e4b9 /src/req_wrap.h
parent963459d736d6594de641aff4d8767da113359457 (diff)
downloadandroid-node-v8-10ce3d129d4e466842a03545fdfdfc011e0b9fba.tar.gz
android-node-v8-10ce3d129d4e466842a03545fdfdfc011e0b9fba.tar.bz2
android-node-v8-10ce3d129d4e466842a03545fdfdfc011e0b9fba.zip
Domain hooks in ReqWrap<T> and MakeCallback
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);