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

Unified Diff: chrome/browser/history/top_sites_impl.h

Issue 1005873011: Only record the execution time during startup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move the static to TopSitesImpl Created 5 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 | chrome/browser/history/top_sites_impl.cc » ('j') | chrome/browser/history/top_sites_impl.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/history/top_sites_impl.h
diff --git a/chrome/browser/history/top_sites_impl.h b/chrome/browser/history/top_sites_impl.h
index 91518ec742b6ed79931882101310133b1e8b61cd..cef762a65ff872187466bed1fba1b55506d659c6 100644
--- a/chrome/browser/history/top_sites_impl.h
+++ b/chrome/browser/history/top_sites_impl.h
@@ -98,6 +98,20 @@ class TopSitesImpl : public TopSites,
~TopSitesImpl() override;
private:
+ // TODO(yiyaoliu): Remove the enums and related code when crbug/223430 is
+ // fixed.
+ // An enum representing different situations under which function
+ // SetTopSites can be initiated.
+ // This is needed because a histogram is used to record speed related metrics
+ // when SetTopSites are initiated from OnGotMostVisitedThumbnails, which
+ // usually happens early and might affect Chrome startup speed.
+ enum CallLocation {
+ // SetTopSites is called from function OnGotMostVisitedThumbnails.
+ CALL_LOCATION_FROM_ON_GOT_MOST_VISITED_THUMBNAILS,
+ // All other situations.
+ CALL_LOCATION_FROM_OTHER_PLACES
+ };
+
friend class TopSitesImplTest;
FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisited);
FRIEND_TEST_ALL_PREFIXES(TopSitesImplTest, DiffMostVisitedWithForced);
@@ -195,7 +209,8 @@ class TopSitesImpl : public TopSites,
// if the list of forced URLs overflows, the oldest ones are dropped.
// All mutations to cache_ *must* go through this. Should
// be called from the UI thread.
- void SetTopSites(const MostVisitedURLList& new_top_sites);
+ void SetTopSites(const MostVisitedURLList& new_top_sites,
+ const CallLocation location);
// Returns the number of most visited results to request from history. This
// changes depending upon how many urls have been blacklisted. Should be
@@ -276,6 +291,10 @@ class TopSitesImpl : public TopSites,
// Are we loaded?
bool loaded_;
+ // Have the SetTopSites execution time related histograms been recorded?
+ // The histogram should only be recorded once for each Chrome execution.
+ static bool histogram_recorded_;
+
ScopedObserver<HistoryService, HistoryServiceObserver>
history_service_observer_;
« no previous file with comments | « no previous file | chrome/browser/history/top_sites_impl.cc » ('j') | chrome/browser/history/top_sites_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698