summaryrefslogtreecommitdiffstats
path: root/content
diff options
context:
space:
mode:
Diffstat (limited to 'content')
-rw-r--r--content/browser/download/download_item_impl.cc1
-rw-r--r--content/browser/download/download_manager_impl.cc25
-rw-r--r--content/browser/download/download_manager_impl.h18
3 files changed, 12 insertions, 32 deletions
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc
index 5542e2e..b931744 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -722,6 +722,7 @@ void DownloadItemImpl::OnDownloadCompleting(DownloadFileManager* file_manager) {
VLOG(20) << __FUNCTION__ << "()"
<< " needs rename = " << NeedsRename()
<< " " << DebugString(true);
+ DCHECK(!GetTargetName().empty());
DCHECK_NE(DANGEROUS, GetSafetyState());
DCHECK(file_manager);
diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc
index f677092..dc655bf 100644
--- a/content/browser/download/download_manager_impl.cc
+++ b/content/browser/download/download_manager_impl.cc
@@ -235,7 +235,6 @@ void DownloadManagerImpl::Shutdown() {
DownloadSet downloads_to_delete;
downloads_to_delete.swap(downloads_);
- in_progress_.clear();
active_downloads_.clear();
history_downloads_.clear();
STLDeleteElements(&downloads_to_delete);
@@ -418,7 +417,6 @@ net::BoundNetLog DownloadManagerImpl::CreateDownloadItem(
this, *info, new DownloadRequestHandle(request_handle),
browser_context_->IsOffTheRecord(), bound_net_log);
int32 download_id = info->download_id.local();
- DCHECK(!ContainsKey(in_progress_, download_id));
DCHECK(!ContainsKey(active_downloads_, download_id));
downloads_.insert(download);
@@ -468,9 +466,6 @@ void DownloadManagerImpl::ContinueDownloadWithPath(
int32 download_id = download->GetId();
- // NOTE(ahendrickson) Eventually |active_downloads_| will replace
- // |in_progress_|, but we don't want to change the semantics yet.
- DCHECK(!ContainsKey(in_progress_, download_id));
DCHECK(ContainsKey(downloads_, download));
DCHECK(ContainsKey(active_downloads_, download_id));
@@ -481,8 +476,6 @@ void DownloadManagerImpl::ContinueDownloadWithPath(
VLOG(20) << __FUNCTION__ << "()"
<< " download = " << download->DebugString(true);
- in_progress_[download_id] = download;
-
// Rename to intermediate name.
FilePath download_path;
if (download->GetDangerType() !=
@@ -556,7 +549,6 @@ void DownloadManagerImpl::AssertStateConsistent(DownloadItem* download) const {
if (download->GetState() == DownloadItem::REMOVING) {
DCHECK(!ContainsKey(downloads_, download));
DCHECK(!ContainsKey(active_downloads_, download->GetId()));
- DCHECK(!ContainsKey(in_progress_, download->GetId()));
DCHECK(!ContainsKey(history_downloads_, download->GetDbHandle()));
return;
}
@@ -634,9 +626,9 @@ void DownloadManagerImpl::MaybeCompleteDownload(DownloadItem* download) {
// transition on the DownloadItem.
// Confirm we're in the proper set of states to be here;
- // in in_progress_, have all data, have a history handle, (validated or safe).
+ // have all data, have a history handle, (validated or safe).
+ DCHECK(download->IsInProgress());
DCHECK_NE(DownloadItem::DANGEROUS, download->GetSafetyState());
- DCHECK_EQ(1u, in_progress_.count(download->GetId()));
DCHECK(download->AllDataSaved());
DCHECK(download->IsPersisted());
DCHECK_EQ(1u, history_downloads_.count(download->GetDbHandle()));
@@ -648,9 +640,6 @@ void DownloadManagerImpl::MaybeCompleteDownload(DownloadItem* download) {
VLOG(20) << __FUNCTION__ << "()" << " executing: download = "
<< download->DebugString(false);
- // Remove the id from in_progress
- in_progress_.erase(download->GetId());
-
delegate_->UpdateItemInPersistentStore(download);
// Finish the download.
@@ -765,7 +754,6 @@ void DownloadManagerImpl::RemoveFromActiveList(DownloadItem* download) {
// Clean up will happen when the history system create callback runs if we
// don't have a valid db_handle yet.
if (download->IsPersisted()) {
- in_progress_.erase(download->GetId());
active_downloads_.erase(download->GetId());
delegate_->UpdateItemInPersistentStore(download);
}
@@ -1001,7 +989,6 @@ void DownloadManagerImpl::OnDownloadItemAddedToPersistentStore(
MaybeCompleteDownload(download);
} else {
DCHECK(download->IsCancelled());
- in_progress_.erase(download_id);
active_downloads_.erase(download_id);
delegate_->UpdateItemInPersistentStore(download);
download->UpdateObservers();
@@ -1023,12 +1010,12 @@ void DownloadManagerImpl::ShowDownloadInBrowser(DownloadItem* download) {
}
int DownloadManagerImpl::InProgressCount() const {
- // Don't use in_progress_.count() because Cancel() leaves items in
- // in_progress_ if they haven't made it into the persistent store yet.
+ // Don't use active_downloads_.count() because Cancel() leaves items in
+ // active_downloads_ if they haven't made it into the persistent store yet.
// Need to actually look at each item's state.
int count = 0;
- for (DownloadMap::const_iterator it = in_progress_.begin();
- it != in_progress_.end(); ++it) {
+ for (DownloadMap::const_iterator it = active_downloads_.begin();
+ it != active_downloads_.end(); ++it) {
DownloadItem* item = it->second;
if (item->IsInProgress())
++count;
diff --git a/content/browser/download/download_manager_impl.h b/content/browser/download/download_manager_impl.h
index bc1cc1b..a1924b7 100644
--- a/content/browser/download/download_manager_impl.h
+++ b/content/browser/download/download_manager_impl.h
@@ -196,10 +196,6 @@ class CONTENT_EXPORT DownloadManagerImpl
// processed. The key is the ID assigned by the DownloadFileManager,
// which is unique for the current session.
//
- // |in_progress_| is a map of all downloads that are in progress and that have
- // not yet received a valid history handle. The key is the ID assigned by the
- // DownloadFileManager, which is unique for the current session.
- //
// |save_page_downloads_| (if defined) is a collection of all the
// downloads the "save page as" system has given to us to hold onto
// until we are destroyed. They key is DownloadFileManager, so it is unique
@@ -207,18 +203,14 @@ class CONTENT_EXPORT DownloadManagerImpl
//
// When a download is created through a user action, the corresponding
// DownloadItem* is placed in |active_downloads_| and remains there until the
- // download is in a terminal state (COMPLETE or CANCELLED). It is also
- // placed in |in_progress_| and remains there until it has received a
- // valid handle from the history system. Once it has a valid handle, the
- // DownloadItem* is placed in the |history_downloads_| map. When the
- // download reaches a terminal state, it is removed from |in_progress_|.
- // Downloads from past sessions read from a persisted state from the
- // history system are placed directly into |history_downloads_| since
- // they have valid handles in the history system.
+ // download is in a terminal state (COMPLETE or CANCELLED). Once it has a
+ // valid handle, the DownloadItem* is placed in the |history_downloads_| map.
+ // Downloads from past sessions read from a persisted state from the history
+ // system are placed directly into |history_downloads_| since they have valid
+ // handles in the history system.
DownloadSet downloads_;
DownloadMap history_downloads_;
- DownloadMap in_progress_;
DownloadMap active_downloads_;
DownloadMap save_page_downloads_;