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

Unified Diff: components/ntp_tiles/most_visited_sites.cc

Issue 2577253003: ntp_tiles: Avoid redundant calls to TopSites (Closed)
Patch Set: Created 4 years 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/ntp_tiles/most_visited_sites_unittest.cc » ('j') | 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 47918739aca14ab147eb3cd8b53317b70c7b1cef..f1d8d7b11bf01b483b8277a61762ac1ff5789fd5 100644
--- a/components/ntp_tiles/most_visited_sites.cc
+++ b/components/ntp_tiles/most_visited_sites.cc
@@ -169,6 +169,8 @@ void MostVisitedSites::BuildCurrentTiles() {
void MostVisitedSites::InitiateTopSitesQuery() {
if (!top_sites_)
return;
+ if (weak_ptr_factory_.HasWeakPtrs())
sfiera 2016/12/16 16:15:03 This seems brittle—it assumes we won't ever use we
mastiz 2017/01/05 11:50:45 You have a point, but adding yet another state var
+ return; // Ongoing query.
top_sites_->GetMostVisitedURLs(
base::Bind(&MostVisitedSites::OnMostVisitedURLsAvailable,
weak_ptr_factory_.GetWeakPtr()),
« no previous file with comments | « no previous file | components/ntp_tiles/most_visited_sites_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698