Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(288)

Unified Diff: content/browser/download/download_item_impl.cc

Issue 2728673003: Add a utility function to calculate the next slice to download (Closed)
Patch Set: addressing comments Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/download/parallel_download_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 34571f5990cb2b72854feeeef99104b3017c7b33..7772c310ee72519550b019ebc5a50fe4b0c2aa55 100644
--- a/content/browser/download/download_item_impl.cc
+++ b/content/browser/download/download_item_impl.cc
@@ -45,6 +45,7 @@
#include "content/browser/download/download_net_log_parameters.h"
#include "content/browser/download/download_request_handle.h"
#include "content/browser/download/download_stats.h"
+#include "content/browser/download/parallel_download_utils.h"
#include "content/browser/renderer_host/render_view_host_impl.h"
#include "content/browser/web_contents/web_contents_impl.h"
#include "content/public/browser/browser_context.h"
@@ -1944,7 +1945,13 @@ void DownloadItemImpl::ResumeInterruptedDownload(
new DownloadUrlParameters(GetURL(),
storage_partition->GetURLRequestContext()));
download_params->set_file_path(GetFullPath());
- download_params->set_offset(GetReceivedBytes());
+ if (received_slices_.size() > 0) {
+ ReceivedSlice next_slice = FindNextSliceToDownload(received_slices_);
+ download_params->set_offset(next_slice.offset);
+ download_params->set_length(next_slice.received_bytes);
+ } else {
+ download_params->set_offset(GetReceivedBytes());
+ }
download_params->set_last_modified(GetLastModifiedTime());
download_params->set_etag(GetETag());
download_params->set_hash_of_partial_file(hash_);
« no previous file with comments | « content/browser/BUILD.gn ('k') | content/browser/download/parallel_download_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698