| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 void AddNewSlice(int64_t offset, int64_t length); | 206 void AddNewSlice(int64_t offset, int64_t length); |
| 207 | 207 |
| 208 // Check if download is completed. | 208 // Check if download is completed. |
| 209 bool IsDownloadCompleted(); | 209 bool IsDownloadCompleted(); |
| 210 | 210 |
| 211 // Return the total valid bytes received in the target file. | 211 // Return the total valid bytes received in the target file. |
| 212 // If the file is a sparse file, return the total number of valid bytes. | 212 // If the file is a sparse file, return the total number of valid bytes. |
| 213 // Otherwise, return the current file size. | 213 // Otherwise, return the current file size. |
| 214 int64_t TotalBytesReceived() const; | 214 int64_t TotalBytesReceived() const; |
| 215 | 215 |
| 216 // Helper method to handle stream error |
| 217 void HandleStreamError(SourceStream* source_stream, |
| 218 DownloadInterruptReason reason); |
| 219 |
| 220 // Given a SourceStream object, returns its neighbor that preceds it if |
| 221 // SourceStreams are ordered by their offsets |
| 222 SourceStream* FindPrecedingNeighbor(SourceStream* source_stream); |
| 223 |
| 216 net::NetLogWithSource net_log_; | 224 net::NetLogWithSource net_log_; |
| 217 | 225 |
| 218 // The base file instance. | 226 // The base file instance. |
| 219 BaseFile file_; | 227 BaseFile file_; |
| 220 | 228 |
| 221 // DownloadSaveInfo provided during construction. Since the DownloadFileImpl | 229 // DownloadSaveInfo provided during construction. Since the DownloadFileImpl |
| 222 // can be created on any thread, this holds the save_info_ until it can be | 230 // can be created on any thread, this holds the save_info_ until it can be |
| 223 // used to initialize file_ on the FILE thread. | 231 // used to initialize file_ on the FILE thread. |
| 224 std::unique_ptr<DownloadSaveInfo> save_info_; | 232 std::unique_ptr<DownloadSaveInfo> save_info_; |
| 225 | 233 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 256 | 264 |
| 257 base::WeakPtr<DownloadDestinationObserver> observer_; | 265 base::WeakPtr<DownloadDestinationObserver> observer_; |
| 258 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 266 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
| 259 | 267 |
| 260 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 268 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 261 }; | 269 }; |
| 262 | 270 |
| 263 } // namespace content | 271 } // namespace content |
| 264 | 272 |
| 265 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 273 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| OLD | NEW |