| 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> |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <unordered_map> | 15 #include <unordered_map> |
| 16 #include <unordered_set> |
| 16 #include <vector> | 17 #include <vector> |
| 17 | 18 |
| 18 #include "base/files/file.h" | 19 #include "base/files/file.h" |
| 19 #include "base/macros.h" | 20 #include "base/macros.h" |
| 20 #include "base/memory/ref_counted.h" | 21 #include "base/memory/ref_counted.h" |
| 21 #include "base/memory/weak_ptr.h" | 22 #include "base/memory/weak_ptr.h" |
| 22 #include "base/threading/thread_checker.h" | 23 #include "base/threading/thread_checker.h" |
| 23 #include "base/time/time.h" | 24 #include "base/time/time.h" |
| 24 #include "base/timer/timer.h" | 25 #include "base/timer/timer.h" |
| 25 #include "content/browser/byte_stream.h" | 26 #include "content/browser/byte_stream.h" |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 // used to initialize file_ on the FILE thread. | 243 // used to initialize file_ on the FILE thread. |
| 243 std::unique_ptr<DownloadSaveInfo> save_info_; | 244 std::unique_ptr<DownloadSaveInfo> save_info_; |
| 244 | 245 |
| 245 // The default directory for creating the download file. | 246 // The default directory for creating the download file. |
| 246 base::FilePath default_download_directory_; | 247 base::FilePath default_download_directory_; |
| 247 | 248 |
| 248 // Map of the offset and the source stream that represents the slice | 249 // Map of the offset and the source stream that represents the slice |
| 249 // starting from offset. | 250 // starting from offset. |
| 250 SourceStreams source_streams_; | 251 SourceStreams source_streams_; |
| 251 | 252 |
| 253 // The offsets of the streams to be closed. Since ByteStreamReader can't close |
| 254 // resource writing to the pipe, we need to close them on UI thread. |
| 255 std::unordered_set<int64_t> streams_to_close_; |
| 256 |
| 252 // Used to trigger progress updates. | 257 // Used to trigger progress updates. |
| 253 std::unique_ptr<base::RepeatingTimer> update_timer_; | 258 std::unique_ptr<base::RepeatingTimer> update_timer_; |
| 254 | 259 |
| 255 // Potential file length. A range request with an offset larger than this | 260 // Potential file length. A range request with an offset larger than this |
| 256 // value will fail. So the actual file length cannot be larger than this. | 261 // value will fail. So the actual file length cannot be larger than this. |
| 257 int64_t potential_file_length_; | 262 int64_t potential_file_length_; |
| 258 | 263 |
| 259 // Statistics | 264 // Statistics |
| 260 size_t bytes_seen_; | 265 size_t bytes_seen_; |
| 261 base::TimeDelta disk_writes_time_; | 266 base::TimeDelta disk_writes_time_; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 273 | 278 |
| 274 base::WeakPtr<DownloadDestinationObserver> observer_; | 279 base::WeakPtr<DownloadDestinationObserver> observer_; |
| 275 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; | 280 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; |
| 276 | 281 |
| 277 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); | 282 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); |
| 278 }; | 283 }; |
| 279 | 284 |
| 280 } // namespace content | 285 } // namespace content |
| 281 | 286 |
| 282 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ | 287 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ |
| OLD | NEW |