#define UNWRAP \
- HandleScope scope; \
+ HandleScope scope(info.GetIsolate()); \
Handle<Object> obj; \
const bool dead = IsDead(info.This()); \
if (!dead) obj = Unwrap(info.This()); \
}
-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();
void Create(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!args[0]->IsObject()) {
Local<String> message = String::New("Object expected");
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]));
}
void Get(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
}
void IsNearDeath(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
}
void IsDead(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
void AddCallback(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
}
void Callbacks(const FunctionCallbackInfo<Value>& args) {
- HandleScope scope;
+ HandleScope scope(args.GetIsolate());
if (!isWeakRef(args[0])) {
Local<String> message = String::New("Weakref instance expected");
void Initialize(Handle<Object> target) {
- HandleScope scope;
+ HandleScope scope(target->CreationContext()->GetIsolate());
Local<ObjectTemplate> tmpl = ObjectTemplate::New();
tmpl->SetNamedPropertyHandler(WeakNamedPropertyGetter,