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

Unified Diff: chrome/browser/prerender/prerender_manager.cc

Issue 7828023: Re-enable TopSites in PrerenderManager, this time duplicating the invariant (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 | « chrome/browser/prerender/prerender_manager.h ('k') | chrome/browser/prerender/prerender_tab_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prerender/prerender_manager.cc
===================================================================
--- chrome/browser/prerender/prerender_manager.cc (revision 99740)
+++ chrome/browser/prerender/prerender_manager.cc (working copy)
@@ -173,19 +173,6 @@
public:
explicit MostVisitedSites(Profile* profile) :
profile_(profile) {
- // If TopSites is already loaded, we will want to use it right away.
- // Otherwise, wait for three seconds to avoid race conditions.
- // This is a hack to ensure unit tests don't fail.
- // See http://crbug.com/94654
- if (profile && profile->GetTopSitesWithoutCreating()) {
- Init();
- } else {
- timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(3), this,
- &prerender::PrerenderManager::MostVisitedSites::Init);
- }
- }
-
- void Init() {
history::TopSites* top_sites = GetTopSites();
if (top_sites) {
registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED,
@@ -234,11 +221,12 @@
Profile* profile_;
NotificationRegistrar registrar_;
std::set<GURL> urls_;
- base::OneShotTimer<prerender::PrerenderManager::MostVisitedSites> timer_;
};
-bool PrerenderManager::IsTopSite(const GURL& url) const {
- return most_visited_.get() && most_visited_->IsTopSite(url);
+bool PrerenderManager::IsTopSite(const GURL& url) {
+ if (!most_visited_.get())
+ most_visited_.reset(new MostVisitedSites(profile_));
+ return most_visited_->IsTopSite(url);
}
PrerenderManager::PrerenderManager(Profile* profile,
« no previous file with comments | « chrome/browser/prerender/prerender_manager.h ('k') | chrome/browser/prerender/prerender_tab_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698