| 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. Use |
| 95 // PARALLEL_DOWNLOAD_START_COUNT instead. |
| 95 USES_PARALLEL_REQUESTS, | 96 USES_PARALLEL_REQUESTS, |
| 96 | 97 |
| 97 DOWNLOAD_COUNT_TYPES_LAST_ENTRY | 98 DOWNLOAD_COUNT_TYPES_LAST_ENTRY |
| 98 }; | 99 }; |
| 99 | 100 |
| 101 // Enums for Download.ParallelDownloadCounts. |
| 102 enum ParallelDownloadCountTypes { |
| 103 // Downloads that actually complete. |
| 104 PARALLEL_DOWNLOAD_COMPLETED_COUNT, |
| 105 |
| 106 // Downloads that are cancelled before completion (user action or error). |
| 107 PARALLEL_DOWNLOAD_CANCELLED_COUNT, |
| 108 |
| 109 // Downloads that are started. |
| 110 PARALLEL_DOWNLOAD_START_COUNT, |
| 111 |
| 112 // Downloads that were interrupted by the OS. |
| 113 PARALLEL_DOWNLOAD_INTERRUPTED_COUNT, |
| 114 |
| 115 // Counts interruptions that happened at the end of the download. |
| 116 PARALLEL_DOWNLOAD_INTERRUPTED_AT_END_COUNT, |
| 117 |
| 118 PARALLEL_DOWNLOAD_COUNT_TYPES_LAST_ENTRY |
| 119 }; |
| 120 |
| 100 enum DownloadSource { | 121 enum DownloadSource { |
| 101 // The download was initiated when the SavePackage system rejected | 122 // The download was initiated when the SavePackage system rejected |
| 102 // a Save Page As ... by returning false from | 123 // a Save Page As ... by returning false from |
| 103 // SavePackage::IsSaveableContents(). | 124 // SavePackage::IsSaveableContents(). |
| 104 INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML = 0, | 125 INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML = 0, |
| 105 | 126 |
| 106 // The download was initiated by a drag and drop from a drag-and-drop | 127 // The download was initiated by a drag and drop from a drag-and-drop |
| 107 // enabled web application. | 128 // enabled web application. |
| 108 INITIATED_BY_DRAG_N_DROP, | 129 INITIATED_BY_DRAG_N_DROP, |
| 109 | 130 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // Record initiation of a download from a specific source. | 163 // Record initiation of a download from a specific source. |
| 143 void RecordDownloadSource(DownloadSource source); | 164 void RecordDownloadSource(DownloadSource source); |
| 144 | 165 |
| 145 // Record COMPLETED_COUNT and how long the download took. | 166 // Record COMPLETED_COUNT and how long the download took. |
| 146 void RecordDownloadCompleted(const base::TimeTicks& start, | 167 void RecordDownloadCompleted(const base::TimeTicks& start, |
| 147 int64_t download_len); | 168 int64_t download_len); |
| 148 | 169 |
| 149 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. | 170 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. |
| 150 void RecordDownloadInterrupted(DownloadInterruptReason reason, | 171 void RecordDownloadInterrupted(DownloadInterruptReason reason, |
| 151 int64_t received, | 172 int64_t received, |
| 152 int64_t total); | 173 int64_t total, |
| 174 bool uses_parallel_requests); |
| 153 | 175 |
| 154 // Record that a download has been classified as malicious. | 176 // Record that a download has been classified as malicious. |
| 155 void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); | 177 void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); |
| 156 | 178 |
| 157 // Record a dangerous download accept event. | 179 // Record a dangerous download accept event. |
| 158 void RecordDangerousDownloadAccept( | 180 void RecordDangerousDownloadAccept( |
| 159 DownloadDangerType danger_type, | 181 DownloadDangerType danger_type, |
| 160 const base::FilePath& file_path); | 182 const base::FilePath& file_path); |
| 161 | 183 |
| 162 // Record a dangerous download discard event. | 184 // Record a dangerous download discard event. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // was the bottleneck). | 220 // was the bottleneck). |
| 199 void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime, | 221 void RecordNetworkBlockage(base::TimeDelta resource_handler_lifetime, |
| 200 base::TimeDelta resource_handler_blocked_time); | 222 base::TimeDelta resource_handler_blocked_time); |
| 201 | 223 |
| 202 // Record overall bandwidth stats at the file end. | 224 // Record overall bandwidth stats at the file end. |
| 203 // Does not count in any hash computation or file open/close time. | 225 // Does not count in any hash computation or file open/close time. |
| 204 void RecordFileBandwidth(size_t length, | 226 void RecordFileBandwidth(size_t length, |
| 205 base::TimeDelta disk_write_time, | 227 base::TimeDelta disk_write_time, |
| 206 base::TimeDelta elapsed_time); | 228 base::TimeDelta elapsed_time); |
| 207 | 229 |
| 230 // Increment one of the count for parallel download. |
| 231 void RecordParallelDownloadCount(ParallelDownloadCountTypes type); |
| 232 |
| 208 // Records the bandwidth for parallel download and estimates the saved time at | 233 // Records the bandwidth for parallel download and estimates the saved time at |
| 209 // the file end. Does not count in any hash computation or file open/close time. | 234 // the file end. Does not count in any hash computation or file open/close time. |
| 210 void RecordParallelDownloadStats( | 235 void RecordParallelDownloadStats( |
| 211 size_t bytes_downloaded_with_parallel_streams, | 236 size_t bytes_downloaded_with_parallel_streams, |
| 212 base::TimeDelta time_with_parallel_streams, | 237 base::TimeDelta time_with_parallel_streams, |
| 213 size_t bytes_downloaded_without_parallel_streams, | 238 size_t bytes_downloaded_without_parallel_streams, |
| 214 base::TimeDelta time_without_parallel_streams); | 239 base::TimeDelta time_without_parallel_streams); |
| 215 | 240 |
| 216 // Record the result of a download file rename. | 241 // Record the result of a download file rename. |
| 217 void RecordDownloadFileRenameResultAfterRetry( | 242 void RecordDownloadFileRenameResultAfterRetry( |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 279 |
| 255 void RecordDownloadConnectionSecurity(const GURL& download_url, | 280 void RecordDownloadConnectionSecurity(const GURL& download_url, |
| 256 const std::vector<GURL>& url_chain); | 281 const std::vector<GURL>& url_chain); |
| 257 | 282 |
| 258 void RecordDownloadSourcePageTransitionType( | 283 void RecordDownloadSourcePageTransitionType( |
| 259 const base::Optional<ui::PageTransition>& transition); | 284 const base::Optional<ui::PageTransition>& transition); |
| 260 | 285 |
| 261 } // namespace content | 286 } // namespace content |
| 262 | 287 |
| 263 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 288 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |