diff --git a/native_mate/wrappable.cc b/native_mate/wrappable.cc index 2561985..3d5ce44 100644 --- a/native_mate/wrappable.cc +++ b/native_mate/wrappable.cc @@ -10,9 +10,7 @@ namespace mate { -WrappableBase::WrappableBase() - : isolate_(nullptr), high_memory_(false) { -} +WrappableBase::WrappableBase() : isolate_(nullptr) {} WrappableBase::~WrappableBase() { if (wrapper_.IsEmpty()) @@ -38,9 +36,6 @@ void WrappableBase::InitWith(v8::Isolate* isolate, wrapper_.Reset(isolate, wrapper); wrapper_.SetWeak(this, FirstWeakCallback, v8::WeakCallbackType::kParameter); - if (high_memory_) - wrapper_.MarkIndependent(); - // Call object._init if we have one. v8::Local init; if (Dictionary(isolate, wrapper).Get("_init", &init)) @@ -49,22 +44,12 @@ void WrappableBase::InitWith(v8::Isolate* isolate, AfterInit(isolate); } -void WrappableBase::MarkHighMemoryUsage() { - high_memory_ = true; - if (!wrapper_.IsEmpty()) - wrapper_.MarkIndependent(); -} - // static void WrappableBase::FirstWeakCallback( const v8::WeakCallbackInfo& data) { WrappableBase* wrappable = data.GetParameter(); wrappable->wrapper_.Reset(); - if (wrappable->high_memory_) { - delete wrappable; - } else { - data.SetSecondPassCallback(SecondWeakCallback); - } + data.SetSecondPassCallback(SecondWeakCallback); } // static diff --git a/native_mate/wrappable_base.h b/native_mate/wrappable_base.h index 11212c2..501bbee 100644 --- a/native_mate/wrappable_base.h +++ b/native_mate/wrappable_base.h @@ -44,10 +44,6 @@ class WrappableBase { // This method should only be called by classes using Constructor. virtual void InitWith(v8::Isolate* isolate, v8::Local wrapper); - // Marks wrapped object as high memory usage - // Deletes the wrapped object on the first round of GC callbacks - virtual void MarkHighMemoryUsage(); - private: friend struct internal::Destroyable; @@ -58,7 +54,6 @@ class WrappableBase { v8::Isolate* isolate_; v8::Global wrapper_; // Weak - bool high_memory_; DISALLOW_COPY_AND_ASSIGN(WrappableBase); };