summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2014-03-13 18:53:48 +0100
committerFedor Indutny <fedor.indutny@gmail.com>2014-03-14 00:41:04 +0400
commit1f17f88071cbfd6f02544d903c3b884f94dff052 (patch)
tree27fa41f18a01c85a2635dc3267282f3a7ec4c567 /src
parentd0ff900a65e4250ad49dcf02e07262af1fa5de25 (diff)
downloadandroid-node-v8-1f17f88071cbfd6f02544d903c3b884f94dff052.tar.gz
android-node-v8-1f17f88071cbfd6f02544d903c3b884f94dff052.tar.bz2
android-node-v8-1f17f88071cbfd6f02544d903c3b884f94dff052.zip
src, test: fix up ObjectWrap, `make test-addons`
V8 was upgraded from 3.22 to 3.24 in commit 1c7bf24. Upgrade source files in test/addons/ and automatically generated tests from doc/api/addons.markdown to the new V8 API. This coincidentally fixes a bug in src/node_object_wrap.h where it was still using the old V8 weak persistent handle interface, which is gone in 3.24.
Diffstat (limited to 'src')
-rw-r--r--src/node_object_wrap.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h
index 445a9e66c3..b604e67095 100644
--- a/src/node_object_wrap.h
+++ b/src/node_object_wrap.h
@@ -82,7 +82,7 @@ class ObjectWrap {
inline void MakeWeak(void) {
- persistent().MakeWeak(this, WeakCallback);
+ persistent().SetWeak(this, WeakCallback);
persistent().MarkIndependent();
}
@@ -116,13 +116,16 @@ class ObjectWrap {
int refs_; // ro
private:
- static void WeakCallback(v8::Isolate* isolate,
- v8::Persistent<v8::Object>* pobj,
- ObjectWrap* wrap) {
+ static void WeakCallback(
+ const v8::WeakCallbackData<v8::Object, ObjectWrap>& data) {
+ v8::Isolate* isolate = data.GetIsolate();
v8::HandleScope scope(isolate);
+ ObjectWrap* wrap = data.GetParameter();
assert(wrap->refs_ == 0);
- assert(*pobj == wrap->persistent());
- assert((*pobj).IsNearDeath());
+ assert(wrap->handle_.IsNearDeath());
+ assert(
+ data.GetValue() == v8::Local<v8::Object>::New(isolate, wrap->handle_));
+ wrap->handle_.Reset();
delete wrap;
}