Permalink
Browse files

fix up weakref.cc after v8 api change

This is a cherry pick of nodejs/node-v0.x-archive@dc29d64.
  • Loading branch information...
1 parent 6a2e803 commit 8a24ac7b3968ab0f4ac7ead413caa9d0f53b4362 @bnoordhuis bnoordhuis committed with Mar 20, 2013
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/weakref.cc
View
@@ -37,21 +37,21 @@ Persistent<ObjectTemplate> proxyClass;
bool IsDead(Handle<Object> proxy) {
assert(proxy->InternalFieldCount() == 1);
proxy_container *cont = reinterpret_cast<proxy_container*>(
- proxy->GetPointerFromInternalField(0));
+ proxy->GetAlignedPointerFromInternalField(0));
return cont == NULL || cont->target.IsEmpty();
}
Handle<Object> Unwrap(Handle<Object> proxy) {
assert(!IsDead(proxy));
proxy_container *cont = reinterpret_cast<proxy_container*>(
- proxy->GetPointerFromInternalField(0));
+ proxy->GetAlignedPointerFromInternalField(0));
return cont->target;
}
Handle<Array> GetCallbacks(Handle<Object> proxy) {
proxy_container *cont = reinterpret_cast<proxy_container*>(
- proxy->GetPointerFromInternalField(0));
+ proxy->GetAlignedPointerFromInternalField(0));
assert(cont != NULL);
return cont->callbacks;
}
@@ -159,7 +159,7 @@ void TargetCallback(Persistent<Value> target, void* arg) {
}
}
- cont->proxy->SetPointerInInternalField(0, NULL);
+ cont->proxy->SetAlignedPointerInInternalField(0, NULL);
cont->proxy.Dispose();
cont->proxy.Clear();
cont->target.Dispose();
@@ -185,7 +185,7 @@ Handle<Value> Create(const Arguments& args) {
cont->callbacks = Persistent<Array>::New(Array::New());
cont->proxy = Persistent<Object>::New(proxyClass->NewInstance());
- cont->proxy->SetPointerInInternalField(0, cont);
+ cont->proxy->SetAlignedPointerInInternalField(0, cont);
cont->target.MakeWeak(cont, TargetCallback);
@@ -235,7 +235,7 @@ Handle<Value> IsNearDeath(const Arguments& args) {
Local<Object> proxy = args[0]->ToObject();
proxy_container *cont = reinterpret_cast<proxy_container*>(
- proxy->GetPointerFromInternalField(0));
+ proxy->GetAlignedPointerFromInternalField(0));
assert(cont != NULL);
Handle<Boolean> rtn = Boolean::New(cont->target.IsNearDeath());

0 comments on commit 8a24ac7

Please sign in to comment.