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

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: Rebase. 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..4ad37f859941e4efe8232a278c06f28a5ff86f80 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.FileSize", buffer_.size(), 1,
+ 10000000 /* ~10mb */, 50);
+
if (buffer_.empty())
return SkBitmap();
« no previous file with comments | « content/child/notifications/notification_image_loader.h ('k') | content/child/notifications/pending_notification.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698