Chromium Code Reviews| 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 // Holds helpers for gathering UMA stats about downloads. | 5 // Holds helpers for gathering UMA stats about downloads. |
| 6 | 6 |
| 7 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 7 #ifndef CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| 8 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 8 #define CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 enum DownloadDiscardReason { | 140 enum DownloadDiscardReason { |
| 141 // The download is being discarded due to a user action. | 141 // The download is being discarded due to a user action. |
| 142 DOWNLOAD_DISCARD_DUE_TO_USER_ACTION, | 142 DOWNLOAD_DISCARD_DUE_TO_USER_ACTION, |
| 143 | 143 |
| 144 // The download is being discarded due to the browser being shut down. | 144 // The download is being discarded due to the browser being shut down. |
| 145 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN | 145 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 // The reason why parallel download is not applicable and fallbacks to a | |
| 149 // non-parallel download. | |
| 150 enum ParallelDownloadFailReason { | |
|
Ilya Sherman
2017/04/07 22:13:08
nit: Could this be an enum class?
xingliu
2017/04/08 01:13:28
Done.
| |
| 151 STRONG_VALIDATORS = 0, | |
| 152 ACCEPT_RANGE_HEADER, | |
| 153 CONTENT_LENGTH_HEADER, | |
| 154 FILE_SIZE, | |
| 155 CONNECTION_TYPE, | |
| 156 FAIL_COUNT, | |
|
Ilya Sherman
2017/04/07 22:13:08
What does "FAIL_COUNT" mean? "EXCEEDED_MAX_ALLOWE
xingliu
2017/04/08 01:13:28
Changed to FALLBACK_TO_NORMAL_DOWNLOAD_COUNT.
| |
| 157 MAX_COUNT, | |
|
Ilya Sherman
2017/04/07 22:13:08
nit: I find "MAX_COUNT" to be a confusing name. C
xingliu
2017/04/08 01:13:28
Done. Reworked the naming and the comments.
| |
| 158 }; | |
| 159 | |
| 148 // Increment one of the above counts. | 160 // Increment one of the above counts. |
| 149 void RecordDownloadCount(DownloadCountTypes type); | 161 void RecordDownloadCount(DownloadCountTypes type); |
| 150 | 162 |
| 151 // Record initiation of a download from a specific source. | 163 // Record initiation of a download from a specific source. |
| 152 void RecordDownloadSource(DownloadSource source); | 164 void RecordDownloadSource(DownloadSource source); |
| 153 | 165 |
| 154 // Record COMPLETED_COUNT and how long the download took. | 166 // Record COMPLETED_COUNT and how long the download took. |
| 155 void RecordDownloadCompleted(const base::TimeTicks& start, | 167 void RecordDownloadCompleted(const base::TimeTicks& start, |
| 156 int64_t download_len); | 168 int64_t download_len); |
| 157 | 169 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 229 void RecordParallelDownloadAddStreamSuccess(bool success); | 241 void RecordParallelDownloadAddStreamSuccess(bool success); |
| 230 | 242 |
| 231 // Records the bandwidth for parallel download and estimates the saved time at | 243 // Records the bandwidth for parallel download and estimates the saved time at |
| 232 // the file end. Does not count in any hash computation or file open/close time. | 244 // the file end. Does not count in any hash computation or file open/close time. |
| 233 void RecordParallelDownloadStats( | 245 void RecordParallelDownloadStats( |
| 234 size_t bytes_downloaded_with_parallel_streams, | 246 size_t bytes_downloaded_with_parallel_streams, |
| 235 base::TimeDelta time_with_parallel_streams, | 247 base::TimeDelta time_with_parallel_streams, |
| 236 size_t bytes_downloaded_without_parallel_streams, | 248 size_t bytes_downloaded_without_parallel_streams, |
| 237 base::TimeDelta time_without_parallel_streams); | 249 base::TimeDelta time_without_parallel_streams); |
| 238 | 250 |
| 251 // Records the reason why the download is not created as parallel download. | |
| 252 void RecordParallelDownloadFailReason(ParallelDownloadFailReason reason); | |
|
qinmin
2017/04/07 21:00:52
This sounds more like a download failed. what abou
xingliu
2017/04/08 01:13:27
Done.
| |
| 253 | |
| 239 // Record the result of a download file rename. | 254 // Record the result of a download file rename. |
| 240 void RecordDownloadFileRenameResultAfterRetry( | 255 void RecordDownloadFileRenameResultAfterRetry( |
| 241 base::TimeDelta time_since_first_failure, | 256 base::TimeDelta time_since_first_failure, |
| 242 DownloadInterruptReason interrupt_reason); | 257 DownloadInterruptReason interrupt_reason); |
| 243 | 258 |
| 244 enum SavePackageEvent { | 259 enum SavePackageEvent { |
| 245 // The user has started to save a page as a package. | 260 // The user has started to save a page as a package. |
| 246 SAVE_PACKAGE_STARTED, | 261 SAVE_PACKAGE_STARTED, |
| 247 | 262 |
| 248 // The save package operation was cancelled. | 263 // The save package operation was cancelled. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 277 | 292 |
| 278 void RecordDownloadConnectionSecurity(const GURL& download_url, | 293 void RecordDownloadConnectionSecurity(const GURL& download_url, |
| 279 const std::vector<GURL>& url_chain); | 294 const std::vector<GURL>& url_chain); |
| 280 | 295 |
| 281 void RecordDownloadSourcePageTransitionType( | 296 void RecordDownloadSourcePageTransitionType( |
| 282 const base::Optional<ui::PageTransition>& transition); | 297 const base::Optional<ui::PageTransition>& transition); |
| 283 | 298 |
| 284 } // namespace content | 299 } // namespace content |
| 285 | 300 |
| 286 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 301 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |