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 <iterator> | 9 #include <iterator> |
10 #include <set> | 10 #include <set> |
(...skipping 1099 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 Predictor::InitialObserver::InitialObserver() { | 1110 Predictor::InitialObserver::InitialObserver() { |
1111 } | 1111 } |
1112 | 1112 |
1113 Predictor::InitialObserver::~InitialObserver() { | 1113 Predictor::InitialObserver::~InitialObserver() { |
1114 } | 1114 } |
1115 | 1115 |
1116 void Predictor::InitialObserver::Append(const GURL& url, | 1116 void Predictor::InitialObserver::Append(const GURL& url, |
1117 Predictor* predictor) { | 1117 Predictor* predictor) { |
1118 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 1118 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
1119 | 1119 |
1120 // TODO(rlp): Do we really need the predictor check here? | |
1121 if (nullptr == predictor) | |
1122 return; | |
1123 if (kStartupResolutionCount <= first_navigations_.size()) | 1120 if (kStartupResolutionCount <= first_navigations_.size()) |
1124 return; | 1121 return; |
1125 | 1122 |
1126 DCHECK(url.SchemeIsHTTPOrHTTPS()); | 1123 DCHECK(url.SchemeIsHTTPOrHTTPS()); |
1127 DCHECK_EQ(url, Predictor::CanonicalizeUrl(url)); | 1124 DCHECK_EQ(url, Predictor::CanonicalizeUrl(url)); |
1128 if (first_navigations_.find(url) == first_navigations_.end()) | 1125 if (first_navigations_.find(url) == first_navigations_.end()) |
1129 first_navigations_[url] = base::TimeTicks::Now(); | 1126 first_navigations_[url] = base::TimeTicks::Now(); |
1130 } | 1127 } |
1131 | 1128 |
1132 void Predictor::InitialObserver::GetInitialDnsResolutionList( | 1129 void Predictor::InitialObserver::GetInitialDnsResolutionList( |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 } | 1197 } |
1201 | 1198 |
1202 void SimplePredictor::ShutdownOnUIThread() { | 1199 void SimplePredictor::ShutdownOnUIThread() { |
1203 SetShutdown(true); | 1200 SetShutdown(true); |
1204 } | 1201 } |
1205 | 1202 |
1206 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } | 1203 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } |
1207 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } | 1204 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } |
1208 | 1205 |
1209 } // namespace chrome_browser_net | 1206 } // namespace chrome_browser_net |
OLD | NEW |