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> |
| 11 #include <stdint.h> |
| 12 |
10 #include <string> | 13 #include <string> |
11 | 14 |
12 #include "base/basictypes.h" | |
13 #include "content/common/content_export.h" | 15 #include "content/common/content_export.h" |
14 #include "content/public/browser/download_danger_type.h" | 16 #include "content/public/browser/download_danger_type.h" |
15 #include "content/public/browser/download_interrupt_reasons.h" | 17 #include "content/public/browser/download_interrupt_reasons.h" |
16 | 18 |
17 namespace base { | 19 namespace base { |
18 class FilePath; | 20 class FilePath; |
19 class Time; | 21 class Time; |
20 class TimeDelta; | 22 class TimeDelta; |
21 class TimeTicks; | 23 class TimeTicks; |
22 } | 24 } |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN | 122 DOWNLOAD_DISCARD_DUE_TO_SHUTDOWN |
121 }; | 123 }; |
122 | 124 |
123 // Increment one of the above counts. | 125 // Increment one of the above counts. |
124 void RecordDownloadCount(DownloadCountTypes type); | 126 void RecordDownloadCount(DownloadCountTypes type); |
125 | 127 |
126 // Record initiation of a download from a specific source. | 128 // Record initiation of a download from a specific source. |
127 void RecordDownloadSource(DownloadSource source); | 129 void RecordDownloadSource(DownloadSource source); |
128 | 130 |
129 // Record COMPLETED_COUNT and how long the download took. | 131 // Record COMPLETED_COUNT and how long the download took. |
130 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len); | 132 void RecordDownloadCompleted(const base::TimeTicks& start, |
| 133 int64_t download_len); |
131 | 134 |
132 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. | 135 // Record INTERRUPTED_COUNT, |reason|, |received| and |total| bytes. |
133 void RecordDownloadInterrupted(DownloadInterruptReason reason, | 136 void RecordDownloadInterrupted(DownloadInterruptReason reason, |
134 int64 received, | 137 int64_t received, |
135 int64 total); | 138 int64_t total); |
136 | 139 |
137 // Record that a download has been classified as malicious. | 140 // Record that a download has been classified as malicious. |
138 void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); | 141 void RecordMaliciousDownloadClassified(DownloadDangerType danger_type); |
139 | 142 |
140 // Record a dangerous download accept event. | 143 // Record a dangerous download accept event. |
141 void RecordDangerousDownloadAccept( | 144 void RecordDangerousDownloadAccept( |
142 DownloadDangerType danger_type, | 145 DownloadDangerType danger_type, |
143 const base::FilePath& file_path); | 146 const base::FilePath& file_path); |
144 | 147 |
145 // Record a dangerous download discard event. | 148 // Record a dangerous download discard event. |
(...skipping 24 matching lines...) Expand all Loading... |
170 | 173 |
171 // Record the time of both the first open and all subsequent opens since the | 174 // Record the time of both the first open and all subsequent opens since the |
172 // download completed. | 175 // download completed. |
173 void RecordOpen(const base::Time& end, bool first); | 176 void RecordOpen(const base::Time& end, bool first); |
174 | 177 |
175 // Record whether or not the server accepts ranges, and the download size. Also | 178 // Record whether or not the server accepts ranges, and the download size. Also |
176 // counts if a strong validator is supplied. The combination of range request | 179 // counts if a strong validator is supplied. The combination of range request |
177 // support and ETag indicates downloads that are candidates for partial | 180 // support and ETag indicates downloads that are candidates for partial |
178 // resumption. | 181 // resumption. |
179 void RecordAcceptsRanges(const std::string& accepts_ranges, | 182 void RecordAcceptsRanges(const std::string& accepts_ranges, |
180 int64 download_len, | 183 int64_t download_len, |
181 bool has_strong_validator); | 184 bool has_strong_validator); |
182 | 185 |
183 // Record the number of downloads removed by ClearAll. | 186 // Record the number of downloads removed by ClearAll. |
184 void RecordClearAllSize(int size); | 187 void RecordClearAllSize(int size); |
185 | 188 |
186 // Record the number of completed unopened downloads when a download is opened. | 189 // Record the number of completed unopened downloads when a download is opened. |
187 void RecordOpensOutstanding(int size); | 190 void RecordOpensOutstanding(int size); |
188 | 191 |
189 // Record how long we block the file thread at a time. | 192 // Record how long we block the file thread at a time. |
190 void RecordContiguousWriteTime(base::TimeDelta time_blocked); | 193 void RecordContiguousWriteTime(base::TimeDelta time_blocked); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 238 |
236 // Record the state of the origin information across a download resumption | 239 // Record the state of the origin information across a download resumption |
237 // request. |state| is a combination of values from OriginStateOnResumption | 240 // request. |state| is a combination of values from OriginStateOnResumption |
238 // enum. | 241 // enum. |
239 void RecordOriginStateOnResumption(bool is_partial, | 242 void RecordOriginStateOnResumption(bool is_partial, |
240 int state); | 243 int state); |
241 | 244 |
242 } // namespace content | 245 } // namespace content |
243 | 246 |
244 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 247 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
OLD | NEW |