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

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

Issue 2794683002: set content length limit if half open range request fails (Closed)
Patch Set: new comments 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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. So the actual file length cannot be larger than this.
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_
OLDNEW
« no previous file with comments | « content/browser/download/download_file.h ('k') | content/browser/download/download_file_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698