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

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

Issue 2812263004: Properly handle the case when a parallel download becomes non-parallel (Closed)
Patch Set: rebase Created 3 years, 8 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
Index: content/browser/download/parallel_download_utils.cc
diff --git a/content/browser/download/parallel_download_utils.cc b/content/browser/download/parallel_download_utils.cc
index cf47408ed822ae129476b4f9c9e32ee04cacdc97..40f4397a10533a3ff559bdcd1b1e4d69cf732a4a 100644
--- a/content/browser/download/parallel_download_utils.cc
+++ b/content/browser/download/parallel_download_utils.cc
@@ -167,4 +167,17 @@ void DebugSlicesInfo(const DownloadItem::ReceivedSlices& slices) {
}
}
+CONTENT_EXPORT int64_t GetMaxContiguousDataBlockSizeFromBeginning(
+ const DownloadItem::ReceivedSlices& slices) {
+ std::vector<DownloadItem::ReceivedSlice>::const_iterator iter =
+ slices.begin();
+
+ int64_t size = 0;
+ while (iter != slices.end() && iter->offset == size) {
+ size += iter->received_bytes;
+ iter++;
+ }
+ return size;
+}
+
} // namespace content
« no previous file with comments | « content/browser/download/parallel_download_utils.h ('k') | content/browser/download/parallel_download_utils_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698