diff options
author | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 23:53:22 +0000 |
---|---|---|
committer | rdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-04 23:53:22 +0000 |
commit | be21ec79cff14869987e6eacc050110fb7308846 (patch) | |
tree | 0c2c04c522ba55f3b1e60733aae1d07c66da7adb /content | |
parent | b4fd55384a88ed3f184ca6c4921b470f68f14961 (diff) | |
download | chromium_src-be21ec79cff14869987e6eacc050110fb7308846.zip chromium_src-be21ec79cff14869987e6eacc050110fb7308846.tar.gz chromium_src-be21ec79cff14869987e6eacc050110fb7308846.tar.bz2 |
Revert 116385 - Make DownloadManagerImpl's destruction not tied to the UI thread.
This is intended to fix the various leaks involving the DownloadManager;
if the classes destruction is tied to the UI thread and the class is
destroyed at Profile destruction (which it is) it will be leaked
because the UI thread no longer exists at profile destruction.
BUG=100146
BUG=58449
BUG=102255
Review URL: http://codereview.chromium.org/8907002
TBR=rdsmith@chromium.org
Review URL: http://codereview.chromium.org/9030038
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/download/download_manager_impl.cc | 11 | ||||
-rw-r--r-- | content/browser/download/download_manager_impl.h | 8 | ||||
-rw-r--r-- | content/public/browser/download_manager.h | 5 |
3 files changed, 13 insertions, 11 deletions
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index 4587e45..e422120 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -96,6 +96,8 @@ DownloadManagerImpl::DownloadManagerImpl( DownloadManagerImpl::~DownloadManagerImpl() { DCHECK(!shutdown_needed_); + if (status_updater_.get() != NULL) + status_updater_->RemoveDelegate(this); } DownloadId DownloadManagerImpl::GetNextId() { @@ -169,17 +171,12 @@ void DownloadManagerImpl::Shutdown() { history_downloads_.clear(); STLDeleteElements(&downloads_to_delete); - // We'll have nothing more to report to the observers after this point. - observers_.Clear(); - DCHECK(save_page_downloads_.empty()); file_manager_ = NULL; delegate_->Shutdown(); - if (status_updater_) - status_updater_->RemoveDelegate(this); - status_updater_.reset(); + shutdown_needed_ = false; } void DownloadManagerImpl::GetTemporaryDownloads( diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h index ba0c56c..9e4e44f 100644 --- a/content/browser/download/download_manager_impl.h +++ b/content/browser/download/download_manager_impl.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -135,7 +135,11 @@ class CONTENT_EXPORT DownloadManagerImpl friend class DownloadManagerTest; friend class DownloadTest; - friend class base::RefCountedThreadSafe<DownloadManagerImpl>; + friend class base::RefCountedThreadSafe< + DownloadManagerImpl, content::BrowserThread::DeleteOnUIThread>; + friend struct content::BrowserThread::DeleteOnThread< + content::BrowserThread::UI>; + friend class base::DeleteHelper<DownloadManagerImpl>; virtual ~DownloadManagerImpl(); diff --git a/content/public/browser/download_manager.h b/content/public/browser/download_manager.h index 9df86d6..d5d73b3 100644 --- a/content/public/browser/download_manager.h +++ b/content/public/browser/download_manager.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -57,7 +57,8 @@ class WebContents; // Browser's download manager: manages all downloads and destination view. class CONTENT_EXPORT DownloadManager - : public base::RefCountedThreadSafe<DownloadManager> { + : public base::RefCountedThreadSafe< + DownloadManager, content::BrowserThread::DeleteOnUIThread> { public: virtual ~DownloadManager() {} |