Remove unneeded cleanup code
authorCheng Zhao <zcbenz@gmail.com>
Mon, 25 Apr 2016 01:23:36 +0000 (10:23 +0900)
committerCheng Zhao <zcbenz@gmail.com>
Mon, 25 Apr 2016 01:23:36 +0000 (10:23 +0900)
atom/browser/api/atom_api_debugger.cc
atom/browser/api/atom_api_download_item.cc
atom/browser/api/atom_api_session.cc
atom/browser/api/atom_api_web_contents.cc
atom/browser/api/trackable_object.h

index 828c573188db881cc6b533de89683eadf0591bc3..03490360133aa8863f6d8245a666b5db3ef55267 100644 (file)
@@ -167,16 +167,8 @@ void Debugger::BuildPrototype(v8::Isolate* isolate,
       .SetMethod("sendCommand", &Debugger::SendCommand);
 }
 
-void ClearWrapDebugger() {
-  g_wrap_debugger.Reset();
-}
-
 void SetWrapDebugger(const WrapDebuggerCallback& callback) {
   g_wrap_debugger = callback;
-
-  // Cleanup the wrapper on exit.
-  atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback(
-      base::Bind(ClearWrapDebugger));
 }
 
 }  // namespace api
index 10f7c4546254f16e17cfdfd54f6cc8f2e3ba2c6f..96826a250f5707cefb915a890323fbdd94bcebad 100644 (file)
@@ -184,16 +184,8 @@ mate::Handle<DownloadItem> DownloadItem::Create(
   return handle;
 }
 
-void ClearWrapDownloadItem() {
-  g_wrap_download_item.Reset();
-}
-
 void SetWrapDownloadItem(const WrapDownloadItemCallback& callback) {
   g_wrap_download_item = callback;
-
-  // Cleanup the wrapper on exit.
-  atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback(
-      base::Bind(ClearWrapDownloadItem));
 }
 
 }  // namespace api
index 140135d329e325e08f836f380621007809c85c1b..ec4e2aebe4c211164137efc2f5970252b06f970f 100644 (file)
@@ -494,16 +494,8 @@ void Session::BuildPrototype(v8::Isolate* isolate,
       .SetProperty("webRequest", &Session::WebRequest);
 }
 
-void ClearWrapSession() {
-  g_wrap_session.Reset();
-}
-
 void SetWrapSession(const WrapSessionCallback& callback) {
   g_wrap_session = callback;
-
-  // Cleanup the wrapper on exit.
-  atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback(
-      base::Bind(ClearWrapSession));
 }
 
 }  // namespace api
index cec998a872296a48e65cf5f188f8f353e6254831..a48277490b00c569ba5c5f5ca836c4cbe0b78481 100644 (file)
@@ -1309,16 +1309,8 @@ mate::Handle<WebContents> WebContents::Create(
   return handle;
 }
 
-void ClearWrapWebContents() {
-  g_wrap_web_contents.Reset();
-}
-
 void SetWrapWebContents(const WrapWebContentsCallback& callback) {
   g_wrap_web_contents = callback;
-
-  // Cleanup the wrapper on exit.
-  atom::AtomBrowserMainParts::Get()->RegisterDestructionCallback(
-      base::Bind(ClearWrapWebContents));
 }
 
 }  // namespace api
index 5a036f4297dd800a89c46dddc43871842991642c..1c71d84e42c9c2ba3e932f52b9da384493d859b4 100644 (file)
@@ -114,8 +114,6 @@ class TrackableObject : public TrackableObjectBase,
   void AfterInit(v8::Isolate* isolate) override {
     if (!weak_map_) {
       weak_map_.reset(new atom::IDWeakMap);
-      RegisterDestructionCallback(
-          base::Bind(&TrackableObject<T>::ReleaseAllWeakReferences));
     }
     weak_map_id_ = weak_map_->Add(isolate, Wrappable<T>::GetWrapper());
     if (wrapped_)
@@ -123,11 +121,6 @@ class TrackableObject : public TrackableObjectBase,
   }
 
  private:
-  // Releases all weak references in weak map, called when app is terminating.
-  static void ReleaseAllWeakReferences() {
-    weak_map_.reset();
-  }
-
   static scoped_ptr<atom::IDWeakMap> weak_map_;
 
   DISALLOW_COPY_AND_ASSIGN(TrackableObject);