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

Unified Diff: components/ntp_tiles/most_visited_sites.cc

Issue 2136503002: NTP: Fix metrics recording race condition (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@android_uma
Patch Set: rebase Created 4 years, 5 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 | « components/ntp_tiles/most_visited_sites.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/ntp_tiles/most_visited_sites.cc
diff --git a/components/ntp_tiles/most_visited_sites.cc b/components/ntp_tiles/most_visited_sites.cc
index 8b758c24b823a0959180f77e967a8931cf5566cc..55c2edc6b9609baf7ec030ef0ee5bacd1e5a6279 100644
--- a/components/ntp_tiles/most_visited_sites.cc
+++ b/components/ntp_tiles/most_visited_sites.cc
@@ -247,23 +247,17 @@ void MostVisitedSites::RecordTileTypeMetrics(
counts_per_type[ICON_DEFAULT]);
}
-void MostVisitedSites::RecordOpenedMostVisitedItem(int index, int tile_type) {
- // TODO(treib): |current_suggestions_| could be updated before this function
- // is called, leading to DCHECKs and/or memory corruption. Adjust this
- // function to work with asynchronous UI.
- DCHECK_GE(index, 0);
- DCHECK_LT(index, static_cast<int>(current_suggestions_.size()));
-
+void MostVisitedSites::RecordOpenedMostVisitedItem(int index,
+ int tile_type,
+ int source) {
UMA_HISTOGRAM_ENUMERATION("NewTabPage.MostVisited", index, num_sites_);
std::string histogram = base::StringPrintf(
- "NewTabPage.MostVisited.%s",
- GetSourceHistogramName(current_suggestions_[index].source).c_str());
+ "NewTabPage.MostVisited.%s", GetSourceHistogramName(source).c_str());
LogHistogramEvent(histogram, index, num_sites_);
- histogram = base::StringPrintf(
- "NewTabPage.TileTypeClicked.%s",
- GetSourceHistogramName(current_suggestions_[index].source).c_str());
+ histogram = base::StringPrintf("NewTabPage.TileTypeClicked.%s",
+ GetSourceHistogramName(source).c_str());
LogHistogramEvent(histogram, tile_type, NUM_TILE_TYPES);
}
« no previous file with comments | « components/ntp_tiles/most_visited_sites.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698