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

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..f9101763f493153125da247f6f2f6180a2aba4ea 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,8 +95,6 @@ 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);
@@ -203,11 +202,8 @@ 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.
+ // Can be modified in constructor on any thread, later must be accessed on
+ // file thread.
asanka 2017/03/14 19:44:01 Doesn't need to be restated here. The thread restr
xingliu 2017/03/14 22:48:29 Done.
SourceStreams source_streams_;
// Used to trigger progress updates.

Powered by Google App Engine
This is Rietveld 408576698