| 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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 prerender_contents_factory_(PrerenderContents::CreateFactory()), | 234 prerender_contents_factory_(PrerenderContents::CreateFactory()), |
| 235 last_prerender_start_time_(GetCurrentTimeTicks() - | 235 last_prerender_start_time_(GetCurrentTimeTicks() - |
| 236 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs)), | 236 base::TimeDelta::FromMilliseconds(kMinTimeBetweenPrerendersMs)), |
| 237 prerender_history_(new PrerenderHistory(kHistoryLength)), | 237 prerender_history_(new PrerenderHistory(kHistoryLength)), |
| 238 histograms_(new PrerenderHistograms()) { | 238 histograms_(new PrerenderHistograms()) { |
| 239 // There are some assumptions that the PrerenderManager is on the UI thread. | 239 // There are some assumptions that the PrerenderManager is on the UI thread. |
| 240 // Any other checks simply make sure that the PrerenderManager is accessed on | 240 // Any other checks simply make sure that the PrerenderManager is accessed on |
| 241 // the same thread that it was created on. | 241 // the same thread that it was created on. |
| 242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 242 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 243 | 243 |
| 244 if (IsLocalPredictorEnabled()) | 244 if (IsLocalPredictorEnabled(profile)) |
| 245 local_predictor_.reset(new PrerenderLocalPredictor(this)); | 245 local_predictor_.reset(new PrerenderLocalPredictor(this)); |
| 246 | 246 |
| 247 if (IsLoggedInPredictorEnabled() && !profile_->IsOffTheRecord()) { | 247 if (IsLoggedInPredictorEnabled() && !profile_->IsOffTheRecord()) { |
| 248 predictors::PredictorDatabase* predictor_db = | 248 predictors::PredictorDatabase* predictor_db = |
| 249 predictors::PredictorDatabaseFactory::GetForProfile(profile); | 249 predictors::PredictorDatabaseFactory::GetForProfile(profile); |
| 250 if (predictor_db) { | 250 if (predictor_db) { |
| 251 logged_in_predictor_table_ = predictor_db->logged_in_table(); | 251 logged_in_predictor_table_ = predictor_db->logged_in_table(); |
| 252 scoped_ptr<LoggedInStateMap> new_state_map(new LoggedInStateMap); | 252 scoped_ptr<LoggedInStateMap> new_state_map(new LoggedInStateMap); |
| 253 LoggedInStateMap* new_state_map_ptr = new_state_map.get(); | 253 LoggedInStateMap* new_state_map_ptr = new_state_map.get(); |
| 254 BrowserThread::PostTaskAndReply( | 254 BrowserThread::PostTaskAndReply( |
| (...skipping 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1566 logged_in_state_->erase(domain_key); | 1566 logged_in_state_->erase(domain_key); |
| 1567 } | 1567 } |
| 1568 | 1568 |
| 1569 void PrerenderManager::LoggedInPredictorDataReceived( | 1569 void PrerenderManager::LoggedInPredictorDataReceived( |
| 1570 scoped_ptr<LoggedInStateMap> new_map) { | 1570 scoped_ptr<LoggedInStateMap> new_map) { |
| 1571 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1571 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 1572 logged_in_state_.swap(new_map); | 1572 logged_in_state_.swap(new_map); |
| 1573 } | 1573 } |
| 1574 | 1574 |
| 1575 } // namespace prerender | 1575 } // namespace prerender |
| OLD | NEW |