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

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

Issue 2710953002: Add metrics for quantity and type of Favicon candidates (Closed)
Patch Set: Adress comments Created 3 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: components/favicon/core/favicon_driver_impl.cc
diff --git a/components/favicon/core/favicon_driver_impl.cc b/components/favicon/core/favicon_driver_impl.cc
index c44b49eda2ddb859d214094821f117e997f08378..453c96b02e0efa5427f298518c969b93a8cb2f21 100644
--- a/components/favicon/core/favicon_driver_impl.cc
+++ b/components/favicon/core/favicon_driver_impl.cc
@@ -5,12 +5,14 @@
#include "components/favicon/core/favicon_driver_impl.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
#include "base/strings/string_util.h"
#include "build/build_config.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/favicon/core/favicon_driver_observer.h"
#include "components/favicon/core/favicon_handler.h"
#include "components/favicon/core/favicon_service.h"
+#include "components/favicon/core/favicon_url.h"
#include "components/history/core/browser/history_service.h"
namespace favicon {
@@ -22,6 +24,26 @@ const bool kEnableTouchIcon = true;
const bool kEnableTouchIcon = false;
#endif
+void RecordCandidateMetrics(const std::vector<FaviconURL>& candidates) {
+ size_t with_defined_touch_icons = 0;
+ size_t with_defined_sizes = 0;
+ for (const auto& candidate : candidates) {
+ if (!candidate.icon_sizes.empty()) {
+ with_defined_sizes++;
+ }
+ if (candidate.icon_type &
+ (favicon_base::IconType::TOUCH_ICON |
+ favicon_base::IconType::TOUCH_PRECOMPOSED_ICON)) {
+ with_defined_touch_icons++;
+ }
+ }
+ UMA_HISTOGRAM_COUNTS_100("Favicons.CandidatesCount", candidates.size());
+ UMA_HISTOGRAM_COUNTS_100("Favicons.CandidatesWithDefinedSizesCount",
+ with_defined_sizes);
+ UMA_HISTOGRAM_COUNTS_100("Favicons.CandidatesWithTouchIconsCount",
+ with_defined_touch_icons);
+}
+
} // namespace
FaviconDriverImpl::FaviconDriverImpl(FaviconService* favicon_service,
@@ -78,6 +100,7 @@ void FaviconDriverImpl::OnUpdateFaviconURL(
const GURL& page_url,
const std::vector<FaviconURL>& candidates) {
DCHECK(!candidates.empty());
+ RecordCandidateMetrics(candidates);
favicon_handler_->OnUpdateFaviconURL(page_url, candidates);
if (touch_icon_handler_.get())
touch_icon_handler_->OnUpdateFaviconURL(page_url, candidates);
« no previous file with comments | « components/favicon/content/content_favicon_driver_unittest.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698