Chromium Code Reviews| Index: components/history/core/browser/top_sites_backend.h |
| diff --git a/components/history/core/browser/top_sites_backend.h b/components/history/core/browser/top_sites_backend.h |
| index d3c054b81032026a27077b0837323c028fba7eaf..b10a73e9ff2bcf5d9bcd285cb38002ea09d11e46 100644 |
| --- a/components/history/core/browser/top_sites_backend.h |
| +++ b/components/history/core/browser/top_sites_backend.h |
| @@ -26,6 +26,22 @@ class TopSitesDatabase; |
| // thread. |
| class TopSitesBackend : public base::RefCountedThreadSafe<TopSitesBackend> { |
| public: |
| + // An enum representing different situations under which function |
| + // TopSitesImpl::SetTopSites and TopSitesBackend::UpdateTopSites can be |
| + // initiated. |
| + // This is needed because a histogram is used to record speed related metrics |
| + // when TopSitesImpl::SetTopSites and TopSitesBackend::UpdateTopSites are |
| + // initiated from TopSitesImpl::OnGotMostVisitedThumbnails, which usually |
| + // happens early and might affect Chrome startup speed. |
| + // TODO(yiyaoliu): Remove this when crbug/223430 is fixed. |
| + enum TopSitesCalledLocation { |
|
sky
2015/04/01 22:51:48
This is in the topsites files, so prefixing with t
yao
2015/04/02 17:20:31
Done.
|
| + // SetTopSites is called when MostVisitedThumbnails is available (function |
| + // TopSitesImpl::OnGotMostVisitedThumbnails). |
| + fromOnGotMostVisitedThumbnails, |
|
sky
2015/04/01 22:51:48
Style guide says enums are ALL_CAPS. And generally
yao
2015/04/02 17:20:31
Done.
|
| + // All other situations. |
| + fomOtherPlaces |
| + }; |
| + |
| // The boolean parameter indicates if the DB existed on disk or needs to be |
| // migrated. |
| typedef base::Callback<void(const scoped_refptr<MostVisitedThumbnails>&)> |
| @@ -45,7 +61,9 @@ class TopSitesBackend : public base::RefCountedThreadSafe<TopSitesBackend> { |
| base::CancelableTaskTracker* tracker); |
| // Updates top sites database from the specified delta. |
| - void UpdateTopSites(const TopSitesDelta& delta); |
| + // TODO(yiyaoliu): Remove the 2nd parameter when crbug/223430 is fixed. |
| + void UpdateTopSites(const TopSitesDelta& delta, |
| + const TopSitesCalledLocation location); |
| // Sets the thumbnail. |
| void SetPageThumbnail(const MostVisitedURL& url, |
| @@ -77,7 +95,9 @@ class TopSitesBackend : public base::RefCountedThreadSafe<TopSitesBackend> { |
| scoped_refptr<MostVisitedThumbnails> thumbnails); |
| // Updates top sites. |
| - void UpdateTopSitesOnDBThread(const TopSitesDelta& delta); |
| + // TODO(yiyaoliu): Remove the 2nd parameter when crbug/223430 is fixed. |
| + void UpdateTopSitesOnDBThread(const TopSitesDelta& delta, |
| + const TopSitesCalledLocation location); |
| // Sets the thumbnail. |
| void SetPageThumbnailOnDBThread(const MostVisitedURL& url, |