| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 // This can happen when saving web pages as complete packages. It happens | 61 // This can happen when saving web pages as complete packages. It happens |
| 62 // when we get messages to append data to files that have already finished and | 62 // when we get messages to append data to files that have already finished and |
| 63 // been detached, but haven't yet been removed from the list of files in | 63 // been detached, but haven't yet been removed from the list of files in |
| 64 // progress. | 64 // progress. |
| 65 APPEND_TO_DETACHED_FILE_COUNT, | 65 APPEND_TO_DETACHED_FILE_COUNT, |
| 66 | 66 |
| 67 // Counts the number of instances where the downloaded file is missing after a | 67 // Counts the number of instances where the downloaded file is missing after a |
| 68 // successful invocation of ScanAndSaveDownloadedFile(). | 68 // successful invocation of ScanAndSaveDownloadedFile(). |
| 69 FILE_MISSING_AFTER_SUCCESSFUL_SCAN_COUNT, | 69 FILE_MISSING_AFTER_SUCCESSFUL_SCAN_COUNT, |
| 70 | 70 |
| 71 // Count of downloads that supplies a strong ETag and has a 'Accept-Ranges: |
| 72 // bytes' header. These downloads are candidates for partial resumption. |
| 73 STRONG_ETAG_AND_ACCEPTS_RANGES, |
| 74 |
| 75 // Count of downloads that didn't have a valid WebContents at the time it was |
| 76 // interrupted. |
| 77 INTERRUPTED_WITHOUT_WEBCONTENTS, |
| 78 |
| 71 DOWNLOAD_COUNT_TYPES_LAST_ENTRY | 79 DOWNLOAD_COUNT_TYPES_LAST_ENTRY |
| 72 }; | 80 }; |
| 73 | 81 |
| 74 enum DownloadSource { | 82 enum DownloadSource { |
| 75 // The download was initiated when the SavePackage system rejected | 83 // The download was initiated when the SavePackage system rejected |
| 76 // a Save Page As ... by returning false from | 84 // a Save Page As ... by returning false from |
| 77 // SavePackage::IsSaveableContents(). | 85 // SavePackage::IsSaveableContents(). |
| 78 INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML = 0, | 86 INITIATED_BY_SAVE_PACKAGE_ON_NON_HTML = 0, |
| 79 | 87 |
| 80 // The download was initiated by a drag and drop from a drag-and-drop | 88 // The download was initiated by a drag and drop from a drag-and-drop |
| 81 // enabled web application. | 89 // enabled web application. |
| 82 INITIATED_BY_DRAG_N_DROP, | 90 INITIATED_BY_DRAG_N_DROP, |
| 83 | 91 |
| 84 // The download was initiated by explicit RPC from the renderer process | 92 // The download was initiated by explicit RPC from the renderer process |
| 85 // (e.g. by Alt-click) through the IPC ViewHostMsg_DownloadUrl. | 93 // (e.g. by Alt-click) through the IPC ViewHostMsg_DownloadUrl. |
| 86 INITIATED_BY_RENDERER, | 94 INITIATED_BY_RENDERER, |
| 87 | 95 |
| 96 // Fomerly INITIATED_BY_PEPPER_SAVE. |
| 97 DOWNLOAD_SOURCE_UNUSED_3, |
| 98 |
| 99 // A request that was initiated as a result of resuming an interrupted |
| 100 // download. |
| 101 INITIATED_BY_RESUMPTION, |
| 102 |
| 88 DOWNLOAD_SOURCE_LAST_ENTRY | 103 DOWNLOAD_SOURCE_LAST_ENTRY |
| 89 }; | 104 }; |
| 90 | 105 |
| 91 enum DownloadDiscardReason { | 106 enum DownloadDiscardReason { |
| 92 // The download is being discarded due to a user action. | 107 // The download is being discarded due to a user action. |
| 93 DOWNLOAD_DISCARD_DUE_TO_USER_ACTION, | 108 DOWNLOAD_DISCARD_DUE_TO_USER_ACTION, |
| 94 | 109 |
| 95 // The download is being discarded due to the browser being shut down. | 110 // The download is being discarded due to the browser being shut down. |
| 96 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN | 111 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN |
| 97 }; | 112 }; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 void RecordFileThreadReceiveBuffers(size_t num_buffers); | 149 void RecordFileThreadReceiveBuffers(size_t num_buffers); |
| 135 | 150 |
| 136 // Record the bandwidth seen in DownloadResourceHandler | 151 // Record the bandwidth seen in DownloadResourceHandler |
| 137 // |actual_bandwidth| and |potential_bandwidth| are in bytes/second. | 152 // |actual_bandwidth| and |potential_bandwidth| are in bytes/second. |
| 138 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth); | 153 void RecordBandwidth(double actual_bandwidth, double potential_bandwidth); |
| 139 | 154 |
| 140 // Record the time of both the first open and all subsequent opens since the | 155 // Record the time of both the first open and all subsequent opens since the |
| 141 // download completed. | 156 // download completed. |
| 142 void RecordOpen(const base::Time& end, bool first); | 157 void RecordOpen(const base::Time& end, bool first); |
| 143 | 158 |
| 144 // Record whether or not the server accepts ranges, and the download size. | 159 // Record whether or not the server accepts ranges, and the download size. Also |
| 145 void RecordAcceptsRanges(const std::string& accepts_ranges, int64 download_len); | 160 // counts if a strong ETag is supplied. The combination of range request support |
| 161 // and ETag indicates downloads that are candidates for partial resumption. |
| 162 void RecordAcceptsRanges(const std::string& accepts_ranges, int64 download_len, |
| 163 const std::string& etag); |
| 146 | 164 |
| 147 // Record the number of downloads removed by ClearAll. | 165 // Record the number of downloads removed by ClearAll. |
| 148 void RecordClearAllSize(int size); | 166 void RecordClearAllSize(int size); |
| 149 | 167 |
| 150 // Record the number of completed unopened downloads when a download is opened. | 168 // Record the number of completed unopened downloads when a download is opened. |
| 151 void RecordOpensOutstanding(int size); | 169 void RecordOpensOutstanding(int size); |
| 152 | 170 |
| 153 // Record how long we block the file thread at a time. | 171 // Record how long we block the file thread at a time. |
| 154 void RecordContiguousWriteTime(base::TimeDelta time_blocked); | 172 void RecordContiguousWriteTime(base::TimeDelta time_blocked); |
| 155 | 173 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 181 SAVE_PACKAGE_WRITE_TO_FAILED, | 199 SAVE_PACKAGE_WRITE_TO_FAILED, |
| 182 | 200 |
| 183 SAVE_PACKAGE_LAST_ENTRY | 201 SAVE_PACKAGE_LAST_ENTRY |
| 184 }; | 202 }; |
| 185 | 203 |
| 186 void RecordSavePackageEvent(SavePackageEvent event); | 204 void RecordSavePackageEvent(SavePackageEvent event); |
| 187 | 205 |
| 188 } // namespace content | 206 } // namespace content |
| 189 | 207 |
| 190 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 208 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |