| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 const base::FilePath& FullPath() const override; | 72 const base::FilePath& FullPath() const override; |
| 73 bool InProgress() const override; | 73 bool InProgress() const override; |
| 74 void Pause() override; |
| 74 | 75 |
| 75 protected: | 76 protected: |
| 76 // For test class overrides. | 77 // For test class overrides. |
| 77 // Write data from the offset to the file. | 78 // Write data from the offset to the file. |
| 78 // On OS level, it will seek to the |offset| and write from there. | 79 // On OS level, it will seek to the |offset| and write from there. |
| 79 virtual DownloadInterruptReason WriteDataToFile(int64_t offset, | 80 virtual DownloadInterruptReason WriteDataToFile(int64_t offset, |
| 80 const char* data, | 81 const char* data, |
| 81 size_t data_len); | 82 size_t data_len); |
| 82 | 83 |
| 83 virtual base::TimeDelta GetRetryDelayForFailedRename(int attempt_number); | 84 virtual base::TimeDelta GetRetryDelayForFailedRename(int attempt_number); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 // Set to true when multiple byte streams write to the same file. | 217 // Set to true when multiple byte streams write to the same file. |
| 217 // The file may contain null bytes(holes) in between of valid data slices. | 218 // The file may contain null bytes(holes) in between of valid data slices. |
| 218 // TODO(xingliu): Pass a slice info vector to determine if the file is sparse. | 219 // TODO(xingliu): Pass a slice info vector to determine if the file is sparse. |
| 219 bool is_sparse_file_; | 220 bool is_sparse_file_; |
| 220 | 221 |
| 221 // Statistics | 222 // Statistics |
| 222 size_t bytes_seen_; | 223 size_t bytes_seen_; |
| 223 base::TimeDelta disk_writes_time_; | 224 base::TimeDelta disk_writes_time_; |
| 224 base::TimeTicks download_start_; | 225 base::TimeTicks download_start_; |
| 225 RateEstimator rate_estimator_; | 226 RateEstimator rate_estimator_; |
| 227 int num_active_streams_; |
| 228 bool record_stream_bandwidth_; |
| 229 base::TimeTicks last_update_time_; |
| 230 size_t bytes_seen_with_parallel_streams_; |
| 231 size_t bytes_seen_without_parallel_streams_; |
| 232 base::TimeDelta download_time_with_parallel_streams_; |
| 233 base::TimeDelta download_time_without_parallel_streams_; |
| 226 | 234 |
| 227 std::vector<DownloadItem::ReceivedSlice> received_slices_; | 235 std::vector<DownloadItem::ReceivedSlice> received_slices_; |
| 228 | 236 |
| 229 base::WeakPtr<DownloadDestinationObserver> observer_; | 237 base::WeakPtr<DownloadDestinationObserver> observer_; |
| 230 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 238 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
| 231 | 239 |
| 232 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 240 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 233 }; | 241 }; |
| 234 | 242 |
| 235 } // namespace content | 243 } // namespace content |
| 236 | 244 |
| 237 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 245 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| OLD | NEW |