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

Unified Diff: content/browser/download/download_file_impl.h

Issue 2742093002: Glue parallel download job and download file together. (Closed)
Patch Set: Work on feedback. Created 3 years, 9 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/download_file_impl.h
diff --git a/content/browser/download/download_file_impl.h b/content/browser/download/download_file_impl.h
index 61f1f4d90bb054a524b32e402f78111c7d1de5a0..b65a26feeae6ccb7e79fac707b7d3152ed98d66c 100644
--- a/content/browser/download/download_file_impl.h
+++ b/content/browser/download/download_file_impl.h
@@ -58,7 +58,8 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile {
void Initialize(const InitializeCallback& callback) override;
void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
- int64_t offset) override;
+ int64_t offset,
+ int64_t length) override;
void RenameAndUniquify(const base::FilePath& full_path,
const RenameCompletionCallback& callback) override;
@@ -94,15 +95,13 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile {
// |stream_reader_| can be set later when the network response is handled.
//
// Multiple SourceStreams can concurrently write to the same file sink.
- //
- // The file IO processing is finished when all SourceStreams are finished.
class CONTENT_EXPORT SourceStream {
public:
- SourceStream(int64_t offset, int64_t length);
+ SourceStream(int64_t offset,
+ int64_t length,
+ std::unique_ptr<ByteStreamReader> stream_reader);
~SourceStream();
- void SetByteStream(std::unique_ptr<ByteStreamReader> stream_reader);
-
// Called after successfully writing a buffer to disk.
void OnWriteBytesToDisk(int64_t bytes_write);
@@ -203,11 +202,6 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile {
// Map of the offset and the source stream that represents the slice
// starting from offset.
- // Must be created on the same thread that constructs the DownloadFile.
- // Should not add or remove elements after creation.
- // Any byte stream should have a SourceStream before added to the download
- // file.
- // The disk IO is completed when all source streams are finished.
SourceStreams source_streams_;
// Used to trigger progress updates.

Powered by Google App Engine
This is Rietveld 408576698