Chromium Code Reviews| Index: content/child/notifications/notification_image_loader.cc |
| diff --git a/content/child/notifications/notification_image_loader.cc b/content/child/notifications/notification_image_loader.cc |
| index 08a108a33b30e207c29f5fad895a77f53791bd88..0cdd71606ab59847d789ae7f1e84642b48a2921a 100644 |
| --- a/content/child/notifications/notification_image_loader.cc |
| +++ b/content/child/notifications/notification_image_loader.cc |
| @@ -7,6 +7,7 @@ |
| #include "base/bind.h" |
| #include "base/location.h" |
| #include "base/logging.h" |
| +#include "base/metrics/histogram_macros.h" |
| #include "base/single_thread_task_runner.h" |
| #include "content/child/image_decoder.h" |
| #include "third_party/WebKit/public/platform/Platform.h" |
| @@ -39,6 +40,8 @@ void NotificationImageLoader::StartOnMainThread(const GURL& image_url) { |
| DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| DCHECK(!url_loader_); |
| + start_time_ = base::TimeTicks::Now(); |
| + |
| WebURL image_web_url(image_url); |
| WebURLRequest request(image_web_url); |
| request.setRequestContext(WebURLRequest::RequestContextImage); |
| @@ -63,6 +66,9 @@ void NotificationImageLoader::didFinishLoading( |
| int64_t total_encoded_data_length) { |
| DCHECK(!completed_); |
| + UMA_HISTOGRAM_LONG_TIMES("Notifications.Icon.LoadFinishTime", |
| + base::TimeTicks::Now() - start_time_); |
| + |
| RunCallbackOnWorkerThread(); |
| } |
| @@ -71,6 +77,9 @@ void NotificationImageLoader::didFail(WebURLLoader* loader, |
| if (completed_) |
| return; |
| + UMA_HISTOGRAM_LONG_TIMES("Notifications.Icon.LoadFailTime", |
| + base::TimeTicks::Now() - start_time_); |
| + |
| RunCallbackOnWorkerThread(); |
| } |
| @@ -89,6 +98,10 @@ void NotificationImageLoader::RunCallbackOnWorkerThread() { |
| SkBitmap NotificationImageLoader::GetDecodedImage() const { |
| DCHECK(completed_); |
| + |
| + UMA_HISTOGRAM_CUSTOM_COUNTS("Notifications.Icon.Size", buffer_.size(), 1, |
| + 10000000 /* ~10mb */, 50); |
|
Peter Beverloo
2016/02/19 17:13:44
Perhaps this would be better named "FileSize" to d
Ilya Sherman
2016/02/19 17:16:58
Note that histogram buckets are exponentially size
Michael van Ouwerkerk
2016/02/22 17:24:32
Done.
Michael van Ouwerkerk
2016/02/22 17:24:32
Renamed to "FileSize".
|
| + |
| if (buffer_.empty()) |
| return SkBitmap(); |