| 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 // When parallel download is enabled, the download may fall back to a normal |
| 149 // download for various reasons. This enum counts the number of parallel |
| 150 // download and fallbacks. Also records the reasons why the download falls back |
| 151 // to a normal download. The reasons are not mutually exclusive. |
| 152 // Used in histogram "Download.ParallelDownload.CreationEvent" and should be |
| 153 // treated as append-only. |
| 154 enum class ParallelDownloadCreationEvent { |
| 155 // The total number of downloads started as parallel download. |
| 156 STARTED_PARALLEL_DOWNLOAD = 0, |
| 157 |
| 158 // The total number of downloads fell back to normal download when parallel |
| 159 // download is enabled. |
| 160 FELL_BACK_TO_NORMAL_DOWNLOAD, |
| 161 |
| 162 // No ETag or Last-Modified response header. |
| 163 FALLBACK_REASON_STRONG_VALIDATORS, |
| 164 |
| 165 // No Accept-Range response header. |
| 166 FALLBACK_REASON_ACCEPT_RANGE_HEADER, |
| 167 |
| 168 // No Content-Length response header. |
| 169 FALLBACK_REASON_CONTENT_LENGTH_HEADER, |
| 170 |
| 171 // File size is not complied to finch configuration. |
| 172 FALLBACK_REASON_FILE_SIZE, |
| 173 |
| 174 // The HTTP connection type does not meet the requirement. |
| 175 FALLBACK_REASON_CONNECTION_TYPE, |
| 176 |
| 177 // Last entry of the enum. |
| 178 COUNT, |
| 179 }; |
| 180 |
| 148 // Increment one of the above counts. | 181 // Increment one of the above counts. |
| 149 void RecordDownloadCount(DownloadCountTypes type); | 182 void RecordDownloadCount(DownloadCountTypes type); |
| 150 | 183 |
| 151 // Record initiation of a download from a specific source. | 184 // Record initiation of a download from a specific source. |
| 152 void RecordDownloadSource(DownloadSource source); | 185 void RecordDownloadSource(DownloadSource source); |
| 153 | 186 |
| 154 // Record COMPLETED_COUNT and how long the download took. | 187 // Record COMPLETED_COUNT and how long the download took. |
| 155 void RecordDownloadCompleted(const base::TimeTicks& start, | 188 void RecordDownloadCompleted(const base::TimeTicks& start, |
| 156 int64_t download_len); | 189 int64_t download_len); |
| 157 | 190 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 void RecordParallelDownloadAddStreamSuccess(bool success); | 262 void RecordParallelDownloadAddStreamSuccess(bool success); |
| 230 | 263 |
| 231 // Records the bandwidth for parallel download and estimates the saved time at | 264 // 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. | 265 // the file end. Does not count in any hash computation or file open/close time. |
| 233 void RecordParallelDownloadStats( | 266 void RecordParallelDownloadStats( |
| 234 size_t bytes_downloaded_with_parallel_streams, | 267 size_t bytes_downloaded_with_parallel_streams, |
| 235 base::TimeDelta time_with_parallel_streams, | 268 base::TimeDelta time_with_parallel_streams, |
| 236 size_t bytes_downloaded_without_parallel_streams, | 269 size_t bytes_downloaded_without_parallel_streams, |
| 237 base::TimeDelta time_without_parallel_streams); | 270 base::TimeDelta time_without_parallel_streams); |
| 238 | 271 |
| 272 // Records the parallel download creation counts and the reasons why the |
| 273 // download falls back to non-parallel download. |
| 274 void RecordParallelDownloadCreationEvent(ParallelDownloadCreationEvent event); |
| 275 |
| 239 // Record the result of a download file rename. | 276 // Record the result of a download file rename. |
| 240 void RecordDownloadFileRenameResultAfterRetry( | 277 void RecordDownloadFileRenameResultAfterRetry( |
| 241 base::TimeDelta time_since_first_failure, | 278 base::TimeDelta time_since_first_failure, |
| 242 DownloadInterruptReason interrupt_reason); | 279 DownloadInterruptReason interrupt_reason); |
| 243 | 280 |
| 244 enum SavePackageEvent { | 281 enum SavePackageEvent { |
| 245 // The user has started to save a page as a package. | 282 // The user has started to save a page as a package. |
| 246 SAVE_PACKAGE_STARTED, | 283 SAVE_PACKAGE_STARTED, |
| 247 | 284 |
| 248 // The save package operation was cancelled. | 285 // The save package operation was cancelled. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 277 | 314 |
| 278 void RecordDownloadConnectionSecurity(const GURL& download_url, | 315 void RecordDownloadConnectionSecurity(const GURL& download_url, |
| 279 const std::vector<GURL>& url_chain); | 316 const std::vector<GURL>& url_chain); |
| 280 | 317 |
| 281 void RecordDownloadSourcePageTransitionType( | 318 void RecordDownloadSourcePageTransitionType( |
| 282 const base::Optional<ui::PageTransition>& transition); | 319 const base::Optional<ui::PageTransition>& transition); |
| 283 | 320 |
| 284 } // namespace content | 321 } // namespace content |
| 285 | 322 |
| 286 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 323 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |