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

Side by Side Diff: chrome/browser/prerender/prerender_manager.cc

Issue 7812036: Update base/timer.h code to pass through Location from call sites. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build, consistency 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prerender/prerender_manager.h" 5 #include "chrome/browser/prerender/prerender_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 public: 173 public:
174 explicit MostVisitedSites(Profile* profile) : 174 explicit MostVisitedSites(Profile* profile) :
175 profile_(profile) { 175 profile_(profile) {
176 // If TopSites is already loaded, we will want to use it right away. 176 // If TopSites is already loaded, we will want to use it right away.
177 // Otherwise, wait for three seconds to avoid race conditions. 177 // Otherwise, wait for three seconds to avoid race conditions.
178 // This is a hack to ensure unit tests don't fail. 178 // This is a hack to ensure unit tests don't fail.
179 // See http://crbug.com/94654 179 // See http://crbug.com/94654
180 if (profile && profile->GetTopSitesWithoutCreating()) { 180 if (profile && profile->GetTopSitesWithoutCreating()) {
181 Init(); 181 Init();
182 } else { 182 } else {
183 timer_.Start(base::TimeDelta::FromSeconds(3), this, 183 timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(3), this,
184 &prerender::PrerenderManager::MostVisitedSites::Init); 184 &prerender::PrerenderManager::MostVisitedSites::Init);
185 } 185 }
186 } 186 }
187 187
188 void Init() { 188 void Init() {
189 history::TopSites* top_sites = GetTopSites(); 189 history::TopSites* top_sites = GetTopSites();
190 if (top_sites) { 190 if (top_sites) {
191 registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED, 191 registrar_.Add(this, chrome::NOTIFICATION_TOP_SITES_CHANGED,
192 Source<history::TopSites>(top_sites)); 192 Source<history::TopSites>(top_sites));
193 } 193 }
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 if (!config_.rate_limit_enabled) 790 if (!config_.rate_limit_enabled)
791 return true; 791 return true;
792 return elapsed_time > 792 return elapsed_time >
793 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs); 793 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs);
794 } 794 }
795 795
796 void PrerenderManager::StartSchedulingPeriodicCleanups() { 796 void PrerenderManager::StartSchedulingPeriodicCleanups() {
797 DCHECK(CalledOnValidThread()); 797 DCHECK(CalledOnValidThread());
798 if (repeating_timer_.IsRunning()) 798 if (repeating_timer_.IsRunning())
799 return; 799 return;
800 repeating_timer_.Start( 800 repeating_timer_.Start(FROM_HERE,
801 base::TimeDelta::FromMilliseconds(kPeriodicCleanupIntervalMs), 801 base::TimeDelta::FromMilliseconds(kPeriodicCleanupIntervalMs),
802 this, 802 this,
803 &PrerenderManager::PeriodicCleanup); 803 &PrerenderManager::PeriodicCleanup);
804 } 804 }
805 805
806 void PrerenderManager::MaybeStopSchedulingPeriodicCleanups() { 806 void PrerenderManager::MaybeStopSchedulingPeriodicCleanups() {
807 if (!prerender_list_.empty()) 807 if (!prerender_list_.empty())
808 return; 808 return;
809 809
810 DCHECK(CalledOnValidThread()); 810 DCHECK(CalledOnValidThread());
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 DeletePendingDeleteEntries(); 1028 DeletePendingDeleteEntries();
1029 } 1029 }
1030 1030
1031 void PrerenderManager::RecordFinalStatus(Origin origin, 1031 void PrerenderManager::RecordFinalStatus(Origin origin,
1032 uint8 experiment_id, 1032 uint8 experiment_id,
1033 FinalStatus final_status) const { 1033 FinalStatus final_status) const {
1034 histograms_->RecordFinalStatus(origin, experiment_id, final_status); 1034 histograms_->RecordFinalStatus(origin, experiment_id, final_status);
1035 } 1035 }
1036 1036
1037 } // namespace prerender 1037 } // namespace prerender
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698