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 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1159 info->SetAssignedState(); | 1159 info->SetAssignedState(); |
1160 } | 1160 } |
1161 return true; | 1161 return true; |
1162 } | 1162 } |
1163 | 1163 |
1164 void Predictor::StartSomeQueuedResolutions() { | 1164 void Predictor::StartSomeQueuedResolutions() { |
1165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 1165 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
1166 | 1166 |
1167 while (!work_queue_.IsEmpty() && | 1167 while (!work_queue_.IsEmpty() && |
1168 pending_lookups_.size() < max_concurrent_dns_lookups_) { | 1168 pending_lookups_.size() < max_concurrent_dns_lookups_) { |
| 1169 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 1170 tracked_objects::ScopedTracker tracking_profile1( |
| 1171 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1172 "436671 Predictor::StartSomeQueuedResolutions1")); |
| 1173 |
1169 const GURL url(work_queue_.Pop()); | 1174 const GURL url(work_queue_.Pop()); |
1170 UrlInfo* info = &results_[url]; | 1175 UrlInfo* info = &results_[url]; |
1171 DCHECK(info->HasUrl(url)); | 1176 DCHECK(info->HasUrl(url)); |
1172 info->SetAssignedState(); | 1177 info->SetAssignedState(); |
1173 | 1178 |
1174 if (CongestionControlPerformed(info)) { | 1179 if (CongestionControlPerformed(info)) { |
1175 DCHECK(work_queue_.IsEmpty()); | 1180 DCHECK(work_queue_.IsEmpty()); |
1176 return; | 1181 return; |
1177 } | 1182 } |
1178 | 1183 |
1179 LookupRequest* request = new LookupRequest(this, host_resolver_, url); | 1184 LookupRequest* request = new LookupRequest(this, host_resolver_, url); |
| 1185 |
| 1186 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 1187 tracked_objects::ScopedTracker tracking_profile2( |
| 1188 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1189 "436671 Predictor::StartSomeQueuedResolutions2")); |
| 1190 |
1180 int status = request->Start(); | 1191 int status = request->Start(); |
| 1192 |
| 1193 // TODO(vadimt): Remove ScopedTracker below once crbug.com/436671 is fixed. |
| 1194 tracked_objects::ScopedTracker tracking_profile3( |
| 1195 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 1196 "436671 Predictor::StartSomeQueuedResolutions3")); |
| 1197 |
1181 if (status == net::ERR_IO_PENDING) { | 1198 if (status == net::ERR_IO_PENDING) { |
1182 // Will complete asynchronously. | 1199 // Will complete asynchronously. |
1183 pending_lookups_.insert(request); | 1200 pending_lookups_.insert(request); |
1184 peak_pending_lookups_ = std::max(peak_pending_lookups_, | 1201 peak_pending_lookups_ = std::max(peak_pending_lookups_, |
1185 pending_lookups_.size()); | 1202 pending_lookups_.size()); |
1186 } else { | 1203 } else { |
1187 // Completed synchronously (was already cached by HostResolver), or else | 1204 // Completed synchronously (was already cached by HostResolver), or else |
1188 // there was (equivalently) some network error that prevents us from | 1205 // there was (equivalently) some network error that prevents us from |
1189 // finding the name. Status net::OK means it was "found." | 1206 // finding the name. Status net::OK means it was "found." |
1190 LookupFinished(request, url, status == net::OK); | 1207 LookupFinished(request, url, status == net::OK); |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 } | 1421 } |
1405 | 1422 |
1406 void SimplePredictor::ShutdownOnUIThread() { | 1423 void SimplePredictor::ShutdownOnUIThread() { |
1407 SetShutdown(true); | 1424 SetShutdown(true); |
1408 } | 1425 } |
1409 | 1426 |
1410 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } | 1427 bool SimplePredictor::CanPrefetchAndPrerender() const { return true; } |
1411 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } | 1428 bool SimplePredictor::CanPreresolveAndPreconnect() const { return true; } |
1412 | 1429 |
1413 } // namespace chrome_browser_net | 1430 } // namespace chrome_browser_net |
OLD | NEW |