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

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: 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 SetContentLengthLimit(int64_t limit) 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 // Maximum length of the file, -1 if the limit is unknown.
xingliu 2017/03/31 23:38:21 nit%: It's a bit confusing that people might think
qinmin 2017/04/01 05:20:02 it is different, the limit is the upper bound, the
xingliu 2017/04/03 16:51:56 Thanks.
256 int64_t content_length_limit_;
257
254 // Statistics 258 // Statistics
255 size_t bytes_seen_; 259 size_t bytes_seen_;
256 base::TimeDelta disk_writes_time_; 260 base::TimeDelta disk_writes_time_;
257 base::TimeTicks download_start_; 261 base::TimeTicks download_start_;
258 RateEstimator rate_estimator_; 262 RateEstimator rate_estimator_;
259 int num_active_streams_; 263 int num_active_streams_;
260 bool record_stream_bandwidth_; 264 bool record_stream_bandwidth_;
261 base::TimeTicks last_update_time_; 265 base::TimeTicks last_update_time_;
262 size_t bytes_seen_with_parallel_streams_; 266 size_t bytes_seen_with_parallel_streams_;
263 size_t bytes_seen_without_parallel_streams_; 267 size_t bytes_seen_without_parallel_streams_;
264 base::TimeDelta download_time_with_parallel_streams_; 268 base::TimeDelta download_time_with_parallel_streams_;
265 base::TimeDelta download_time_without_parallel_streams_; 269 base::TimeDelta download_time_without_parallel_streams_;
266 270
267 std::vector<DownloadItem::ReceivedSlice> received_slices_; 271 std::vector<DownloadItem::ReceivedSlice> received_slices_;
268 272
269 base::WeakPtr<DownloadDestinationObserver> observer_; 273 base::WeakPtr<DownloadDestinationObserver> observer_;
270 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; 274 base::WeakPtrFactory<DownloadFileImpl> weak_factory_;
271 275
272 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); 276 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl);
273 }; 277 };
274 278
275 } // namespace content 279 } // namespace content
276 280
277 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 281 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698