Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTrevor Norris <trev.norris@gmail.com>2013-03-19 00:54:00 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2013-03-20 04:11:01 +0400
commit0bba59028381c146b90411d43425a18415d85f98 (patch)
tree173ffbc09c11ed471c17b6f7609cc89fb26e2755 /src/node_object_wrap.h
parent06bec0e08737ee6c3e165ec6dd16b54ffe1b4c91 (diff)
bindings: update api
All compile time warnings about using deprecated APIs have been suppressed by updating node's API. Though there are still many function calls that can accept Isolate, and still need to be updated. node_isolate had to be added as an extern variable in node.h and node_object_wrap.h Also a couple small fixes for Error handling. Before v8 3.16.6 the error stack message was lazily written when it was needed, which allowed you to change the message after instantiation. Then the stack would be written with the new message the first time it was accessed. Though that has changed. Now it creates the stack message on instantiation. So setting a different message afterwards won't be displayed. This is not a complete fix for the problem. Getting error without any message isn't very useful.
Diffstat (limited to 'src/node_object_wrap.h')
-rw-r--r--src/node_object_wrap.h28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h
index c7fa3eb9ba5..4f86da3f3af 100644
--- a/src/node_object_wrap.h
+++ b/src/node_object_wrap.h
@@ -37,6 +37,8 @@
namespace node {
+extern v8::Isolate* node_isolate;
+
class NODE_EXTERN ObjectWrap {
public:
ObjectWrap ( ) {
@@ -46,10 +48,10 @@ class NODE_EXTERN ObjectWrap {
virtual ~ObjectWrap ( ) {
if (!handle_.IsEmpty()) {
- assert(handle_.IsNearDeath());
- handle_.ClearWeak();
+ assert(handle_.IsNearDeath(node_isolate));
+ handle_.ClearWeak(node_isolate);
handle_->SetInternalField(0, v8::Undefined());
- handle_.Dispose();
+ handle_.Dispose(node_isolate);
handle_.Clear();
}
}
@@ -59,7 +61,7 @@ class NODE_EXTERN ObjectWrap {
static inline T* Unwrap (v8::Handle<v8::Object> handle) {
assert(!handle.IsEmpty());
assert(handle->InternalFieldCount() > 0);
- return static_cast<T*>(handle->GetPointerFromInternalField(0));
+ return static_cast<T*>(handle->GetAlignedPointerFromInternalField(0));
}
@@ -69,15 +71,15 @@ class NODE_EXTERN ObjectWrap {
inline void Wrap (v8::Handle<v8::Object> handle) {
assert(handle_.IsEmpty());
assert(handle->InternalFieldCount() > 0);
- handle_ = v8::Persistent<v8::Object>::New(handle);
- handle_->SetPointerInInternalField(0, this);
+ handle_ = v8::Persistent<v8::Object>::New(node_isolate, handle);
+ handle_->SetAlignedPointerInInternalField(0, this);
MakeWeak();
}
inline void MakeWeak (void) {
- handle_.MakeWeak(this, WeakCallback);
- handle_.MarkIndependent();
+ handle_.MakeWeak(node_isolate, this, WeakCallback);
+ handle_.MarkIndependent(node_isolate);
}
/* Ref() marks the object as being attached to an event loop.
@@ -87,7 +89,7 @@ class NODE_EXTERN ObjectWrap {
virtual void Ref() {
assert(!handle_.IsEmpty());
refs_++;
- handle_.ClearWeak();
+ handle_.ClearWeak(node_isolate);
}
/* Unref() marks an object as detached from the event loop. This is its
@@ -101,7 +103,7 @@ class NODE_EXTERN ObjectWrap {
*/
virtual void Unref() {
assert(!handle_.IsEmpty());
- assert(!handle_.IsWeak());
+ assert(!handle_.IsWeak(node_isolate));
assert(refs_ > 0);
if (--refs_ == 0) { MakeWeak(); }
}
@@ -111,13 +113,15 @@ class NODE_EXTERN ObjectWrap {
private:
- static void WeakCallback (v8::Persistent<v8::Value> value, void *data) {
+ static void WeakCallback(v8::Isolate* env,
+ v8::Persistent<v8::Value> value,
+ void* data) {
v8::HandleScope scope;
ObjectWrap *obj = static_cast<ObjectWrap*>(data);
assert(value == obj->handle_);
assert(!obj->refs_);
- assert(value.IsNearDeath());
+ assert(value.IsNearDeath(env));
delete obj;
}
};