src: replace Holder() with This()
authorTrevor Norris <trev.norris@gmail.com>
Thu, 18 Apr 2013 23:52:07 +0000 (16:52 -0700)
committerBen Noordhuis <info@bnoordhuis.nl>
Fri, 19 Apr 2013 13:24:01 +0000 (15:24 +0200)
Switch to always use args.This() to retrieve object instance.

src/fs_event_wrap.cc
src/handle_wrap.cc
src/handle_wrap.h
src/node_crypto.cc
src/node_crypto.h
src/node_internals.h
src/node_script.cc
src/node_stat_watcher.cc

index 0df58c7..78b7cf1 100644 (file)
@@ -171,9 +171,9 @@ Handle<Value> FSEventWrap::Close(const Arguments& args) {
   // Unwrap manually here. The UNWRAP() macro asserts that wrap != NULL.
   // That usually indicates an error but not here: double closes are possible
   // and legal, HandleWrap::Close() deals with them the same way.
-  assert(!args.Holder().IsEmpty());
-  assert(args.Holder()->InternalFieldCount() > 0);
-  void* ptr = args.Holder()->GetAlignedPointerFromInternalField(0);
+  assert(!args.This().IsEmpty());
+  assert(args.This()->InternalFieldCount() > 0);
+  void* ptr = args.This()->GetAlignedPointerFromInternalField(0);
   FSEventWrap* wrap = static_cast<FSEventWrap*>(ptr);
 
   if (wrap == NULL || wrap->initialized_ == false) {
index 740e2b3..07f19ad 100644 (file)
@@ -84,7 +84,7 @@ Handle<Value> HandleWrap::Close(const Arguments& args) {
   HandleScope scope(node_isolate);
 
   HandleWrap *wrap = static_cast<HandleWrap*>(
-      args.Holder()->GetAlignedPointerFromInternalField(0));
+      args.This()->GetAlignedPointerFromInternalField(0));
 
   // guard against uninitialized handle or double close
   if (wrap == NULL || wrap->handle__ == NULL) {
index 7c88a61..fcd9fb2 100644 (file)
@@ -47,10 +47,10 @@ namespace node {
 //   taken care of.
 
 #define UNWRAP_NO_ABORT(type)                                               \
-  assert(!args.Holder().IsEmpty());                                         \
-  assert(args.Holder()->InternalFieldCount() > 0);                          \
+  assert(!args.This().IsEmpty());                                           \
+  assert(args.This()->InternalFieldCount() > 0);                            \
   type* wrap = static_cast<type*>(                                          \
-      args.Holder()->GetAlignedPointerFromInternalField(0));
+      args.This()->GetAlignedPointerFromInternalField(0));
 
 class HandleWrap {
   public:
index 43926c8..7858fba 100644 (file)
@@ -170,7 +170,7 @@ void SecureContext::Initialize(Handle<Object> target) {
 Handle<Value> SecureContext::New(const Arguments& args) {
   HandleScope scope(node_isolate);
   SecureContext *p = new SecureContext();
-  p->Wrap(args.Holder());
+  p->Wrap(args.This());
   return args.This();
 }
 
@@ -178,7 +178,7 @@ Handle<Value> SecureContext::New(const Arguments& args) {
 Handle<Value> SecureContext::Init(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   OPENSSL_CONST SSL_METHOD *method = SSLv23_method();
 
@@ -342,7 +342,7 @@ static X509* LoadX509 (Handle<Value> v) {
 Handle<Value> SecureContext::SetKey(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   unsigned int len = args.Length();
   if (len != 1 && len != 2) {
@@ -447,7 +447,7 @@ end:
 Handle<Value> SecureContext::SetCert(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   if (args.Length() != 1) {
     return ThrowException(Exception::TypeError(
@@ -478,7 +478,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
   bool newCAStore = false;
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   if (args.Length() != 1) {
     return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -508,7 +508,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
 Handle<Value> SecureContext::AddCRL(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   if (args.Length() != 1) {
     return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -540,7 +540,7 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
 Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   assert(sc->ca_store_ == NULL);
 
@@ -579,7 +579,7 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
 Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   if (args.Length() != 1 || !args[0]->IsString()) {
     return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -594,7 +594,7 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
 Handle<Value> SecureContext::SetOptions(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   if (args.Length() != 1 || !args[0]->IntegerValue()) {
     return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -608,7 +608,7 @@ Handle<Value> SecureContext::SetOptions(const Arguments& args) {
 Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   if (args.Length() != 1 || !args[0]->IsString()) {
     return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -640,7 +640,7 @@ Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
 Handle<Value> SecureContext::SetSessionTimeout(const Arguments& args) {
   HandleScope scope(node_isolate);
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   if (args.Length() != 1 || !args[0]->IsInt32()) {
     return ThrowTypeError("Bad parameter");
@@ -654,7 +654,7 @@ Handle<Value> SecureContext::SetSessionTimeout(const Arguments& args) {
 
 Handle<Value> SecureContext::Close(const Arguments& args) {
   HandleScope scope(node_isolate);
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
   sc->FreeCTXMem();
   return False(node_isolate);
 }
@@ -671,7 +671,7 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
   char* pass = NULL;
   bool ret = false;
 
-  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
+  SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
 
   if (args.Length() < 1) {
     return ThrowException(Exception::TypeError(
@@ -1213,7 +1213,7 @@ Handle<Value> Connection::New(const Arguments& args) {
   HandleScope scope(node_isolate);
 
   Connection *p = new Connection();
-  p->Wrap(args.Holder());
+  p->Wrap(args.This());
 
   if (args.Length() < 1 || !args[0]->IsObject()) {
     return ThrowException(Exception::Error(String::New(
index 64fc03a..b15600d 100644 (file)
@@ -225,7 +225,7 @@ class Connection : ObjectWrap {
   void SetShutdownFlags();
 
   static Connection* Unwrap(const v8::Arguments& args) {
-    Connection* ss = ObjectWrap::Unwrap<Connection>(args.Holder());
+    Connection* ss = ObjectWrap::Unwrap<Connection>(args.This());
     ss->ClearError();
     return ss;
   }
index fb9e066..f4d7875 100644 (file)
@@ -96,10 +96,10 @@ inline static v8::Handle<v8::Value> ThrowRangeError(const char* errmsg) {
 }
 
 #define UNWRAP(type)                                                        \
-  assert(!args.Holder().IsEmpty());                                         \
-  assert(args.Holder()->InternalFieldCount() > 0);                          \
+  assert(!args.This().IsEmpty());                                           \
+  assert(args.This()->InternalFieldCount() > 0);                            \
   type* wrap = static_cast<type*>(                                          \
-      args.Holder()->GetAlignedPointerFromInternalField(0));                \
+      args.This()->GetAlignedPointerFromInternalField(0));                  \
   if (!wrap) {                                                              \
     fprintf(stderr, #type ": Aborting due to unwrap failure at %s:%d\n",    \
             __FILE__, __LINE__);                                            \
index 6f279bc..854ee80 100644 (file)
@@ -240,7 +240,7 @@ Handle<Value> WrappedScript::New(const Arguments& args) {
   HandleScope scope(node_isolate);
 
   WrappedScript *t = new WrappedScript();
-  t->Wrap(args.Holder());
+  t->Wrap(args.This());
 
   return
     WrappedScript::EvalMachine<compileCode, thisContext, wrapExternal>(args);
@@ -401,7 +401,7 @@ Handle<Value> WrappedScript::EvalMachine(const Arguments& args) {
       return try_catch.ReThrow();
     }
   } else {
-    WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.Holder());
+    WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.This());
     if (!n_script) {
       return ThrowException(Exception::Error(
             String::New("Must be called as a method of Script.")));
@@ -422,7 +422,7 @@ Handle<Value> WrappedScript::EvalMachine(const Arguments& args) {
       return try_catch.ReThrow();
     }
   } else {
-    WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.Holder());
+    WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.This());
     if (!n_script) {
       return ThrowException(Exception::Error(
             String::New("Must be called as a method of Script.")));
index 582c50c..aa6ccf9 100644 (file)
@@ -94,7 +94,7 @@ Handle<Value> StatWatcher::New(const Arguments& args) {
   assert(args.IsConstructCall());
   HandleScope scope(node_isolate);
   StatWatcher* s = new StatWatcher();
-  s->Wrap(args.Holder());
+  s->Wrap(args.This());
   return args.This();
 }
 
@@ -103,7 +103,7 @@ Handle<Value> StatWatcher::Start(const Arguments& args) {
   assert(args.Length() == 3);
   HandleScope scope(node_isolate);
 
-  StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.Holder());
+  StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.This());
   String::Utf8Value path(args[0]);
   const bool persistent = args[1]->BooleanValue();
   const uint32_t interval = args[2]->Uint32Value();
@@ -118,7 +118,7 @@ Handle<Value> StatWatcher::Start(const Arguments& args) {
 
 Handle<Value> StatWatcher::Stop(const Arguments& args) {
   HandleScope scope(node_isolate);
-  StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.Holder());
+  StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.This());
   if (onstop_sym.IsEmpty()) {
     onstop_sym = NODE_PSYMBOL("onstop");
   }