Chromium Code Reviews| 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..ac7643072c3d417be5247d3d16cc4b60dbc4e92c 100644 |
| --- a/content/browser/download/download_file_impl.h |
| +++ b/content/browser/download/download_file_impl.h |
| @@ -109,9 +109,12 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile { |
| ByteStreamReader* stream_reader() const { return stream_reader_.get(); } |
| int64_t offset() const { return offset_; } |
| int64_t length() const { return length_; } |
| + void set_length(int64_t length) { length_ = length; } |
| int64_t bytes_written() const { return bytes_written_; } |
| bool is_finished() const { return finished_; } |
| void set_finished(bool finish) { finished_ = finish; } |
| + int index() { return index_; } |
| + void set_index(int index) { index_ = index; } |
| private: |
| // Starting position for the stream to write to disk. |
| @@ -129,6 +132,10 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile { |
| // disk. |
| bool finished_; |
| + // The slice index in the |received_slices_| vector once the stream has |
| + // created a slice. |
|
xingliu
2017/03/07 22:18:13
nit%: Can we explicitly say written data will resu
qinmin
2017/03/08 18:46:33
Done.
|
| + int index_; |
| + |
| // The stream through which data comes. |
| std::unique_ptr<ByteStreamReader> stream_reader_; |
| @@ -183,6 +190,11 @@ class CONTENT_EXPORT DownloadFileImpl : public DownloadFile { |
| // Register callback and start to read data from the stream. |
| void RegisterAndActivateStream(SourceStream* source_stream); |
| + // Adds a new slice to |received_slices_| and update the existing entries in |
| + // |source_streams_| as their lengths will change. |
| + // TODO(qinmin): add a test for this function. |
| + void AddNewSlice(int64_t offset, int64_t length); |
| + |
| // Return the total valid bytes received in the target file. |
| // If the file is a sparse file, return the total number of valid bytes. |
| // Otherwise, return the current file size. |