|
@ -69,10 +69,11 @@ class ArrayBuffer { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
private: |
|
|
private: |
|
|
static void WeakCallback(v8::Isolate* env, |
|
|
static void WeakCallback(v8::Isolate* isolate, |
|
|
v8::Persistent<v8::Value> value, |
|
|
v8::Persistent<v8::Object>* pobj, |
|
|
void* data) { |
|
|
void* data) { |
|
|
v8::Object* obj = v8::Object::Cast(*value); |
|
|
v8::HandleScope handle_scope(isolate); |
|
|
|
|
|
v8::Local<v8::Object> obj = v8::Local<v8::Object>::New(*pobj); |
|
|
|
|
|
|
|
|
void* ptr = obj->GetIndexedPropertiesExternalArrayData(); |
|
|
void* ptr = obj->GetIndexedPropertiesExternalArrayData(); |
|
|
int element_size = v8_typed_array::SizeOfArrayElementForType( |
|
|
int element_size = v8_typed_array::SizeOfArrayElementForType( |
|
@ -82,8 +83,8 @@ class ArrayBuffer { |
|
|
|
|
|
|
|
|
node::node_isolate->AdjustAmountOfExternalAllocatedMemory(-size); |
|
|
node::node_isolate->AdjustAmountOfExternalAllocatedMemory(-size); |
|
|
|
|
|
|
|
|
value.ClearWeak(env); |
|
|
(*pobj).ClearWeak(isolate); |
|
|
value.Dispose(env); |
|
|
(*pobj).Dispose(isolate); |
|
|
|
|
|
|
|
|
free(ptr); |
|
|
free(ptr); |
|
|
} |
|
|
} |
|
@ -128,7 +129,9 @@ class ArrayBuffer { |
|
|
|
|
|
|
|
|
v8::Persistent<v8::Object> persistent = |
|
|
v8::Persistent<v8::Object> persistent = |
|
|
v8::Persistent<v8::Object>::New(node::node_isolate, args.This()); |
|
|
v8::Persistent<v8::Object>::New(node::node_isolate, args.This()); |
|
|
persistent.MakeWeak(node::node_isolate, NULL, &ArrayBuffer::WeakCallback); |
|
|
persistent.MakeWeak(node::node_isolate, |
|
|
|
|
|
static_cast<void*>(NULL), |
|
|
|
|
|
&ArrayBuffer::WeakCallback); |
|
|
|
|
|
|
|
|
return args.This(); |
|
|
return args.This(); |
|
|
} |
|
|
} |
|
|