OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 PrerenderManager::PrerenderManager(Profile* profile, | 180 PrerenderManager::PrerenderManager(Profile* profile, |
181 PrerenderTracker* prerender_tracker) | 181 PrerenderTracker* prerender_tracker) |
182 : enabled_(true), | 182 : enabled_(true), |
183 profile_(profile), | 183 profile_(profile), |
184 prerender_tracker_(prerender_tracker), | 184 prerender_tracker_(prerender_tracker), |
185 prerender_contents_factory_(PrerenderContents::CreateFactory()), | 185 prerender_contents_factory_(PrerenderContents::CreateFactory()), |
186 last_prerender_start_time_(GetCurrentTimeTicks() - | 186 last_prerender_start_time_(GetCurrentTimeTicks() - |
187 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs)), | 187 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs)), |
188 weak_factory_(this), | 188 weak_factory_(this), |
189 prerender_history_(new PrerenderHistory(kHistoryLength)), | 189 prerender_history_(new PrerenderHistory(kHistoryLength)), |
190 histograms_(new PrerenderHistograms()), | 190 histograms_(new PrerenderHistograms()) { |
191 local_predictor_(new PrerenderLocalPredictor(this)) { | |
192 // There are some assumptions that the PrerenderManager is on the UI thread. | 191 // There are some assumptions that the PrerenderManager is on the UI thread. |
193 // Any other checks simply make sure that the PrerenderManager is accessed on | 192 // Any other checks simply make sure that the PrerenderManager is accessed on |
194 // the same thread that it was created on. | 193 // the same thread that it was created on. |
195 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
196 config_.max_concurrency = GetMaxConcurrency(); | 195 config_.max_concurrency = GetMaxConcurrency(); |
197 } | 196 } |
198 | 197 |
199 PrerenderManager::~PrerenderManager() { | 198 PrerenderManager::~PrerenderManager() { |
200 } | 199 } |
201 | 200 |
(...skipping 1031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1233 if (!render_process_host || !render_process_host->GetBrowserContext()) | 1232 if (!render_process_host || !render_process_host->GetBrowserContext()) |
1234 return NULL; | 1233 return NULL; |
1235 Profile* profile = Profile::FromBrowserContext( | 1234 Profile* profile = Profile::FromBrowserContext( |
1236 render_process_host->GetBrowserContext()); | 1235 render_process_host->GetBrowserContext()); |
1237 if (!profile) | 1236 if (!profile) |
1238 return NULL; | 1237 return NULL; |
1239 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); | 1238 return PrerenderManagerFactory::GetInstance()->GetForProfile(profile); |
1240 } | 1239 } |
1241 | 1240 |
1242 } // namespace prerender | 1241 } // namespace prerender |
OLD | NEW |