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

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

Issue 2742093002: Glue parallel download job and download file together. (Closed)
Patch Set: Rebase, and adjust unittests with recent landed CLs. 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
« no previous file with comments | « content/browser/download/download_file.h ('k') | content/browser/download/download_file_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 7ccffbab905734b343b644f46047b1faf64acb9f..b47ab678973ba6bee358a65555876a7feca5a3dc 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);
@@ -228,11 +227,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.
« no previous file with comments | « content/browser/download/download_file.h ('k') | content/browser/download/download_file_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698