Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Side by Side Diff: content/browser/download/download_file_impl.h

Issue 2782033002: remove is_sparse_file_ from DownloadFileImpl (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 // 42 //
43 // Note that the DownloadFileImpl automatically reads from the passed in 43 // Note that the DownloadFileImpl automatically reads from the passed in
44 // stream, and sends updates and status of those reads to the 44 // stream, and sends updates and status of those reads to the
45 // DownloadDestinationObserver. 45 // DownloadDestinationObserver.
46 DownloadFileImpl( 46 DownloadFileImpl(
47 std::unique_ptr<DownloadSaveInfo> save_info, 47 std::unique_ptr<DownloadSaveInfo> save_info,
48 const base::FilePath& default_downloads_directory, 48 const base::FilePath& default_downloads_directory,
49 std::unique_ptr<ByteStreamReader> stream_reader, 49 std::unique_ptr<ByteStreamReader> stream_reader,
50 const std::vector<DownloadItem::ReceivedSlice>& received_slices, 50 const std::vector<DownloadItem::ReceivedSlice>& received_slices,
51 const net::NetLogWithSource& net_log, 51 const net::NetLogWithSource& net_log,
52 bool is_sparse_file,
53 base::WeakPtr<DownloadDestinationObserver> observer); 52 base::WeakPtr<DownloadDestinationObserver> observer);
54 53
55 ~DownloadFileImpl() override; 54 ~DownloadFileImpl() override;
56 55
57 // DownloadFile functions. 56 // DownloadFile functions.
58 void Initialize(const InitializeCallback& callback) override; 57 void Initialize(const InitializeCallback& callback) override;
59 58
60 void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader, 59 void AddByteStream(std::unique_ptr<ByteStreamReader> stream_reader,
61 int64_t offset, 60 int64_t offset,
62 int64_t length) override; 61 int64_t length) override;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 // The default directory for creating the download file. 241 // The default directory for creating the download file.
243 base::FilePath default_download_directory_; 242 base::FilePath default_download_directory_;
244 243
245 // Map of the offset and the source stream that represents the slice 244 // Map of the offset and the source stream that represents the slice
246 // starting from offset. 245 // starting from offset.
247 SourceStreams source_streams_; 246 SourceStreams source_streams_;
248 247
249 // Used to trigger progress updates. 248 // Used to trigger progress updates.
250 std::unique_ptr<base::RepeatingTimer> update_timer_; 249 std::unique_ptr<base::RepeatingTimer> update_timer_;
251 250
252 // Set to true when multiple byte streams write to the same file.
253 // The file may contain null bytes(holes) in between of valid data slices.
254 // TODO(xingliu): Remove this variable. We can use size of |received_slices_|
255 // to determine if the file is sparse
256 bool is_sparse_file_;
257
258 // Statistics 251 // Statistics
259 size_t bytes_seen_; 252 size_t bytes_seen_;
260 base::TimeDelta disk_writes_time_; 253 base::TimeDelta disk_writes_time_;
261 base::TimeTicks download_start_; 254 base::TimeTicks download_start_;
262 RateEstimator rate_estimator_; 255 RateEstimator rate_estimator_;
263 int num_active_streams_; 256 int num_active_streams_;
264 bool record_stream_bandwidth_; 257 bool record_stream_bandwidth_;
265 base::TimeTicks last_update_time_; 258 base::TimeTicks last_update_time_;
266 size_t bytes_seen_with_parallel_streams_; 259 size_t bytes_seen_with_parallel_streams_;
267 size_t bytes_seen_without_parallel_streams_; 260 size_t bytes_seen_without_parallel_streams_;
268 base::TimeDelta download_time_with_parallel_streams_; 261 base::TimeDelta download_time_with_parallel_streams_;
269 base::TimeDelta download_time_without_parallel_streams_; 262 base::TimeDelta download_time_without_parallel_streams_;
270 263
271 std::vector<DownloadItem::ReceivedSlice> received_slices_; 264 std::vector<DownloadItem::ReceivedSlice> received_slices_;
272 265
273 base::WeakPtr<DownloadDestinationObserver> observer_; 266 base::WeakPtr<DownloadDestinationObserver> observer_;
274 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; 267 base::WeakPtrFactory<DownloadFileImpl> weak_factory_;
275 268
276 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); 269 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl);
277 }; 270 };
278 271
279 } // namespace content 272 } // namespace content
280 273
281 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 274 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698