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 "net/proxy/proxy_service.h" | 5 #include "net/proxy/proxy_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1258 | 1258 |
1259 for (ProxyRetryInfoMap::const_iterator iter = new_retry_info.begin(); | 1259 for (ProxyRetryInfoMap::const_iterator iter = new_retry_info.begin(); |
1260 iter != new_retry_info.end(); ++iter) { | 1260 iter != new_retry_info.end(); ++iter) { |
1261 ProxyRetryInfoMap::iterator existing = proxy_retry_info_.find(iter->first); | 1261 ProxyRetryInfoMap::iterator existing = proxy_retry_info_.find(iter->first); |
1262 if (existing == proxy_retry_info_.end()) | 1262 if (existing == proxy_retry_info_.end()) |
1263 proxy_retry_info_[iter->first] = iter->second; | 1263 proxy_retry_info_[iter->first] = iter->second; |
1264 else if (existing->second.bad_until < iter->second.bad_until) | 1264 else if (existing->second.bad_until < iter->second.bad_until) |
1265 existing->second.bad_until = iter->second.bad_until; | 1265 existing->second.bad_until = iter->second.bad_until; |
1266 } | 1266 } |
1267 if (net_log_) { | 1267 if (net_log_) { |
1268 net_log_->AddEntry(NetLog::TYPE_BAD_PROXY_LIST_REPORTED, | 1268 net_log_->AddGlobalEntry( |
1269 TimeTicks::Now(), | 1269 NetLog::TYPE_BAD_PROXY_LIST_REPORTED, |
1270 NetLog::Source(), | 1270 make_scoped_refptr( |
1271 NetLog::PHASE_NONE, | 1271 new BadProxyListNetLogParam(new_retry_info))); |
1272 make_scoped_refptr( | |
1273 new BadProxyListNetLogParam(new_retry_info))); | |
1274 } | 1272 } |
1275 } | 1273 } |
1276 | 1274 |
1277 void ProxyService::CancelPacRequest(PacRequest* req) { | 1275 void ProxyService::CancelPacRequest(PacRequest* req) { |
1278 DCHECK(CalledOnValidThread()); | 1276 DCHECK(CalledOnValidThread()); |
1279 DCHECK(req); | 1277 DCHECK(req); |
1280 req->Cancel(); | 1278 req->Cancel(); |
1281 RemovePendingRequest(req); | 1279 RemovePendingRequest(req); |
1282 } | 1280 } |
1283 | 1281 |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 break; | 1464 break; |
1467 case ProxyConfigService::CONFIG_UNSET: | 1465 case ProxyConfigService::CONFIG_UNSET: |
1468 effective_config = ProxyConfig::CreateDirect(); | 1466 effective_config = ProxyConfig::CreateDirect(); |
1469 break; | 1467 break; |
1470 } | 1468 } |
1471 | 1469 |
1472 // Emit the proxy settings change to the NetLog stream. | 1470 // Emit the proxy settings change to the NetLog stream. |
1473 if (net_log_) { | 1471 if (net_log_) { |
1474 scoped_refptr<NetLog::EventParameters> params( | 1472 scoped_refptr<NetLog::EventParameters> params( |
1475 new ProxyConfigChangedNetLogParam(fetched_config_, effective_config)); | 1473 new ProxyConfigChangedNetLogParam(fetched_config_, effective_config)); |
1476 net_log_->AddEntry(net::NetLog::TYPE_PROXY_CONFIG_CHANGED, | 1474 net_log_->AddGlobalEntry(net::NetLog::TYPE_PROXY_CONFIG_CHANGED, |
1477 TimeTicks::Now(), | 1475 params); |
1478 NetLog::Source(), | |
1479 NetLog::PHASE_NONE, | |
1480 params); | |
1481 } | 1476 } |
1482 | 1477 |
1483 // Set the new configuration as the most recently fetched one. | 1478 // Set the new configuration as the most recently fetched one. |
1484 fetched_config_ = effective_config; | 1479 fetched_config_ = effective_config; |
1485 fetched_config_.set_id(1); // Needed for a later DCHECK of is_valid(). | 1480 fetched_config_.set_id(1); // Needed for a later DCHECK of is_valid(). |
1486 | 1481 |
1487 InitializeUsingLastFetchedConfig(); | 1482 InitializeUsingLastFetchedConfig(); |
1488 } | 1483 } |
1489 | 1484 |
1490 void ProxyService::InitializeUsingLastFetchedConfig() { | 1485 void ProxyService::InitializeUsingLastFetchedConfig() { |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1622 OnCompletion(result_); | 1617 OnCompletion(result_); |
1623 } | 1618 } |
1624 } | 1619 } |
1625 | 1620 |
1626 void SyncProxyServiceHelper::OnCompletion(int rv) { | 1621 void SyncProxyServiceHelper::OnCompletion(int rv) { |
1627 result_ = rv; | 1622 result_ = rv; |
1628 event_.Signal(); | 1623 event_.Signal(); |
1629 } | 1624 } |
1630 | 1625 |
1631 } // namespace net | 1626 } // namespace net |
OLD | NEW |