summaryrefslogtreecommitdiffstats
path: root/content/browser/download
diff options
context:
space:
mode:
authorrdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 21:08:21 +0000
committerrdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-01-04 21:08:21 +0000
commitbc34bd352897a30bb89a07abc2e62e789f325897 (patch)
tree1409b397cf0315924776349b98390c3cb330b029 /content/browser/download
parent95f87788983c4830fa6bd990437e1a07f8d7321e (diff)
downloadchromium_src-bc34bd352897a30bb89a07abc2e62e789f325897.zip
chromium_src-bc34bd352897a30bb89a07abc2e62e789f325897.tar.gz
chromium_src-bc34bd352897a30bb89a07abc2e62e789f325897.tar.bz2
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 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116385 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/download')
-rw-r--r--content/browser/download/download_manager_impl.cc11
-rw-r--r--content/browser/download/download_manager_impl.h8
2 files changed, 9 insertions, 10 deletions
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index 9a68397..c7933c5 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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,8 +96,6 @@ DownloadManagerImpl::DownloadManagerImpl(
DownloadManagerImpl::~DownloadManagerImpl() {
DCHECK(!shutdown_needed_);
- if (status_updater_.get() != NULL)
- status_updater_->RemoveDelegate(this);
}
DownloadId DownloadManagerImpl::GetNextId() {
@@ -171,12 +169,17 @@ 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();
- shutdown_needed_ = false;
+ if (status_updater_)
+ status_updater_->RemoveDelegate(this);
+ status_updater_.reset();
}
void DownloadManagerImpl::GetTemporaryDownloads(
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h
index 9e4e44f..ba0c56c 100644
--- a/content/browser/download/download_manager_impl.h
+++ b/content/browser/download/download_manager_impl.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 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,11 +135,7 @@ class CONTENT_EXPORT DownloadManagerImpl
friend class DownloadManagerTest;
friend class DownloadTest;
- friend class base::RefCountedThreadSafe<
- DownloadManagerImpl, content::BrowserThread::DeleteOnUIThread>;
- friend struct content::BrowserThread::DeleteOnThread<
- content::BrowserThread::UI>;
- friend class base::DeleteHelper<DownloadManagerImpl>;
+ friend class base::RefCountedThreadSafe<DownloadManagerImpl>;
virtual ~DownloadManagerImpl();