Chromium Code Reviews| Index: chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc |
| diff --git a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc |
| index 95d86ed2b587601324347e38b26d35404e244337..aa6d2c9930e0a3d4188fd0fd2a18fefe22a3932b 100644 |
| --- a/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc |
| +++ b/chrome/browser/ui/webui/ntp/ntp_user_data_logger.cc |
| @@ -15,13 +15,24 @@ NTPUserDataLogger::~NTPUserDataLogger() {} |
| void NTPUserDataLogger::EmitThumbnailErrorRate() { |
| DCHECK_LE(number_of_thumbnail_errors_, number_of_thumbnail_attempts_); |
| + DCHECK_LE(number_of_fallback_thumbnails_used_, |
| + number_of_fallback_thumbnails_requested_); |
|
Alexei Svitkine (slow)
2013/09/05 14:59:25
Nit: Move this above the if block that logs it.
beaudoin
2013/09/05 15:02:55
Done.
|
| if (number_of_thumbnail_attempts_ != 0) { |
| - UMA_HISTOGRAM_PERCENTAGE("NewTabPage.ThumbnailErrorRate", |
| - GetPercentError(number_of_thumbnail_errors_, |
| - number_of_thumbnail_attempts_)); |
| + UMA_HISTOGRAM_PERCENTAGE( |
| + "NewTabPage.ThumbnailErrorRate", |
| + GetPercentError(number_of_thumbnail_errors_, |
| + number_of_thumbnail_attempts_)); |
| + } |
| + if (number_of_fallback_thumbnails_requested_ != 0) { |
| + UMA_HISTOGRAM_PERCENTAGE( |
| + "NewTabPage.ThumbnailFallbackRate", |
| + GetPercentError(number_of_fallback_thumbnails_used_, |
| + number_of_fallback_thumbnails_requested_)); |
| } |
| number_of_thumbnail_attempts_ = 0; |
| number_of_thumbnail_errors_ = 0; |
| + number_of_fallback_thumbnails_requested_ = 0; |
| + number_of_fallback_thumbnails_used_ = 0; |
| } |
| void NTPUserDataLogger::EmitMouseoverCount() { |
| @@ -40,6 +51,12 @@ void NTPUserDataLogger::LogEvent(NTPLoggingEventType event) { |
| case NTP_THUMBNAIL_ERROR: |
| number_of_thumbnail_errors_++; |
| break; |
| + case NTP_FALLBACK_THUMBNAIL_REQUESTED: |
| + number_of_fallback_thumbnails_requested_++; |
| + break; |
| + case NTP_FALLBACK_THUMBNAIL_USED: |
| + number_of_fallback_thumbnails_used_++; |
| + break; |
| default: |
| NOTREACHED(); |
| } |
| @@ -64,7 +81,9 @@ NTPUserDataLogger::NTPUserDataLogger(content::WebContents* contents) |
| : content::WebContentsObserver(contents), |
| number_of_mouseovers_(0), |
| number_of_thumbnail_attempts_(0), |
| - number_of_thumbnail_errors_(0) { |
| + number_of_thumbnail_errors_(0), |
| + number_of_fallback_thumbnails_requested_(0), |
| + number_of_fallback_thumbnails_used_(0) { |
| } |
| size_t NTPUserDataLogger::GetPercentError(size_t errors, size_t events) const { |