From 1e7c8c9fda4072d9a0672d0f9125c4edec60f272 Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Thu, 3 Dec 2015 16:33:57 +0800 Subject: [PATCH] It is fine to leak a V8 handle on exit --- atom/common/native_mate_converters/callback.cc | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/atom/common/native_mate_converters/callback.cc b/atom/common/native_mate_converters/callback.cc index cd9838c1..8bf5c459 100644 --- a/atom/common/native_mate_converters/callback.cc +++ b/atom/common/native_mate_converters/callback.cc @@ -4,7 +4,6 @@ #include "atom/common/native_mate_converters/callback.h" -#include "atom/browser/atom_browser_main_parts.h" #include "content/public/browser/browser_thread.h" using content::BrowserThread; @@ -78,15 +77,7 @@ class RefCountedGlobal : public base::RefCountedThreadSafe, DeleteOnUIThread> { public: RefCountedGlobal(v8::Isolate* isolate, v8::Local value) - : handle_(isolate, v8::Local::Cast(value)), - weak_factory_(this) { - // In browser process, we need to ensure the V8 handle is destroyed before - // the JavaScript env gets destroyed. - if (Locker::IsBrowserProcess() && atom::AtomBrowserMainParts::Get()) { - atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback( - base::Bind(&RefCountedGlobal::FreeHandle, - weak_factory_.GetWeakPtr())); - } + : handle_(isolate, v8::Local::Cast(value)) { } bool IsAlive() const { @@ -98,12 +89,7 @@ class RefCountedGlobal : public base::RefCountedThreadSafe, } private: - void FreeHandle() { - handle_.Reset(); - } - v8::Global handle_; - base::WeakPtrFactory> weak_factory_; DISALLOW_COPY_AND_ASSIGN(RefCountedGlobal); }; -- 2.43.0