summaryrefslogtreecommitdiffstats
path: root/chrome/browser/download
diff options
context:
space:
mode:
authorrdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-15 23:40:33 +0000
committerrdsmith@chromium.org <rdsmith@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-15 23:40:33 +0000
commita312a4472002e8147e65a57111b51eff683dcc3e (patch)
tree56adbe3b99030ccc57f44eac8d0dec7aa996ee7e /chrome/browser/download
parent3eb0d8f7bea3e4e54836fa506f4034bcbd3ef4c2 (diff)
downloadchromium_src-a312a4472002e8147e65a57111b51eff683dcc3e.zip
chromium_src-a312a4472002e8147e65a57111b51eff683dcc3e.tar.gz
chromium_src-a312a4472002e8147e65a57111b51eff683dcc3e.tar.bz2
Added clearing of downloads_ set on RemoveDownloadsBetween pathway.
BUG=66676 TEST=66676 does not repro three times running. Review URL: http://codereview.chromium.org/5877003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69348 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/download')
-rw-r--r--chrome/browser/download/download_manager.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc
index 5c0577f..6d4bdd3 100644
--- a/chrome/browser/download/download_manager.cc
+++ b/chrome/browser/download/download_manager.cc
@@ -720,6 +720,8 @@ int DownloadManager::RemoveDownloadsBetween(const base::Time remove_begin,
const base::Time remove_end) {
download_history_->RemoveEntriesBetween(remove_begin, remove_end);
+ // All downloads visible to the user will be in the history,
+ // so scan that map.
DownloadMap::iterator it = history_downloads_.begin();
std::vector<DownloadItem*> pending_deletes;
while (it != history_downloads_.end()) {
@@ -741,12 +743,21 @@ int DownloadManager::RemoveDownloadsBetween(const base::Time remove_begin,
++it;
}
- // Tell observers to refresh their views.
+ // If we aren't deleting anything, we're done.
int num_deleted = static_cast<int>(pending_deletes.size());
- if (num_deleted > 0)
- NotifyModelChanged();
+ if (num_deleted == 0)
+ return num_deleted;
+
+ // Remove the chosen downloads from the main owning container.
+ for (std::vector<DownloadItem*>::iterator it = pending_deletes.begin();
+ it != pending_deletes.end(); it++) {
+ downloads_.erase(*it);
+ }
+
+ // Tell observers to refresh their views.
+ NotifyModelChanged();
- // Delete the download items after updating the observers.
+ // Delete the download items themselves.
STLDeleteContainerPointers(pending_deletes.begin(), pending_deletes.end());
pending_deletes.clear();