Index: content/browser/download/download_item_impl.cc |
diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc |
index 2a2986e88bce8288a3932261c5629389d1f5fc4e..0cfa51bc40d6b29c76bf7ff10e37dc8917595966 100644 |
--- a/content/browser/download/download_item_impl.cc |
+++ b/content/browser/download/download_item_impl.cc |
@@ -1127,18 +1127,6 @@ void DownloadItemImpl::OnDownloadFileInitialized( |
return; |
} |
- // If we're resuming an interrupted download, we may already know the download |
- // target so we can skip target name determination. GetFullPath() is non-empty |
- // for interrupted downloads where the intermediate file is still present, and |
- // also for downloads with forced paths. |
- if (!GetTargetFilePath().empty() && !GetFullPath().empty()) { |
- // TODO(rdsmith/asanka): Check to confirm that the target path isn't |
- // present on disk; if it is, we should re-do filename determination to |
- // give the user a chance not to collide. |
- MaybeCompleteDownload(); |
- return; |
- } |
- |
delegate_->DetermineDownloadTarget( |
this, base::Bind(&DownloadItemImpl::OnDownloadTargetDetermined, |
weak_ptr_factory_.GetWeakPtr())); |
@@ -1181,6 +1169,15 @@ void DownloadItemImpl::OnDownloadTargetDetermined( |
// space/permission/availability constraints. |
DCHECK(intermediate_path.DirName() == target_path.DirName()); |
+ // During resumption, we may choose to proceed with the same intermediate |
+ // file. No rename is necessary if our intermediate file already has the |
+ // correct name. |
+ if (intermediate_path == current_path_) { |
+ OnDownloadRenamedToIntermediateName(DOWNLOAD_INTERRUPT_REASON_NONE, |
+ intermediate_path); |
+ return; |
+ } |
+ |
Randy Smith (Not in Mondays)
2013/05/15 19:00:18
Why aren't we always using the current_path_ as ou
asanka
2013/05/23 20:30:37
At this point the delegate has requested an interm
Randy Smith (Not in Mondays)
2013/05/24 01:53:55
It just seems a bit weird to have this code here.
asanka
2013/05/29 22:30:11
Can you explain why skipping a rename if the new n
Randy Smith (Not in Mondays)
2013/05/30 21:26:24
Well, no, but I *did* back off from calling it "my
asanka
2013/05/31 19:23:59
Ah. Cool. I added a comment as suggested. I should
|
// Rename to intermediate name. |
// TODO(asanka): Skip this rename if AllDataSaved() is true. This avoids a |
// spurious rename when we can just rename to the final |