Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1137)

Unified Diff: content/child/notifications/notification_image_loader.cc

Issue 1715763002: Add histograms for notification icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@NotificationIconScaling
Patch Set: Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();

Powered by Google App Engine
This is Rietveld 408576698