summaryrefslogtreecommitdiffstats
path: root/chrome/browser/prerender/prerender_manager.cc
diff options
context:
space:
mode:
authortburkard@chromium.org <tburkard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-06 15:40:10 +0000
committertburkard@chromium.org <tburkard@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-06 15:40:10 +0000
commite6a7869b1da2bc092f887ea0c3839f33d1638564 (patch)
tree1e652cd6bf4565a0a7196c8ce8769a1e20feab68 /chrome/browser/prerender/prerender_manager.cc
parent27dec6f808c4a93b100f266c31dd0946141b419b (diff)
downloadchromium_src-e6a7869b1da2bc092f887ea0c3839f33d1638564.zip
chromium_src-e6a7869b1da2bc092f887ea0c3839f33d1638564.tar.gz
chromium_src-e6a7869b1da2bc092f887ea0c3839f33d1638564.tar.bz2
B0;136;0cRe-enable TopSites in PrerenderManager, this time duplicating the invariant
observed in NTP (browser must have started). R=sky, cbentzel Review URL: http://codereview.chromium.org/7828023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@99741 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/prerender/prerender_manager.cc')
-rw-r--r--chrome/browser/prerender/prerender_manager.cc20
1 files changed, 4 insertions, 16 deletions
diff --git a/chrome/browser/prerender/prerender_manager.cc b/chrome/browser/prerender/prerender_manager.cc
index a1ab410..4e73530 100644
--- a/chrome/browser/prerender/prerender_manager.cc
+++ b/chrome/browser/prerender/prerender_manager.cc
@@ -173,19 +173,6 @@ class PrerenderManager::MostVisitedSites : public NotificationObserver {
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 @@ class PrerenderManager::MostVisitedSites : public NotificationObserver {
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,