| 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/net/predictor.h" | 5 #include "chrome/browser/net/predictor.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <sstream> | 10 #include <sstream> |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 proxy_service_(NULL), | 153 proxy_service_(NULL), |
| 154 preconnect_enabled_(preconnect_enabled), | 154 preconnect_enabled_(preconnect_enabled), |
| 155 consecutive_omnibox_preconnect_count_(0), | 155 consecutive_omnibox_preconnect_count_(0), |
| 156 next_trim_time_(base::TimeTicks::Now() + | 156 next_trim_time_(base::TimeTicks::Now() + |
| 157 TimeDelta::FromHours(kDurationBetweenTrimmingsHours)), | 157 TimeDelta::FromHours(kDurationBetweenTrimmingsHours)), |
| 158 observer_(NULL) { | 158 observer_(NULL) { |
| 159 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 159 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 160 } | 160 } |
| 161 | 161 |
| 162 Predictor::~Predictor() { | 162 Predictor::~Predictor() { |
| 163 // TODO(rlp): Add DCHECK for CurrentlyOn(BrowserThread::IO) when the | 163 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 164 // ProfileManagerTest has been updated with a mock profile. | |
| 165 DCHECK(shutdown_); | 164 DCHECK(shutdown_); |
| 166 } | 165 } |
| 167 | 166 |
| 168 // static | 167 // static |
| 169 Predictor* Predictor::CreatePredictor(bool preconnect_enabled, | 168 Predictor* Predictor::CreatePredictor(bool preconnect_enabled, |
| 170 bool predictor_enabled, | 169 bool predictor_enabled, |
| 171 bool simple_shutdown) { | 170 bool simple_shutdown) { |
| 172 if (simple_shutdown) | 171 if (simple_shutdown) |
| 173 return new SimplePredictor(preconnect_enabled, predictor_enabled); | 172 return new SimplePredictor(preconnect_enabled, predictor_enabled); |
| 174 return new Predictor(preconnect_enabled, predictor_enabled); | 173 return new Predictor(preconnect_enabled, predictor_enabled); |
| (...skipping 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1317 } | 1316 } |
| 1318 | 1317 |
| 1319 void SimplePredictor::ShutdownOnUIThread() { | 1318 void SimplePredictor::ShutdownOnUIThread() { |
| 1320 SetShutdown(true); | 1319 SetShutdown(true); |
| 1321 } | 1320 } |
| 1322 | 1321 |
| 1323 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } | 1322 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } |
| 1324 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } | 1323 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } |
| 1325 | 1324 |
| 1326 } // namespace chrome_browser_net | 1325 } // namespace chrome_browser_net |
| OLD | NEW |