Chromium Code Reviews| Index: content/browser/download/download_stats.h |
| diff --git a/content/browser/download/download_stats.h b/content/browser/download/download_stats.h |
| index 0c4a5be726edf4de5dd19f07118aec46ae9dce35..cd28ce944397f6820f71fd4a0189ad90d76a2786 100644 |
| --- a/content/browser/download/download_stats.h |
| +++ b/content/browser/download/download_stats.h |
| @@ -145,6 +145,37 @@ enum DownloadDiscardReason { |
| DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN |
| }; |
| +// When parallel download is enabled, the download may fall back to a normal |
| +// download for various reasons. This enum counts the number of parallel |
| +// download and fallbacks. Also records the reasons why the download falls back |
| +// to a normal download. The reasons are not mutual exclusive. |
| +enum class ParallelDownloadCreationEvent { |
|
Ilya Sherman
2017/04/08 01:22:46
nit: Please document that this enum is used to bac
xingliu
2017/04/10 18:56:30
Done.
|
| + // The total number of downloads created as parallel download. |
| + PARALLEL_DOWNLOAD_COUNT = 0, |
|
Ilya Sherman
2017/04/08 01:22:46
Optional nit: I still think it's weird to use "COU
xingliu
2017/04/10 18:56:30
Done.
|
| + |
| + // The total number of downloads fall back to normal download when parallel |
| + // download is enabled. |
| + FALLBACK_TO_NORMAL_DOWNLOAD_COUNT, |
| + |
| + // No ETag or Last-Modified response header. |
| + FALLBACK_REASON_STRONG_VALIDATORS, |
| + |
| + // No Accept-Range response header. |
| + FALLBACK_REASON_ACCEPT_RANGE_HEADER, |
| + |
| + // No Content-Length response header. |
| + FALLBACK_REASON_CONTENT_LENGTH_HEADER, |
| + |
| + // File size is not complied to finch configuration. |
| + FALLBACK_REASON_FILE_SIZE, |
| + |
| + // The HTTP connection type does not meet the requirement. |
| + FALLBACK_REASON_CONNECTION_TYPE, |
| + |
| + // Last entry of the enum. |
| + MAX, |
|
Ilya Sherman
2017/04/08 01:22:46
Optional nit: IMO "max" makes sense to use as an a
xingliu
2017/04/10 18:56:30
Done.
|
| +}; |
| + |
| // Increment one of the above counts. |
| void RecordDownloadCount(DownloadCountTypes type); |
| @@ -236,6 +267,10 @@ void RecordParallelDownloadStats( |
| size_t bytes_downloaded_without_parallel_streams, |
| base::TimeDelta time_without_parallel_streams); |
| +// Records the parallel download creation counts and the reasons why the |
| +// download falls back to non-parallel download. |
| +void RecordParallelDownloadCreationEvent(ParallelDownloadCreationEvent event); |
| + |
| // Record the result of a download file rename. |
| void RecordDownloadFileRenameResultAfterRetry( |
| base::TimeDelta time_since_first_failure, |