Chromium Code Reviews| Index: content/browser/download/download_manager_impl.cc |
| diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc |
| index f742c7c0cd238f0a431b8c6b5de7909c3e9fe7e4..3e7971465337e0d5b24065b77cfdb8ec4c875c79 100644 |
| --- a/content/browser/download/download_manager_impl.cc |
| +++ b/content/browser/download/download_manager_impl.cc |
| @@ -317,13 +317,8 @@ void DownloadManagerImpl::Shutdown() { |
| // and all in progress downloads have been cancelled. We can now delete |
| // anything left. |
| - // Copy downloads_ to separate container so as not to set off checks |
| - // in DownloadItem destruction. |
| - DownloadMap downloads_to_delete; |
| - downloads_to_delete.swap(downloads_); |
| - |
| active_downloads_.clear(); |
| - STLDeleteValues(&downloads_to_delete); |
| + STLDeleteValues(&downloads_); |
|
Randy Smith (Not in Mondays)
2012/07/14 19:25:53
Shouldn't we also do a downloads_.clear() here? W
benjhayden
2012/07/23 15:43:09
Done.
|
| // We'll have nothing more to report to the observers after this point. |
| observers_.Clear(); |
| @@ -636,13 +631,6 @@ void DownloadManagerImpl::OnResponseCompleted(int32 download_id, |
| } |
| void DownloadManagerImpl::AssertStateConsistent(DownloadItem* download) const { |
| - if (download->GetState() == DownloadItem::REMOVING) { |
| - DCHECK(!ContainsKey(downloads_, download->GetId())); |
| - DCHECK(!ContainsKey(active_downloads_, download->GetId())); |
| - return; |
| - } |
| - |
| - // Should be in downloads_ if we're not REMOVING. |
| CHECK(ContainsKey(downloads_, download->GetId())); |
| int64 state = download->GetState(); |
| @@ -819,22 +807,17 @@ int DownloadManagerImpl::RemoveDownloadItems( |
| if (pending_deletes.empty()) |
| return 0; |
| - // Delete from internal maps. |
| for (DownloadVector::const_iterator it = pending_deletes.begin(); |
| it != pending_deletes.end(); |
| ++it) { |
| DownloadItem* download = *it; |
| DCHECK(download); |
| - downloads_.erase(download->GetId()); |
| + int32 download_id = download->GetId(); |
| + delete download; |
| + downloads_.erase(download_id); |
| } |
| - |
| - // Tell observers to refresh their views. |
| NotifyModelChanged(); |
| - |
| - // Delete the download items themselves. |
| - const int num_deleted = static_cast<int>(pending_deletes.size()); |
| - STLDeleteContainerPointers(pending_deletes.begin(), pending_deletes.end()); |
| - return num_deleted; |
| + return static_cast<int>(pending_deletes.size()); |
| } |
| void DownloadManagerImpl::DownloadRemoved(DownloadItem* download) { |