Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 5 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 6 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| 7 | 7 |
| 8 #include "content/browser/download/download_file.h" | 8 #include "content/browser/download/download_file.h" |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 62 | 62 |
| 63 void RenameAndUniquify(const base::FilePath& full_path, | 63 void RenameAndUniquify(const base::FilePath& full_path, |
| 64 const RenameCompletionCallback& callback) override; | 64 const RenameCompletionCallback& callback) override; |
| 65 void RenameAndAnnotate(const base::FilePath& full_path, | 65 void RenameAndAnnotate(const base::FilePath& full_path, |
| 66 const std::string& client_guid, | 66 const std::string& client_guid, |
| 67 const GURL& source_url, | 67 const GURL& source_url, |
| 68 const GURL& referrer_url, | 68 const GURL& referrer_url, |
| 69 const RenameCompletionCallback& callback) override; | 69 const RenameCompletionCallback& callback) override; |
| 70 void Detach() override; | 70 void Detach() override; |
| 71 void Cancel() override; | 71 void Cancel() override; |
| 72 void SetPotentialFileLength(int64_t length) override; | |
| 72 const base::FilePath& FullPath() const override; | 73 const base::FilePath& FullPath() const override; |
| 73 bool InProgress() const override; | 74 bool InProgress() const override; |
| 74 void WasPaused() override; | 75 void WasPaused() override; |
| 75 | 76 |
| 76 protected: | 77 protected: |
| 77 // For test class overrides. | 78 // For test class overrides. |
| 78 // Write data from the offset to the file. | 79 // Write data from the offset to the file. |
| 79 // On OS level, it will seek to the |offset| and write from there. | 80 // On OS level, it will seek to the |offset| and write from there. |
| 80 virtual DownloadInterruptReason WriteDataToFile(int64_t offset, | 81 virtual DownloadInterruptReason WriteDataToFile(int64_t offset, |
| 81 const char* data, | 82 const char* data, |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 244 // The default directory for creating the download file. | 245 // The default directory for creating the download file. |
| 245 base::FilePath default_download_directory_; | 246 base::FilePath default_download_directory_; |
| 246 | 247 |
| 247 // Map of the offset and the source stream that represents the slice | 248 // Map of the offset and the source stream that represents the slice |
| 248 // starting from offset. | 249 // starting from offset. |
| 249 SourceStreams source_streams_; | 250 SourceStreams source_streams_; |
| 250 | 251 |
| 251 // Used to trigger progress updates. | 252 // Used to trigger progress updates. |
| 252 std::unique_ptr<base::RepeatingTimer> update_timer_; | 253 std::unique_ptr<base::RepeatingTimer> update_timer_; |
| 253 | 254 |
| 255 // Potential file length. A range request with an offset larger than this | |
| 256 // value will fail. The actual file length should not be larger than this. | |
|
David Trainor- moved to gerrit
2017/04/03 17:47:31
When would the file length be less than this if we
qinmin
2017/04/03 18:33:11
If the length is determined upon completion of a h
| |
| 257 int64_t potential_file_length_; | |
| 258 | |
| 254 // Statistics | 259 // Statistics |
| 255 size_t bytes_seen_; | 260 size_t bytes_seen_; |
| 256 base::TimeDelta disk_writes_time_; | 261 base::TimeDelta disk_writes_time_; |
| 257 base::TimeTicks download_start_; | 262 base::TimeTicks download_start_; |
| 258 RateEstimator rate_estimator_; | 263 RateEstimator rate_estimator_; |
| 259 int num_active_streams_; | 264 int num_active_streams_; |
| 260 bool record_stream_bandwidth_; | 265 bool record_stream_bandwidth_; |
| 261 base::TimeTicks last_update_time_; | 266 base::TimeTicks last_update_time_; |
| 262 size_t bytes_seen_with_parallel_streams_; | 267 size_t bytes_seen_with_parallel_streams_; |
| 263 size_t bytes_seen_without_parallel_streams_; | 268 size_t bytes_seen_without_parallel_streams_; |
| 264 base::TimeDelta download_time_with_parallel_streams_; | 269 base::TimeDelta download_time_with_parallel_streams_; |
| 265 base::TimeDelta download_time_without_parallel_streams_; | 270 base::TimeDelta download_time_without_parallel_streams_; |
| 266 | 271 |
| 267 std::vector<DownloadItem::ReceivedSlice> received_slices_; | 272 std::vector<DownloadItem::ReceivedSlice> received_slices_; |
| 268 | 273 |
| 269 base::WeakPtr<DownloadDestinationObserver> observer_; | 274 base::WeakPtr<DownloadDestinationObserver> observer_; |
| 270 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 275 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
| 271 | 276 |
| 272 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 277 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 273 }; | 278 }; |
| 274 | 279 |
| 275 } // namespace content | 280 } // namespace content |
| 276 | 281 |
| 277 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 282 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| OLD | NEW |