| 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..f25b4e60013c929f606c1dd2a6139acfa6099204 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; }
|
| + size_t index() { return index_; }
|
| + void set_index(size_t 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. A slice was created
|
| + // once the stream started writing data to the target file.
|
| + size_t 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.
|
|
|