| 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 188 void RecordDownloadSource(DownloadSource source); | 188 void RecordDownloadSource(DownloadSource source); |
| 189 | 189 |
| 190 // Record COMPLETED_COUNT and how long the download took. | 190 // Record COMPLETED_COUNT and how long the download took. |
| 191 void RecordDownloadCompleted(const base::TimeTicks& start, | 191 void RecordDownloadCompleted(const base::TimeTicks& start, |
| 192 int64_t download_len); | 192 int64_t download_len); |
| 193 | 193 |
| 194 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. | 194 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. |
| 195 void RecordDownloadInterrupted(DownloadInterruptReason reason, | 195 void RecordDownloadInterrupted(DownloadInterruptReason reason, |
| 196 int64_t received, | 196 int64_t received, |
| 197 int64_t total, | 197 int64_t total, |
| 198 bool uses_parallel_requests); | 198 bool is_parallelizable, |
| 199 bool is_parallel_download_enabled); |
| 199 | 200 |
| 200 // Record that a download has been classified as malicious. | 201 // Record that a download has been classified as malicious. |
| 201 void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); | 202 void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); |
| 202 | 203 |
| 203 // Record a dangerous download accept event. | 204 // Record a dangerous download accept event. |
| 204 void RecordDangerousDownloadAccept( | 205 void RecordDangerousDownloadAccept( |
| 205 DownloadDangerType danger_type, | 206 DownloadDangerType danger_type, |
| 206 const base::FilePath& file_path); | 207 const base::FilePath& file_path); |
| 207 | 208 |
| 208 // Record a dangerous download discard event. | 209 // Record a dangerous download discard event. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // was the bottleneck). | 248 // was the bottleneck). |
| 248 void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime, | 249 void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime, |
| 249 base::TimeDelta resource_handler_blocked_time); | 250 base::TimeDelta resource_handler_blocked_time); |
| 250 | 251 |
| 251 // Record overall bandwidth stats at the file end. | 252 // Record overall bandwidth stats at the file end. |
| 252 // Does not count in any hash computation or file open/close time. | 253 // Does not count in any hash computation or file open/close time. |
| 253 void RecordFileBandwidth(size_t length, | 254 void RecordFileBandwidth(size_t length, |
| 254 base::TimeDelta disk_write_time, | 255 base::TimeDelta disk_write_time, |
| 255 base::TimeDelta elapsed_time); | 256 base::TimeDelta elapsed_time); |
| 256 | 257 |
| 257 // Increment one of the count for parallel download. | 258 // Increment one of the count for parallelizable download. |
| 258 void RecordParallelDownloadCount(DownloadCountTypes type); | 259 void RecordParallelizableDownloadCount(DownloadCountTypes type, |
| 260 bool is_parallel_download_enabled); |
| 259 | 261 |
| 260 // Records the actual total number of requests sent for a parallel download, | 262 // Records the actual total number of requests sent for a parallel download, |
| 261 // including the initial request. | 263 // including the initial request. |
| 262 void RecordParallelDownloadRequestCount(int request_count); | 264 void RecordParallelDownloadRequestCount(int request_count); |
| 263 | 265 |
| 264 // Records if each byte stream is successfully added to download sink. | 266 // Records if each byte stream is successfully added to download sink. |
| 265 void RecordParallelDownloadAddStreamSuccess(bool success); | 267 void RecordParallelDownloadAddStreamSuccess(bool success); |
| 266 | 268 |
| 267 // Records the bandwidth for parallel download and estimates the saved time at | 269 // Records the bandwidth for parallelizable download and estimates the saved |
| 268 // the file end. Does not count in any hash computation or file open/close time. | 270 // time at the file end. Does not count in any hash computation or file |
| 269 void RecordParallelDownloadStats( | 271 // open/close time. |
| 272 void RecordParallelizableDownloadStats( |
| 270 size_t bytes_downloaded_with_parallel_streams, | 273 size_t bytes_downloaded_with_parallel_streams, |
| 271 base::TimeDelta time_with_parallel_streams, | 274 base::TimeDelta time_with_parallel_streams, |
| 272 size_t bytes_downloaded_without_parallel_streams, | 275 size_t bytes_downloaded_without_parallel_streams, |
| 273 base::TimeDelta time_without_parallel_streams); | 276 base::TimeDelta time_without_parallel_streams, |
| 277 bool uses_parallel_requests); |
| 274 | 278 |
| 275 // Records the parallel download creation counts and the reasons why the | 279 // Records the parallel download creation counts and the reasons why the |
| 276 // download falls back to non-parallel download. | 280 // download falls back to non-parallel download. |
| 277 void RecordParallelDownloadCreationEvent(ParallelDownloadCreationEvent event); | 281 void RecordParallelDownloadCreationEvent(ParallelDownloadCreationEvent event); |
| 278 | 282 |
| 279 // Record the result of a download file rename. | 283 // Record the result of a download file rename. |
| 280 void RecordDownloadFileRenameResultAfterRetry( | 284 void RecordDownloadFileRenameResultAfterRetry( |
| 281 base::TimeDelta time_since_first_failure, | 285 base::TimeDelta time_since_first_failure, |
| 282 DownloadInterruptReason interrupt_reason); | 286 DownloadInterruptReason interrupt_reason); |
| 283 | 287 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 | 321 |
| 318 void RecordDownloadConnectionSecurity(const GURL& download_url, | 322 void RecordDownloadConnectionSecurity(const GURL& download_url, |
| 319 const std::vector<GURL>& url_chain); | 323 const std::vector<GURL>& url_chain); |
| 320 | 324 |
| 321 void RecordDownloadSourcePageTransitionType( | 325 void RecordDownloadSourcePageTransitionType( |
| 322 const base::Optional<ui::PageTransition>& transition); | 326 const base::Optional<ui::PageTransition>& transition); |
| 323 | 327 |
| 324 } // namespace content | 328 } // namespace content |
| 325 | 329 |
| 326 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 330 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |