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

Unified Diff: components/favicon/core/large_icon_service.cc

Issue 2804283003: [LargeIconService] Report size of the downloaded favicon to UMA (Closed)
Patch Set: Fix the unit-tests #2 Created 3 years, 8 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
« no previous file with comments | « no previous file | components/favicon/core/large_icon_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/favicon/core/large_icon_service.cc
diff --git a/components/favicon/core/large_icon_service.cc b/components/favicon/core/large_icon_service.cc
index 5817bfcfd582732158a922313c18e07c2f659297..c202c244ff784f4bb1634ee2b80da8a9e69e19b7 100644
--- a/components/favicon/core/large_icon_service.cc
+++ b/components/favicon/core/large_icon_service.cc
@@ -12,6 +12,7 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/stringprintf.h"
#include "base/task_runner.h"
#include "base/threading/sequenced_worker_pool.h"
@@ -217,6 +218,10 @@ void LargeIconWorker::OnIconProcessingComplete() {
favicon_base::LargeIconImageResult(fallback_icon_style_.release()));
}
+void ReportDownloadedSize(int size) {
+ UMA_HISTOGRAM_COUNTS_1000("Favicons.LargeIconService.DownloadedSize", size);
+}
+
void OnFetchIconFromGoogleServerComplete(
FaviconService* favicon_service,
const GURL& page_url,
@@ -229,9 +234,12 @@ void OnFetchIconFromGoogleServerComplete(
favicon_service->UnableToDownloadFavicon(GURL(server_request_url));
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
base::Bind(callback, false));
+ ReportDownloadedSize(0);
return;
}
+ ReportDownloadedSize(image.Width());
+
// If given, use the original favicon URL from Content-Location http header.
// Otherwise, use the request URL as fallback.
std::string original_icon_url = metadata.content_location_header;
« no previous file with comments | « no previous file | components/favicon/core/large_icon_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698