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

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

Issue 2750713003: Add UMA for estimating disk bandwidth and the time saved with parallel download (Closed)
Patch Set: address comments Created 3 years, 9 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 const base::FilePath& FullPath() const override; 72 const base::FilePath& FullPath() const override;
73 bool InProgress() const override; 73 bool InProgress() const override;
74 void WasPaused() override;
74 75
75 protected: 76 protected:
76 // For test class overrides. 77 // For test class overrides.
77 // Write data from the offset to the file. 78 // Write data from the offset to the file.
78 // On OS level, it will seek to the |offset| and write from there. 79 // On OS level, it will seek to the |offset| and write from there.
79 virtual DownloadInterruptReason WriteDataToFile(int64_t offset, 80 virtual DownloadInterruptReason WriteDataToFile(int64_t offset,
80 const char* data, 81 const char* data,
81 size_t data_len); 82 size_t data_len);
82 83
83 virtual base::TimeDelta GetRetryDelayForFailedRename(int attempt_number); 84 virtual base::TimeDelta GetRetryDelayForFailedRename(int attempt_number);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 // The file may contain null bytes(holes) in between of valid data slices. 233 // The file may contain null bytes(holes) in between of valid data slices.
233 // TODO(xingliu): Remove this variable. We can use size of |received_slices_| 234 // TODO(xingliu): Remove this variable. We can use size of |received_slices_|
234 // to determine if the file is sparse 235 // to determine if the file is sparse
235 bool is_sparse_file_; 236 bool is_sparse_file_;
236 237
237 // Statistics 238 // Statistics
238 size_t bytes_seen_; 239 size_t bytes_seen_;
239 base::TimeDelta disk_writes_time_; 240 base::TimeDelta disk_writes_time_;
240 base::TimeTicks download_start_; 241 base::TimeTicks download_start_;
241 RateEstimator rate_estimator_; 242 RateEstimator rate_estimator_;
243 int num_active_streams_;
244 bool record_stream_bandwidth_;
245 base::TimeTicks last_update_time_;
246 size_t bytes_seen_with_parallel_streams_;
247 size_t bytes_seen_without_parallel_streams_;
248 base::TimeDelta download_time_with_parallel_streams_;
249 base::TimeDelta download_time_without_parallel_streams_;
242 250
243 std::vector<DownloadItem::ReceivedSlice> received_slices_; 251 std::vector<DownloadItem::ReceivedSlice> received_slices_;
244 252
245 base::WeakPtr<DownloadDestinationObserver> observer_; 253 base::WeakPtr<DownloadDestinationObserver> observer_;
246 base::WeakPtrFactory<DownloadFileImpl> weak_factory_; 254 base::WeakPtrFactory<DownloadFileImpl> weak_factory_;
247 255
248 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl); 256 DISALLOW_COPY_AND_ASSIGN(DownloadFileImpl);
249 }; 257 };
250 258
251 } // namespace content 259 } // namespace content
252 260
253 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_FILE_IMPL_H_ 261 #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