| 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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 // Count of downloads that didn't have a valid WebContents at the time it was | 85 // Count of downloads that didn't have a valid WebContents at the time it was |
| 86 // interrupted. | 86 // interrupted. |
| 87 INTERRUPTED_WITHOUT_WEBCONTENTS, | 87 INTERRUPTED_WITHOUT_WEBCONTENTS, |
| 88 | 88 |
| 89 // Count of downloads that supplies a strong validator (implying byte-wise | 89 // Count of downloads that supplies a strong validator (implying byte-wise |
| 90 // equivalence) and has a 'Accept-Ranges: bytes' header. These downloads are | 90 // equivalence) and has a 'Accept-Ranges: bytes' header. These downloads are |
| 91 // candidates for partial resumption. | 91 // candidates for partial resumption. |
| 92 STRONG_VALIDATOR_AND_ACCEPTS_RANGES, | 92 STRONG_VALIDATOR_AND_ACCEPTS_RANGES, |
| 93 | 93 |
| 94 // Count of downloads that uses parallel download requests. | 94 // (Deprecated) Count of downloads that uses parallel download requests. |
| 95 USES_PARALLEL_REQUESTS, | 95 USES_PARALLEL_REQUESTS, |
| 96 | 96 |
| 97 // Count of new downloads. | 97 // Count of new downloads. |
| 98 NEW_DOWNLOAD_COUNT, | 98 NEW_DOWNLOAD_COUNT, |
| 99 | 99 |
| 100 // Count of new downloads that are started in normal profile. | 100 // Count of new downloads that are started in normal profile. |
| 101 NEW_DOWNLOAD_COUNT_NORMAL_PROFILE, | 101 NEW_DOWNLOAD_COUNT_NORMAL_PROFILE, |
| 102 | 102 |
| 103 // Downloads that are actually completed in normal profile. | 103 // Downloads that are actually completed in normal profile. |
| 104 COMPLETED_COUNT_NORMAL_PROFILE, | 104 COMPLETED_COUNT_NORMAL_PROFILE, |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 // Record initiation of a download from a specific source. | 151 // Record initiation of a download from a specific source. |
| 152 void RecordDownloadSource(DownloadSource source); | 152 void RecordDownloadSource(DownloadSource source); |
| 153 | 153 |
| 154 // Record COMPLETED_COUNT and how long the download took. | 154 // Record COMPLETED_COUNT and how long the download took. |
| 155 void RecordDownloadCompleted(const base::TimeTicks& start, | 155 void RecordDownloadCompleted(const base::TimeTicks& start, |
| 156 int64_t download_len); | 156 int64_t download_len); |
| 157 | 157 |
| 158 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. | 158 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. |
| 159 void RecordDownloadInterrupted(DownloadInterruptReason reason, | 159 void RecordDownloadInterrupted(DownloadInterruptReason reason, |
| 160 int64_t received, | 160 int64_t received, |
| 161 int64_t total); | 161 int64_t total, |
| 162 bool uses_parallel_requests); |
| 162 | 163 |
| 163 // Record that a download has been classified as malicious. | 164 // Record that a download has been classified as malicious. |
| 164 void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); | 165 void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); |
| 165 | 166 |
| 166 // Record a dangerous download accept event. | 167 // Record a dangerous download accept event. |
| 167 void RecordDangerousDownloadAccept( | 168 void RecordDangerousDownloadAccept( |
| 168 DownloadDangerType danger_type, | 169 DownloadDangerType danger_type, |
| 169 const base::FilePath& file_path); | 170 const base::FilePath& file_path); |
| 170 | 171 |
| 171 // Record a dangerous download discard event. | 172 // Record a dangerous download discard event. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 210 // was the bottleneck). | 211 // was the bottleneck). |
| 211 void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime, | 212 void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime, |
| 212 base::TimeDelta resource_handler_blocked_time); | 213 base::TimeDelta resource_handler_blocked_time); |
| 213 | 214 |
| 214 // Record overall bandwidth stats at the file end. | 215 // Record overall bandwidth stats at the file end. |
| 215 // Does not count in any hash computation or file open/close time. | 216 // Does not count in any hash computation or file open/close time. |
| 216 void RecordFileBandwidth(size_t length, | 217 void RecordFileBandwidth(size_t length, |
| 217 base::TimeDelta disk_write_time, | 218 base::TimeDelta disk_write_time, |
| 218 base::TimeDelta elapsed_time); | 219 base::TimeDelta elapsed_time); |
| 219 | 220 |
| 221 // Increment one of the count for parallel download. |
| 222 void RecordParallelDownloadCount(DownloadCountTypes type); |
| 223 |
| 220 // Records the bandwidth for parallel download and estimates the saved time at | 224 // Records the bandwidth for parallel download and estimates the saved time at |
| 221 // the file end. Does not count in any hash computation or file open/close time. | 225 // the file end. Does not count in any hash computation or file open/close time. |
| 222 void RecordParallelDownloadStats( | 226 void RecordParallelDownloadStats( |
| 223 size_t bytes_downloaded_with_parallel_streams, | 227 size_t bytes_downloaded_with_parallel_streams, |
| 224 base::TimeDelta time_with_parallel_streams, | 228 base::TimeDelta time_with_parallel_streams, |
| 225 size_t bytes_downloaded_without_parallel_streams, | 229 size_t bytes_downloaded_without_parallel_streams, |
| 226 base::TimeDelta time_without_parallel_streams); | 230 base::TimeDelta time_without_parallel_streams); |
| 227 | 231 |
| 228 // Record the result of a download file rename. | 232 // Record the result of a download file rename. |
| 229 void RecordDownloadFileRenameResultAfterRetry( | 233 void RecordDownloadFileRenameResultAfterRetry( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 | 270 |
| 267 void RecordDownloadConnectionSecurity(const GURL& download_url, | 271 void RecordDownloadConnectionSecurity(const GURL& download_url, |
| 268 const std::vector<GURL>& url_chain); | 272 const std::vector<GURL>& url_chain); |
| 269 | 273 |
| 270 void RecordDownloadSourcePageTransitionType( | 274 void RecordDownloadSourcePageTransitionType( |
| 271 const base::Optional<ui::PageTransition>& transition); | 275 const base::Optional<ui::PageTransition>& transition); |
| 272 | 276 |
| 273 } // namespace content | 277 } // namespace content |
| 274 | 278 |
| 275 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 279 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |