summaryrefslogtreecommitdiff
path: root/test/gc
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2013-10-23 13:45:57 +0200
committerTimothy J Fontaine <tjfontaine@gmail.com>2013-10-23 09:17:32 -0700
commit0079e575e03862819ed007404e01dc2e77318e6c (patch)
tree6eaa48103aab7a0da3435b0530ac1201333ae99b /test/gc
parent118957174497c67f51f951088dd88a45e97636de (diff)
downloadandroid-node-v8-0079e575e03862819ed007404e01dc2e77318e6c.tar.gz
android-node-v8-0079e575e03862819ed007404e01dc2e77318e6c.tar.bz2
android-node-v8-0079e575e03862819ed007404e01dc2e77318e6c.zip
test: fix up weakref.cc after v8 api change
Diffstat (limited to 'test/gc')
-rw-r--r--test/gc/node_modules/weak/src/weakref.cc27
1 files changed, 12 insertions, 15 deletions
diff --git a/test/gc/node_modules/weak/src/weakref.cc b/test/gc/node_modules/weak/src/weakref.cc
index 772bf8462e..dd527937fd 100644
--- a/test/gc/node_modules/weak/src/weakref.cc
+++ b/test/gc/node_modules/weak/src/weakref.cc
@@ -78,7 +78,7 @@ Handle<Array> GetCallbacks(Handle<Object> proxy) {
#define UNWRAP \
- HandleScope scope; \
+ HandleScope scope(info.GetIsolate()); \
Handle<Object> obj; \
const bool dead = IsDead(info.This()); \
if (!dead) obj = Unwrap(info.This()); \
@@ -152,14 +152,14 @@ void AddCallback(Handle<Object> proxy, Handle<Function> callback) {
}
-void TargetCallback(Isolate* isolate, Persistent<Object>* ptarget, void* arg) {
+void TargetCallback(Isolate* isolate,
+ Persistent<Object>* ptarget,
+ proxy_container* cont) {
HandleScope scope(isolate);
Local<Object> target = Local<Object>::New(isolate, *ptarget);
assert((*ptarget).IsNearDeath());
- proxy_container *cont = reinterpret_cast<proxy_container*>(arg);
-
// invoke any listening callbacks
Local<Array> callbacks = Local<Array>::New(isolate, cont->callbacks);
uint32_t len = callbacks->Length();
@@ -190,7 +190,7 @@ void TargetCallback(Isolate* isolate, Persistent<Object>* ptarget, void* arg) {
void Create(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!args[0]->IsObject()) {
Local<String> message = String::New("Object expected");
@@ -208,10 +208,7 @@ void Create(const FunctionCallbackInfo<Value>& args) {
cont->proxy.Reset(Isolate::GetCurrent(), proxy);
cont->target.Reset(isolate, args[0].As<Object>());
cont->callbacks.Reset(isolate, Array::New());
-
- cont->target.MakeWeak(Isolate::GetCurrent(),
- static_cast<void*>(cont),
- TargetCallback);
+ cont->target.MakeWeak(cont, TargetCallback);
if (args.Length() >= 2) {
AddCallback(proxy, Handle<Function>::Cast(args[1]));
@@ -233,7 +230,7 @@ void IsWeakRef (const FunctionCallbackInfo<Value>& args) {
}
void Get(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
@@ -249,7 +246,7 @@ void Get(const FunctionCallbackInfo<Value>& args) {
}
void IsNearDeath(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
@@ -266,7 +263,7 @@ void IsNearDeath(const FunctionCallbackInfo<Value>& args) {
}
void IsDead(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
@@ -280,7 +277,7 @@ void IsDead(const FunctionCallbackInfo<Value>& args) {
void AddCallback(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
@@ -293,7 +290,7 @@ void AddCallback(const FunctionCallbackInfo<Value>& args) {
}
void Callbacks(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
@@ -307,7 +304,7 @@ void Callbacks(const FunctionCallbackInfo<Value>& args) {
void Initialize(Handle<Object> target) {
- HandleScope scope;
+ HandleScope scope(target->CreationContext()->GetIsolate());
Local<ObjectTemplate> tmpl = ObjectTemplate::New();
tmpl->SetNamedPropertyHandler(WeakNamedPropertyGetter,