Skip to content

Commit 0a4ebc3

Browse files
trevnorrisbnoordhuis
authored andcommitted
src: replace Holder() with This()
Switch to always use args.This() to retrieve object instance.
1 parent 223607c commit 0a4ebc3

8 files changed

+31
-31
lines changed

src/fs_event_wrap.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -171,9 +171,9 @@ Handle<Value> FSEventWrap::Close(const Arguments& args) {
171171
// Unwrap manually here. The UNWRAP() macro asserts that wrap != NULL.
172172
// That usually indicates an error but not here: double closes are possible
173173
// and legal, HandleWrap::Close() deals with them the same way.
174-
assert(!args.Holder().IsEmpty());
175-
assert(args.Holder()->InternalFieldCount() > 0);
176-
void* ptr = args.Holder()->GetAlignedPointerFromInternalField(0);
174+
assert(!args.This().IsEmpty());
175+
assert(args.This()->InternalFieldCount() > 0);
176+
void* ptr = args.This()->GetAlignedPointerFromInternalField(0);
177177
FSEventWrap* wrap = static_cast<FSEventWrap*>(ptr);
178178

179179
if (wrap == NULL || wrap->initialized_ == false) {

src/handle_wrap.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ Handle<Value> HandleWrap::Close(const Arguments& args) {
8484
HandleScope scope(node_isolate);
8585

8686
HandleWrap *wrap = static_cast<HandleWrap*>(
87-
args.Holder()->GetAlignedPointerFromInternalField(0));
87+
args.This()->GetAlignedPointerFromInternalField(0));
8888

8989
// guard against uninitialized handle or double close
9090
if (wrap == NULL || wrap->handle__ == NULL) {

src/handle_wrap.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ namespace node {
4747
// taken care of.
4848

4949
#define UNWRAP_NO_ABORT(type) \
50-
assert(!args.Holder().IsEmpty()); \
51-
assert(args.Holder()->InternalFieldCount() > 0); \
50+
assert(!args.This().IsEmpty()); \
51+
assert(args.This()->InternalFieldCount() > 0); \
5252
type* wrap = static_cast<type*>( \
53-
args.Holder()->GetAlignedPointerFromInternalField(0));
53+
args.This()->GetAlignedPointerFromInternalField(0));
5454

5555
class HandleWrap {
5656
public:

src/node_crypto.cc

+14-14
Original file line numberDiff line numberDiff line change
@@ -170,15 +170,15 @@ void SecureContext::Initialize(Handle<Object> target) {
170170
Handle<Value> SecureContext::New(const Arguments& args) {
171171
HandleScope scope(node_isolate);
172172
SecureContext *p = new SecureContext();
173-
p->Wrap(args.Holder());
173+
p->Wrap(args.This());
174174
return args.This();
175175
}
176176

177177

178178
Handle<Value> SecureContext::Init(const Arguments& args) {
179179
HandleScope scope(node_isolate);
180180

181-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
181+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
182182

183183
OPENSSL_CONST SSL_METHOD *method = SSLv23_method();
184184

@@ -342,7 +342,7 @@ static X509* LoadX509 (Handle<Value> v) {
342342
Handle<Value> SecureContext::SetKey(const Arguments& args) {
343343
HandleScope scope(node_isolate);
344344

345-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
345+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
346346

347347
unsigned int len = args.Length();
348348
if (len != 1 && len != 2) {
@@ -447,7 +447,7 @@ int SSL_CTX_use_certificate_chain(SSL_CTX *ctx, BIO *in) {
447447
Handle<Value> SecureContext::SetCert(const Arguments& args) {
448448
HandleScope scope(node_isolate);
449449

450-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
450+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
451451

452452
if (args.Length() != 1) {
453453
return ThrowException(Exception::TypeError(
@@ -478,7 +478,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
478478
bool newCAStore = false;
479479
HandleScope scope(node_isolate);
480480

481-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
481+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
482482

483483
if (args.Length() != 1) {
484484
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -508,7 +508,7 @@ Handle<Value> SecureContext::AddCACert(const Arguments& args) {
508508
Handle<Value> SecureContext::AddCRL(const Arguments& args) {
509509
HandleScope scope(node_isolate);
510510

511-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
511+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
512512

513513
if (args.Length() != 1) {
514514
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -540,7 +540,7 @@ Handle<Value> SecureContext::AddCRL(const Arguments& args) {
540540
Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
541541
HandleScope scope(node_isolate);
542542

543-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
543+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
544544

545545
assert(sc->ca_store_ == NULL);
546546

@@ -579,7 +579,7 @@ Handle<Value> SecureContext::AddRootCerts(const Arguments& args) {
579579
Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
580580
HandleScope scope(node_isolate);
581581

582-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
582+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
583583

584584
if (args.Length() != 1 || !args[0]->IsString()) {
585585
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -594,7 +594,7 @@ Handle<Value> SecureContext::SetCiphers(const Arguments& args) {
594594
Handle<Value> SecureContext::SetOptions(const Arguments& args) {
595595
HandleScope scope(node_isolate);
596596

597-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
597+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
598598

599599
if (args.Length() != 1 || !args[0]->IntegerValue()) {
600600
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -608,7 +608,7 @@ Handle<Value> SecureContext::SetOptions(const Arguments& args) {
608608
Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
609609
HandleScope scope(node_isolate);
610610

611-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
611+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
612612

613613
if (args.Length() != 1 || !args[0]->IsString()) {
614614
return ThrowException(Exception::TypeError(String::New("Bad parameter")));
@@ -640,7 +640,7 @@ Handle<Value> SecureContext::SetSessionIdContext(const Arguments& args) {
640640
Handle<Value> SecureContext::SetSessionTimeout(const Arguments& args) {
641641
HandleScope scope(node_isolate);
642642

643-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
643+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
644644

645645
if (args.Length() != 1 || !args[0]->IsInt32()) {
646646
return ThrowTypeError("Bad parameter");
@@ -654,7 +654,7 @@ Handle<Value> SecureContext::SetSessionTimeout(const Arguments& args) {
654654

655655
Handle<Value> SecureContext::Close(const Arguments& args) {
656656
HandleScope scope(node_isolate);
657-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
657+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
658658
sc->FreeCTXMem();
659659
return False(node_isolate);
660660
}
@@ -671,7 +671,7 @@ Handle<Value> SecureContext::LoadPKCS12(const Arguments& args) {
671671
char* pass = NULL;
672672
bool ret = false;
673673

674-
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.Holder());
674+
SecureContext *sc = ObjectWrap::Unwrap<SecureContext>(args.This());
675675

676676
if (args.Length() < 1) {
677677
return ThrowException(Exception::TypeError(
@@ -1213,7 +1213,7 @@ Handle<Value> Connection::New(const Arguments& args) {
12131213
HandleScope scope(node_isolate);
12141214

12151215
Connection *p = new Connection();
1216-
p->Wrap(args.Holder());
1216+
p->Wrap(args.This());
12171217

12181218
if (args.Length() < 1 || !args[0]->IsObject()) {
12191219
return ThrowException(Exception::Error(String::New(

src/node_crypto.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class Connection : ObjectWrap {
225225
void SetShutdownFlags();
226226

227227
static Connection* Unwrap(const v8::Arguments& args) {
228-
Connection* ss = ObjectWrap::Unwrap<Connection>(args.Holder());
228+
Connection* ss = ObjectWrap::Unwrap<Connection>(args.This());
229229
ss->ClearError();
230230
return ss;
231231
}

src/node_internals.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,10 @@ inline static v8::Handle<v8::Value> ThrowRangeError(const char* errmsg) {
9696
}
9797

9898
#define UNWRAP(type) \
99-
assert(!args.Holder().IsEmpty()); \
100-
assert(args.Holder()->InternalFieldCount() > 0); \
99+
assert(!args.This().IsEmpty()); \
100+
assert(args.This()->InternalFieldCount() > 0); \
101101
type* wrap = static_cast<type*>( \
102-
args.Holder()->GetAlignedPointerFromInternalField(0)); \
102+
args.This()->GetAlignedPointerFromInternalField(0)); \
103103
if (!wrap) { \
104104
fprintf(stderr, #type ": Aborting due to unwrap failure at %s:%d\n", \
105105
__FILE__, __LINE__); \

src/node_script.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ Handle<Value> WrappedScript::New(const Arguments& args) {
240240
HandleScope scope(node_isolate);
241241

242242
WrappedScript *t = new WrappedScript();
243-
t->Wrap(args.Holder());
243+
t->Wrap(args.This());
244244

245245
return
246246
WrappedScript::EvalMachine<compileCode, thisContext, wrapExternal>(args);
@@ -401,7 +401,7 @@ Handle<Value> WrappedScript::EvalMachine(const Arguments& args) {
401401
return try_catch.ReThrow();
402402
}
403403
} else {
404-
WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.Holder());
404+
WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.This());
405405
if (!n_script) {
406406
return ThrowException(Exception::Error(
407407
String::New("Must be called as a method of Script.")));
@@ -422,7 +422,7 @@ Handle<Value> WrappedScript::EvalMachine(const Arguments& args) {
422422
return try_catch.ReThrow();
423423
}
424424
} else {
425-
WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.Holder());
425+
WrappedScript *n_script = ObjectWrap::Unwrap<WrappedScript>(args.This());
426426
if (!n_script) {
427427
return ThrowException(Exception::Error(
428428
String::New("Must be called as a method of Script.")));

src/node_stat_watcher.cc

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Handle<Value> StatWatcher::New(const Arguments& args) {
9494
assert(args.IsConstructCall());
9595
HandleScope scope(node_isolate);
9696
StatWatcher* s = new StatWatcher();
97-
s->Wrap(args.Holder());
97+
s->Wrap(args.This());
9898
return args.This();
9999
}
100100

@@ -103,7 +103,7 @@ Handle<Value> StatWatcher::Start(const Arguments& args) {
103103
assert(args.Length() == 3);
104104
HandleScope scope(node_isolate);
105105

106-
StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.Holder());
106+
StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.This());
107107
String::Utf8Value path(args[0]);
108108
const bool persistent = args[1]->BooleanValue();
109109
const uint32_t interval = args[2]->Uint32Value();
@@ -118,7 +118,7 @@ Handle<Value> StatWatcher::Start(const Arguments& args) {
118118

119119
Handle<Value> StatWatcher::Stop(const Arguments& args) {
120120
HandleScope scope(node_isolate);
121-
StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.Holder());
121+
StatWatcher* wrap = ObjectWrap::Unwrap<StatWatcher>(args.This());
122122
if (onstop_sym.IsEmpty()) {
123123
onstop_sym = NODE_PSYMBOL("onstop");
124124
}

0 commit comments

Comments
 (0)