From: Ben Noordhuis Date: Wed, 23 Oct 2013 11:45:57 +0000 (+0200) Subject: test: fix up weakref.cc after v8 api change X-Git-Tag: v0.11.8~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0079e575e03862819ed007404e01dc2e77318e6c;p=platform%2Fupstream%2Fnodejs.git test: fix up weakref.cc after v8 api change --- diff --git a/test/gc/node_modules/weak/src/weakref.cc b/test/gc/node_modules/weak/src/weakref.cc index 772bf84..dd52793 100644 --- a/test/gc/node_modules/weak/src/weakref.cc +++ b/test/gc/node_modules/weak/src/weakref.cc @@ -78,7 +78,7 @@ Handle GetCallbacks(Handle proxy) { #define UNWRAP \ - HandleScope scope; \ + HandleScope scope(info.GetIsolate()); \ Handle obj; \ const bool dead = IsDead(info.This()); \ if (!dead) obj = Unwrap(info.This()); \ @@ -152,14 +152,14 @@ void AddCallback(Handle proxy, Handle callback) { } -void TargetCallback(Isolate* isolate, Persistent* ptarget, void* arg) { +void TargetCallback(Isolate* isolate, + Persistent* ptarget, + proxy_container* cont) { HandleScope scope(isolate); Local target = Local::New(isolate, *ptarget); assert((*ptarget).IsNearDeath()); - proxy_container *cont = reinterpret_cast(arg); - // invoke any listening callbacks Local callbacks = Local::New(isolate, cont->callbacks); uint32_t len = callbacks->Length(); @@ -190,7 +190,7 @@ void TargetCallback(Isolate* isolate, Persistent* ptarget, void* arg) { void Create(const FunctionCallbackInfo& args) { - HandleScope scope; + HandleScope scope(args.GetIsolate()); if (!args[0]->IsObject()) { Local message = String::New("Object expected"); @@ -208,10 +208,7 @@ void Create(const FunctionCallbackInfo& args) { cont->proxy.Reset(Isolate::GetCurrent(), proxy); cont->target.Reset(isolate, args[0].As()); cont->callbacks.Reset(isolate, Array::New()); - - cont->target.MakeWeak(Isolate::GetCurrent(), - static_cast(cont), - TargetCallback); + cont->target.MakeWeak(cont, TargetCallback); if (args.Length() >= 2) { AddCallback(proxy, Handle::Cast(args[1])); @@ -233,7 +230,7 @@ void IsWeakRef (const FunctionCallbackInfo& args) { } void Get(const FunctionCallbackInfo& args) { - HandleScope scope; + HandleScope scope(args.GetIsolate()); if (!isWeakRef(args[0])) { Local message = String::New("Weakref instance expected"); @@ -249,7 +246,7 @@ void Get(const FunctionCallbackInfo& args) { } void IsNearDeath(const FunctionCallbackInfo& args) { - HandleScope scope; + HandleScope scope(args.GetIsolate()); if (!isWeakRef(args[0])) { Local message = String::New("Weakref instance expected"); @@ -266,7 +263,7 @@ void IsNearDeath(const FunctionCallbackInfo& args) { } void IsDead(const FunctionCallbackInfo& args) { - HandleScope scope; + HandleScope scope(args.GetIsolate()); if (!isWeakRef(args[0])) { Local message = String::New("Weakref instance expected"); @@ -280,7 +277,7 @@ void IsDead(const FunctionCallbackInfo& args) { void AddCallback(const FunctionCallbackInfo& args) { - HandleScope scope; + HandleScope scope(args.GetIsolate()); if (!isWeakRef(args[0])) { Local message = String::New("Weakref instance expected"); @@ -293,7 +290,7 @@ void AddCallback(const FunctionCallbackInfo& args) { } void Callbacks(const FunctionCallbackInfo& args) { - HandleScope scope; + HandleScope scope(args.GetIsolate()); if (!isWeakRef(args[0])) { Local message = String::New("Weakref instance expected"); @@ -307,7 +304,7 @@ void Callbacks(const FunctionCallbackInfo& args) { void Initialize(Handle target) { - HandleScope scope; + HandleScope scope(target->CreationContext()->GetIsolate()); Local tmpl = ObjectTemplate::New(); tmpl->SetNamedPropertyHandler(WeakNamedPropertyGetter,