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:
authorBen Noordhuis <info@bnoordhuis.nl>2013-06-07 18:47:54 +0400
committerBen Noordhuis <info@bnoordhuis.nl>2013-06-07 19:01:16 +0400
commit4bb4f734b3dc3cd42ffd7c5d128fec2abd6b97dd (patch)
treeb1905a69dbfa0c17133b03013a0fa788ff77d49b /src/node_object_wrap.h
parent0882a7506394e07ae6564ccf3db401b8fb7f7071 (diff)
src: unexport node_isolate
Commit 0bba5902 accidentally (or maybe erroneously) added node_isolate to src/node.h and src/node_object_wrap.h. Undo that, said variable is not for public consumption. Add-on authors should use v8::Isolate::GetCurrent() instead. I missed that while reviewing. Mea culpa. Fixes #5639.
Diffstat (limited to 'src/node_object_wrap.h')
-rw-r--r--src/node_object_wrap.h29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h
index d1826c86096..4495b1741dd 100644
--- a/src/node_object_wrap.h
+++ b/src/node_object_wrap.h
@@ -37,8 +37,6 @@
namespace node {
-extern v8::Isolate* node_isolate;
-
class NODE_EXTERN ObjectWrap {
public:
ObjectWrap ( ) {
@@ -48,10 +46,11 @@ class NODE_EXTERN ObjectWrap {
virtual ~ObjectWrap ( ) {
if (!handle_.IsEmpty()) {
- assert(handle_.IsNearDeath(node_isolate));
- handle_.ClearWeak(node_isolate);
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ assert(handle_.IsNearDeath(isolate));
+ handle_.ClearWeak(isolate);
handle_->SetAlignedPointerInInternalField(0, 0);
- handle_.Dispose(node_isolate);
+ handle_.Dispose(isolate);
handle_.Clear();
}
}
@@ -71,15 +70,17 @@ 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(node_isolate, handle);
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ handle_ = v8::Persistent<v8::Object>::New(isolate, handle);
handle_->SetAlignedPointerInInternalField(0, this);
MakeWeak();
}
inline void MakeWeak (void) {
- handle_.MakeWeak(node_isolate, this, WeakCallback);
- handle_.MarkIndependent(node_isolate);
+ v8::Isolate* isolate = v8::Isolate::GetCurrent();
+ handle_.MakeWeak(isolate, this, WeakCallback);
+ handle_.MarkIndependent(isolate);
}
/* Ref() marks the object as being attached to an event loop.
@@ -89,7 +90,7 @@ class NODE_EXTERN ObjectWrap {
virtual void Ref() {
assert(!handle_.IsEmpty());
refs_++;
- handle_.ClearWeak(node_isolate);
+ handle_.ClearWeak(v8::Isolate::GetCurrent());
}
/* Unref() marks an object as detached from the event loop. This is its
@@ -103,7 +104,7 @@ class NODE_EXTERN ObjectWrap {
*/
virtual void Unref() {
assert(!handle_.IsEmpty());
- assert(!handle_.IsWeak(node_isolate));
+ assert(!handle_.IsWeak(v8::Isolate::GetCurrent()));
assert(refs_ > 0);
if (--refs_ == 0) { MakeWeak(); }
}
@@ -113,18 +114,18 @@ class NODE_EXTERN ObjectWrap {
private:
- static void WeakCallback(v8::Isolate* env,
+ static void WeakCallback(v8::Isolate* isolate,
v8::Persistent<v8::Value> value,
void* data) {
- v8::HandleScope scope(node_isolate);
-
+ v8::HandleScope scope(isolate);
ObjectWrap *obj = static_cast<ObjectWrap*>(data);
assert(value == obj->handle_);
assert(!obj->refs_);
- assert(value.IsNearDeath(env));
+ assert(value.IsNearDeath(isolate));
delete obj;
}
};
} // namespace node
+
#endif // object_wrap_h