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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
897 ProxyService::ProxyService(ProxyConfigService* config_service, | 897 ProxyService::ProxyService(ProxyConfigService* config_service, |
898 ProxyResolver* resolver, | 898 ProxyResolver* resolver, |
899 NetLog* net_log) | 899 NetLog* net_log) |
900 : resolver_(resolver), | 900 : resolver_(resolver), |
901 next_config_id_(1), | 901 next_config_id_(1), |
902 current_state_(STATE_NONE), | 902 current_state_(STATE_NONE), |
903 net_log_(net_log), | 903 net_log_(net_log), |
904 stall_proxy_auto_config_delay_(TimeDelta::FromMilliseconds( | 904 stall_proxy_auto_config_delay_(TimeDelta::FromMilliseconds( |
905 kDelayAfterNetworkChangesMs)), | 905 kDelayAfterNetworkChangesMs)), |
906 quick_check_enabled_(true) { | 906 quick_check_enabled_(true) { |
907 // TODO(eroman): Remove once crbug.com/454983 is solved. | |
908 tracked_objects::ScopedTracker tracking_profile( | |
909 FROM_HERE_WITH_EXPLICIT_FUNCTION("454983 ProxyService::ProxyService")); | |
910 NetworkChangeNotifier::AddIPAddressObserver(this); | 907 NetworkChangeNotifier::AddIPAddressObserver(this); |
911 NetworkChangeNotifier::AddDNSObserver(this); | 908 NetworkChangeNotifier::AddDNSObserver(this); |
912 ResetConfigService(config_service); | 909 ResetConfigService(config_service); |
913 } | 910 } |
914 | 911 |
915 // static | 912 // static |
916 ProxyService* ProxyService::CreateUsingSystemProxyResolver( | 913 ProxyService* ProxyService::CreateUsingSystemProxyResolver( |
917 ProxyConfigService* proxy_config_service, | 914 ProxyConfigService* proxy_config_service, |
918 size_t num_pac_threads, | 915 size_t num_pac_threads, |
919 NetLog* net_log) { | 916 NetLog* net_log) { |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 } | 1382 } |
1386 } | 1383 } |
1387 | 1384 |
1388 net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE); | 1385 net_log.EndEvent(NetLog::TYPE_PROXY_SERVICE); |
1389 return result_code; | 1386 return result_code; |
1390 } | 1387 } |
1391 | 1388 |
1392 void ProxyService::SetProxyScriptFetchers( | 1389 void ProxyService::SetProxyScriptFetchers( |
1393 ProxyScriptFetcher* proxy_script_fetcher, | 1390 ProxyScriptFetcher* proxy_script_fetcher, |
1394 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher) { | 1391 DhcpProxyScriptFetcher* dhcp_proxy_script_fetcher) { |
1395 // TODO(eroman): Remove once crbug.com/454983 is fixed. | |
1396 tracked_objects::ScopedTracker tracking_profile( | |
1397 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
1398 "454983 ProxyService::SetProxyScriptFetchers")); | |
1399 DCHECK(CalledOnValidThread()); | 1392 DCHECK(CalledOnValidThread()); |
1400 State previous_state = ResetProxyConfig(false); | 1393 State previous_state = ResetProxyConfig(false); |
1401 proxy_script_fetcher_.reset(proxy_script_fetcher); | 1394 proxy_script_fetcher_.reset(proxy_script_fetcher); |
1402 dhcp_proxy_script_fetcher_.reset(dhcp_proxy_script_fetcher); | 1395 dhcp_proxy_script_fetcher_.reset(dhcp_proxy_script_fetcher); |
1403 if (previous_state != STATE_NONE) | 1396 if (previous_state != STATE_NONE) |
1404 ApplyProxyConfigIfAvailable(); | 1397 ApplyProxyConfigIfAvailable(); |
1405 } | 1398 } |
1406 | 1399 |
1407 ProxyScriptFetcher* ProxyService::GetProxyScriptFetcher() const { | 1400 ProxyScriptFetcher* ProxyService::GetProxyScriptFetcher() const { |
1408 DCHECK(CalledOnValidThread()); | 1401 DCHECK(CalledOnValidThread()); |
(...skipping 12 matching lines...) Expand all Loading... |
1421 config_ = ProxyConfig(); | 1414 config_ = ProxyConfig(); |
1422 if (reset_fetched_config) | 1415 if (reset_fetched_config) |
1423 fetched_config_ = ProxyConfig(); | 1416 fetched_config_ = ProxyConfig(); |
1424 current_state_ = STATE_NONE; | 1417 current_state_ = STATE_NONE; |
1425 | 1418 |
1426 return previous_state; | 1419 return previous_state; |
1427 } | 1420 } |
1428 | 1421 |
1429 void ProxyService::ResetConfigService( | 1422 void ProxyService::ResetConfigService( |
1430 ProxyConfigService* new_proxy_config_service) { | 1423 ProxyConfigService* new_proxy_config_service) { |
1431 // TODO(eroman): Remove once crbug.com/454983 is solved. | |
1432 tracked_objects::ScopedTracker tracking_profile( | |
1433 FROM_HERE_WITH_EXPLICIT_FUNCTION( | |
1434 "454983 ProxyService::ResetConfigService")); | |
1435 | |
1436 DCHECK(CalledOnValidThread()); | 1424 DCHECK(CalledOnValidThread()); |
1437 State previous_state = ResetProxyConfig(true); | 1425 State previous_state = ResetProxyConfig(true); |
1438 | 1426 |
1439 // Release the old configuration service. | 1427 // Release the old configuration service. |
1440 if (config_service_.get()) | 1428 if (config_service_.get()) |
1441 config_service_->RemoveObserver(this); | 1429 config_service_->RemoveObserver(this); |
1442 | 1430 |
1443 // Set the new configuration service. | 1431 // Set the new configuration service. |
1444 config_service_.reset(new_proxy_config_service); | 1432 config_service_.reset(new_proxy_config_service); |
1445 config_service_->AddObserver(this); | 1433 config_service_->AddObserver(this); |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1613 State previous_state = ResetProxyConfig(false); | 1601 State previous_state = ResetProxyConfig(false); |
1614 if (previous_state != STATE_NONE) | 1602 if (previous_state != STATE_NONE) |
1615 ApplyProxyConfigIfAvailable(); | 1603 ApplyProxyConfigIfAvailable(); |
1616 } | 1604 } |
1617 | 1605 |
1618 void ProxyService::OnDNSChanged() { | 1606 void ProxyService::OnDNSChanged() { |
1619 OnIPAddressChanged(); | 1607 OnIPAddressChanged(); |
1620 } | 1608 } |
1621 | 1609 |
1622 } // namespace net | 1610 } // namespace net |
OLD | NEW |