test: fix up weakref.cc after v8 api change
This commit is contained in:
parent
1189571744
commit
0079e575e0
27
test/gc/node_modules/weak/src/weakref.cc
generated
vendored
27
test/gc/node_modules/weak/src/weakref.cc
generated
vendored
@ -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,
|
||||
|
Loading…
x
Reference in New Issue
Block a user