mirror of
https://github.com/nodejs/node-v0.x-archive.git
synced 2026-04-28 03:01:10 -04:00
Fix style in node_object_wrap.h
This commit is contained in:
@@ -12,6 +12,7 @@ class ObjectWrap {
|
||||
refs_ = 0;
|
||||
}
|
||||
|
||||
|
||||
virtual ~ObjectWrap ( ) {
|
||||
if (!handle_.IsEmpty()) {
|
||||
assert(handle_.IsNearDeath());
|
||||
@@ -21,19 +22,19 @@ class ObjectWrap {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
static inline T* Unwrap (v8::Handle<v8::Object> handle)
|
||||
{
|
||||
static inline T* Unwrap (v8::Handle<v8::Object> handle) {
|
||||
assert(!handle.IsEmpty());
|
||||
assert(handle->InternalFieldCount() > 0);
|
||||
return static_cast<T*>(handle->GetPointerFromInternalField(0));
|
||||
}
|
||||
|
||||
|
||||
v8::Persistent<v8::Object> handle_; // ro
|
||||
|
||||
protected:
|
||||
inline void Wrap (v8::Handle<v8::Object> handle)
|
||||
{
|
||||
inline void Wrap (v8::Handle<v8::Object> handle) {
|
||||
assert(handle_.IsEmpty());
|
||||
assert(handle->InternalFieldCount() > 0);
|
||||
handle_ = v8::Persistent<v8::Object>::New(handle);
|
||||
@@ -41,8 +42,8 @@ class ObjectWrap {
|
||||
MakeWeak();
|
||||
}
|
||||
|
||||
inline void MakeWeak (void)
|
||||
{
|
||||
|
||||
inline void MakeWeak (void) {
|
||||
handle_.MakeWeak(this, WeakCallback);
|
||||
}
|
||||
|
||||
@@ -72,11 +73,12 @@ class ObjectWrap {
|
||||
if (--refs_ == 0) { MakeWeak(); }
|
||||
}
|
||||
|
||||
|
||||
int refs_; // ro
|
||||
|
||||
|
||||
private:
|
||||
static void WeakCallback (v8::Persistent<v8::Value> value, void *data)
|
||||
{
|
||||
static void WeakCallback (v8::Persistent<v8::Value> value, void *data) {
|
||||
ObjectWrap *obj = static_cast<ObjectWrap*>(data);
|
||||
assert(value == obj->handle_);
|
||||
assert(!obj->refs_);
|
||||
|
||||
Reference in New Issue
Block a user