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 <string> | 10 #include <string> |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // This can happen when saving web pages as complete packages. It happens | 65 // This can happen when saving web pages as complete packages. It happens |
66 // when we get messages to append data to files that have already finished and | 66 // when we get messages to append data to files that have already finished and |
67 // been detached, but haven't yet been removed from the list of files in | 67 // been detached, but haven't yet been removed from the list of files in |
68 // progress. | 68 // progress. |
69 APPEND_TO_DETACHED_FILE_COUNT, | 69 APPEND_TO_DETACHED_FILE_COUNT, |
70 | 70 |
71 // Counts the number of instances where the downloaded file is missing after a | 71 // Counts the number of instances where the downloaded file is missing after a |
72 // successful invocation of ScanAndSaveDownloadedFile(). | 72 // successful invocation of ScanAndSaveDownloadedFile(). |
73 FILE_MISSING_AFTER_SUCCESSFUL_SCAN_COUNT, | 73 FILE_MISSING_AFTER_SUCCESSFUL_SCAN_COUNT, |
74 | 74 |
75 // Count of downloads that supplies a strong ETag and has a 'Accept-Ranges: | 75 // (Deprecated) Count of downloads with a strong ETag and specified |
76 // bytes' header. These downloads are candidates for partial resumption. | 76 // 'Accept-Ranges: bytes'. |
77 STRONG_ETAG_AND_ACCEPTS_RANGES, | 77 DOWNLOAD_COUNT_UNUSED_15, |
78 | 78 |
79 // Count of downloads that didn't have a valid WebContents at the time it was | 79 // Count of downloads that didn't have a valid WebContents at the time it was |
80 // interrupted. | 80 // interrupted. |
81 INTERRUPTED_WITHOUT_WEBCONTENTS, | 81 INTERRUPTED_WITHOUT_WEBCONTENTS, |
82 | 82 |
| 83 // Count of downloads that supplies a strong validator (implying byte-wise |
| 84 // equivalence) and has a 'Accept-Ranges: bytes' header. These downloads are |
| 85 // candidates for partial resumption. |
| 86 STRONG_VALIDATOR_AND_ACCEPTS_RANGES, |
| 87 |
83 DOWNLOAD_COUNT_TYPES_LAST_ENTRY | 88 DOWNLOAD_COUNT_TYPES_LAST_ENTRY |
84 }; | 89 }; |
85 | 90 |
86 enum DownloadSource { | 91 enum DownloadSource { |
87 // The download was initiated when the SavePackage system rejected | 92 // The download was initiated when the SavePackage system rejected |
88 // a Save Page As ... by returning false from | 93 // a Save Page As ... by returning false from |
89 // SavePackage::IsSaveableContents(). | 94 // SavePackage::IsSaveableContents(). |
90 INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML = 0, | 95 INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML = 0, |
91 | 96 |
92 // The download was initiated by a drag and drop from a drag-and-drop | 97 // The download was initiated by a drag and drop from a drag-and-drop |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 163 |
159 // Record the bandwidth seen in DownloadResourceHandler | 164 // Record the bandwidth seen in DownloadResourceHandler |
160 // |actual_bandwidth| and |potential_bandwidth| are in bytes/second. | 165 // |actual_bandwidth| and |potential_bandwidth| are in bytes/second. |
161 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth); | 166 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth); |
162 | 167 |
163 // Record the time of both the first open and all subsequent opens since the | 168 // Record the time of both the first open and all subsequent opens since the |
164 // download completed. | 169 // download completed. |
165 void RecordOpen(const base::Time& end, bool first); | 170 void RecordOpen(const base::Time& end, bool first); |
166 | 171 |
167 // Record whether or not the server accepts ranges, and the download size. Also | 172 // Record whether or not the server accepts ranges, and the download size. Also |
168 // counts if a strong ETag is supplied. The combination of range request support | 173 // counts if a strong validator is supplied. The combination of range request |
169 // and ETag indicates downloads that are candidates for partial resumption. | 174 // support and ETag indicates downloads that are candidates for partial |
170 void RecordAcceptsRanges(const std::string& accepts_ranges, int64 download_len, | 175 // resumption. |
171 const std::string& etag); | 176 void RecordAcceptsRanges(const std::string& accepts_ranges, |
| 177 int64 download_len, |
| 178 bool has_strong_validator); |
172 | 179 |
173 // Record the number of downloads removed by ClearAll. | 180 // Record the number of downloads removed by ClearAll. |
174 void RecordClearAllSize(int size); | 181 void RecordClearAllSize(int size); |
175 | 182 |
176 // Record the number of completed unopened downloads when a download is opened. | 183 // Record the number of completed unopened downloads when a download is opened. |
177 void RecordOpensOutstanding(int size); | 184 void RecordOpensOutstanding(int size); |
178 | 185 |
179 // Record how long we block the file thread at a time. | 186 // Record how long we block the file thread at a time. |
180 void RecordContiguousWriteTime(base::TimeDelta time_blocked); | 187 void RecordContiguousWriteTime(base::TimeDelta time_blocked); |
181 | 188 |
(...skipping 25 matching lines...) Expand all Loading... |
207 SAVE_PACKAGE_WRITE_TO_FAILED, | 214 SAVE_PACKAGE_WRITE_TO_FAILED, |
208 | 215 |
209 SAVE_PACKAGE_LAST_ENTRY | 216 SAVE_PACKAGE_LAST_ENTRY |
210 }; | 217 }; |
211 | 218 |
212 void RecordSavePackageEvent(SavePackageEvent event); | 219 void RecordSavePackageEvent(SavePackageEvent event); |
213 | 220 |
214 } // namespace content | 221 } // namespace content |
215 | 222 |
216 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 223 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
OLD | NEW |