| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 9 #pragma once |
| 10 | 10 |
| 11 #include <string> | 11 #include <string> |
| 12 | 12 |
| 13 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 14 #include "content/common/content_export.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class TimeTicks; | 17 class TimeTicks; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace download_stats { | 20 namespace download_stats { |
| 20 | 21 |
| 21 // We keep a count of how often various events occur in the | 22 // We keep a count of how often various events occur in the |
| 22 // histogram "Download.Counts". | 23 // histogram "Download.Counts". |
| 23 enum DownloadCountTypes { | 24 enum DownloadCountTypes { |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // Write sizes for downloads. | 61 // Write sizes for downloads. |
| 61 WRITE_SIZE_COUNT, | 62 WRITE_SIZE_COUNT, |
| 62 | 63 |
| 63 // Counts iterations of the BaseFile::AppendDataToFile() loop. | 64 // Counts iterations of the BaseFile::AppendDataToFile() loop. |
| 64 WRITE_LOOP_COUNT, | 65 WRITE_LOOP_COUNT, |
| 65 | 66 |
| 66 DOWNLOAD_COUNT_TYPES_LAST_ENTRY | 67 DOWNLOAD_COUNT_TYPES_LAST_ENTRY |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 // Increment one of the above counts. | 70 // Increment one of the above counts. |
| 70 void RecordDownloadCount(DownloadCountTypes type); | 71 CONTENT_EXPORT void RecordDownloadCount(DownloadCountTypes type); |
| 71 | 72 |
| 72 // Record COMPLETED_COUNT and how long the download took. | 73 // Record COMPLETED_COUNT and how long the download took. |
| 73 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len); | 74 void RecordDownloadCompleted(const base::TimeTicks& start, int64 download_len); |
| 74 | 75 |
| 75 // Record INTERRUPTED_COUNT, |error|, |received| and |total| bytes. | 76 // Record INTERRUPTED_COUNT, |error|, |received| and |total| bytes. |
| 76 void RecordDownloadInterrupted(int error, int64 received, int64 total); | 77 void RecordDownloadInterrupted(int error, int64 received, int64 total); |
| 77 | 78 |
| 78 // Records the mime type of the download. | 79 // Records the mime type of the download. |
| 79 void RecordDownloadMimeType(const std::string& mime_type); | 80 void RecordDownloadMimeType(const std::string& mime_type); |
| 80 | 81 |
| 81 // Record WRITE_SIZE_COUNT and data_len. | 82 // Record WRITE_SIZE_COUNT and data_len. |
| 82 void RecordDownloadWriteSize(size_t data_len); | 83 void RecordDownloadWriteSize(size_t data_len); |
| 83 | 84 |
| 84 // Record WRITE_LOOP_COUNT and number of loops. | 85 // Record WRITE_LOOP_COUNT and number of loops. |
| 85 void RecordDownloadWriteLoopCount(int count); | 86 void RecordDownloadWriteLoopCount(int count); |
| 86 | 87 |
| 87 } // namespace download_stats | 88 } // namespace download_stats |
| 88 | 89 |
| 89 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ | 90 #endif // CONTENT_BROWSER_DOWNLOAD_DOWNLOAD_STATS_H_ |
| OLD | NEW |