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 #include <cmath> | 8 #include <cmath> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
745 const ProxyService::PacPollPolicy* | 745 const ProxyService::PacPollPolicy* |
746 ProxyService::ProxyScriptDeciderPoller::poll_policy_ = NULL; | 746 ProxyService::ProxyScriptDeciderPoller::poll_policy_ = NULL; |
747 | 747 |
748 // ProxyService::PacRequest --------------------------------------------------- | 748 // ProxyService::PacRequest --------------------------------------------------- |
749 | 749 |
750 class ProxyService::PacRequest | 750 class ProxyService::PacRequest |
751 : public base::RefCounted<ProxyService::PacRequest> { | 751 : public base::RefCounted<ProxyService::PacRequest> { |
752 public: | 752 public: |
753 PacRequest(ProxyService* service, | 753 PacRequest(ProxyService* service, |
754 const GURL& url, | 754 const GURL& url, |
755 const std::string& method, | |
755 int load_flags, | 756 int load_flags, |
756 ProxyDelegate* proxy_delegate, | 757 ProxyDelegate* proxy_delegate, |
757 ProxyInfo* results, | 758 ProxyInfo* results, |
758 const CompletionCallback& user_callback, | 759 const CompletionCallback& user_callback, |
759 const BoundNetLog& net_log) | 760 const BoundNetLog& net_log) |
760 : service_(service), | 761 : service_(service), |
761 user_callback_(user_callback), | 762 user_callback_(user_callback), |
762 results_(results), | 763 results_(results), |
763 url_(url), | 764 url_(url), |
765 method_(method), | |
764 load_flags_(load_flags), | 766 load_flags_(load_flags), |
765 proxy_delegate_(proxy_delegate), | 767 proxy_delegate_(proxy_delegate), |
766 config_id_(ProxyConfig::kInvalidConfigID), | 768 config_id_(ProxyConfig::kInvalidConfigID), |
767 config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), | 769 config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), |
768 net_log_(net_log), | 770 net_log_(net_log), |
769 creation_time_(TimeTicks::Now()) { | 771 creation_time_(TimeTicks::Now()) { |
770 DCHECK(!user_callback.is_null()); | 772 DCHECK(!user_callback.is_null()); |
771 } | 773 } |
772 | 774 |
773 // Starts the resolve proxy request. | 775 // Starts the resolve proxy request. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
833 | 835 |
834 // This state is cleared when resolve_job_ is reset below. | 836 // This state is cleared when resolve_job_ is reset below. |
835 bool script_executed = is_started(); | 837 bool script_executed = is_started(); |
836 | 838 |
837 // Clear |resolve_job_| so is_started() returns false while | 839 // Clear |resolve_job_| so is_started() returns false while |
838 // DidFinishResolvingProxy() runs. | 840 // DidFinishResolvingProxy() runs. |
839 resolve_job_.reset(); | 841 resolve_job_.reset(); |
840 | 842 |
841 // Note that DidFinishResolvingProxy might modify |results_|. | 843 // Note that DidFinishResolvingProxy might modify |results_|. |
842 int rv = service_->DidFinishResolvingProxy( | 844 int rv = service_->DidFinishResolvingProxy( |
843 url_, load_flags_, proxy_delegate_, results_, result_code, net_log_, | 845 url_, method_, load_flags_, proxy_delegate_, results_, result_code, |
844 creation_time_, script_executed); | 846 net_log_, creation_time_, script_executed); |
845 | 847 |
846 // Make a note in the results which configuration was in use at the | 848 // Make a note in the results which configuration was in use at the |
847 // time of the resolve. | 849 // time of the resolve. |
848 results_->config_id_ = config_id_; | 850 results_->config_id_ = config_id_; |
849 results_->config_source_ = config_source_; | 851 results_->config_source_ = config_source_; |
850 results_->did_use_pac_script_ = true; | 852 results_->did_use_pac_script_ = true; |
851 results_->proxy_resolve_start_time_ = creation_time_; | 853 results_->proxy_resolve_start_time_ = creation_time_; |
852 results_->proxy_resolve_end_time_ = TimeTicks::Now(); | 854 results_->proxy_resolve_end_time_ = TimeTicks::Now(); |
853 | 855 |
854 // Reset the state associated with in-progress-resolve. | 856 // Reset the state associated with in-progress-resolve. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
886 | 888 |
887 ProxyResolver* resolver() const { return service_->resolver_.get(); } | 889 ProxyResolver* resolver() const { return service_->resolver_.get(); } |
888 | 890 |
889 // Note that we don't hold a reference to the ProxyService. Outstanding | 891 // Note that we don't hold a reference to the ProxyService. Outstanding |
890 // requests are cancelled during ~ProxyService, so this is guaranteed | 892 // requests are cancelled during ~ProxyService, so this is guaranteed |
891 // to be valid throughout our lifetime. | 893 // to be valid throughout our lifetime. |
892 ProxyService* service_; | 894 ProxyService* service_; |
893 CompletionCallback user_callback_; | 895 CompletionCallback user_callback_; |
894 ProxyInfo* results_; | 896 ProxyInfo* results_; |
895 GURL url_; | 897 GURL url_; |
898 std::string method_; | |
896 int load_flags_; | 899 int load_flags_; |
897 ProxyDelegate* proxy_delegate_; | 900 ProxyDelegate* proxy_delegate_; |
898 scoped_ptr<ProxyResolver::Request> resolve_job_; | 901 scoped_ptr<ProxyResolver::Request> resolve_job_; |
899 ProxyConfig::ID config_id_; // The config id when the resolve was started. | 902 ProxyConfig::ID config_id_; // The config id when the resolve was started. |
900 ProxyConfigSource config_source_; // The source of proxy settings. | 903 ProxyConfigSource config_source_; // The source of proxy settings. |
901 BoundNetLog net_log_; | 904 BoundNetLog net_log_; |
902 // Time when the request was created. Stored here rather than in |results_| | 905 // Time when the request was created. Stored here rather than in |results_| |
903 // because the time in |results_| will be cleared. | 906 // because the time in |results_| will be cleared. |
904 TimeTicks creation_time_; | 907 TimeTicks creation_time_; |
905 }; | 908 }; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
985 // ProxyResolver dependency we give it will never be used. | 988 // ProxyResolver dependency we give it will never be used. |
986 scoped_ptr<ProxyConfigService> proxy_config_service( | 989 scoped_ptr<ProxyConfigService> proxy_config_service( |
987 new ProxyConfigServiceFixed(ProxyConfig::CreateAutoDetect())); | 990 new ProxyConfigServiceFixed(ProxyConfig::CreateAutoDetect())); |
988 | 991 |
989 return make_scoped_ptr(new ProxyService( | 992 return make_scoped_ptr(new ProxyService( |
990 std::move(proxy_config_service), | 993 std::move(proxy_config_service), |
991 make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL)); | 994 make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL)); |
992 } | 995 } |
993 | 996 |
994 int ProxyService::ResolveProxy(const GURL& raw_url, | 997 int ProxyService::ResolveProxy(const GURL& raw_url, |
998 const std::string& method, | |
995 int load_flags, | 999 int load_flags, |
996 ProxyInfo* result, | 1000 ProxyInfo* result, |
997 const CompletionCallback& callback, | 1001 const CompletionCallback& callback, |
998 PacRequest** pac_request, | 1002 PacRequest** pac_request, |
999 ProxyDelegate* proxy_delegate, | 1003 ProxyDelegate* proxy_delegate, |
1000 const BoundNetLog& net_log) { | 1004 const BoundNetLog& net_log) { |
1001 DCHECK(!callback.is_null()); | 1005 DCHECK(!callback.is_null()); |
1002 return ResolveProxyHelper(raw_url, load_flags, result, callback, pac_request, | 1006 return ResolveProxyHelper(raw_url, method, load_flags, result, callback, |
1003 proxy_delegate, net_log); | 1007 pac_request, proxy_delegate, net_log); |
1004 } | 1008 } |
1005 | 1009 |
1006 int ProxyService::ResolveProxyHelper(const GURL& raw_url, | 1010 int ProxyService::ResolveProxyHelper(const GURL& raw_url, |
1011 const std::string& method, | |
1007 int load_flags, | 1012 int load_flags, |
1008 ProxyInfo* result, | 1013 ProxyInfo* result, |
1009 const CompletionCallback& callback, | 1014 const CompletionCallback& callback, |
1010 PacRequest** pac_request, | 1015 PacRequest** pac_request, |
1011 ProxyDelegate* proxy_delegate, | 1016 ProxyDelegate* proxy_delegate, |
1012 const BoundNetLog& net_log) { | 1017 const BoundNetLog& net_log) { |
1018 DCHECK((proxy_delegate && !method.empty()) || !proxy_delegate); | |
mmenke
2016/03/02 22:53:45
Why this DCHECK? The docs say it can be empty.
RyanSturm
2016/03/03 18:54:31
Done.
| |
1013 DCHECK(CalledOnValidThread()); | 1019 DCHECK(CalledOnValidThread()); |
1014 | 1020 |
1015 net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE); | 1021 net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE); |
1016 | 1022 |
1017 // Notify our polling-based dependencies that a resolve is taking place. | 1023 // Notify our polling-based dependencies that a resolve is taking place. |
1018 // This way they can schedule their polls in response to network activity. | 1024 // This way they can schedule their polls in response to network activity. |
1019 config_service_->OnLazyPoll(); | 1025 config_service_->OnLazyPoll(); |
1020 if (script_poller_.get()) | 1026 if (script_poller_.get()) |
1021 script_poller_->OnLazyPoll(); | 1027 script_poller_->OnLazyPoll(); |
1022 | 1028 |
1023 if (current_state_ == STATE_NONE) | 1029 if (current_state_ == STATE_NONE) |
1024 ApplyProxyConfigIfAvailable(); | 1030 ApplyProxyConfigIfAvailable(); |
1025 | 1031 |
1026 // Strip away any reference fragments and the username/password, as they | 1032 // Strip away any reference fragments and the username/password, as they |
1027 // are not relevant to proxy resolution. | 1033 // are not relevant to proxy resolution. |
1028 GURL url = SimplifyUrlForRequest(raw_url); | 1034 GURL url = SimplifyUrlForRequest(raw_url); |
1029 | 1035 |
1030 // Check if the request can be completed right away. (This is the case when | 1036 // Check if the request can be completed right away. (This is the case when |
1031 // using a direct connection for example). | 1037 // using a direct connection for example). |
1032 int rv = TryToCompleteSynchronously(url, load_flags, proxy_delegate, result); | 1038 int rv = TryToCompleteSynchronously(url, load_flags, proxy_delegate, result); |
1033 if (rv != ERR_IO_PENDING) { | 1039 if (rv != ERR_IO_PENDING) { |
1034 rv = DidFinishResolvingProxy( | 1040 rv = DidFinishResolvingProxy( |
1035 url, load_flags, proxy_delegate, result, rv, net_log, | 1041 url, method, load_flags, proxy_delegate, result, rv, net_log, |
1036 callback.is_null() ? TimeTicks() : TimeTicks::Now(), false); | 1042 callback.is_null() ? TimeTicks() : TimeTicks::Now(), false); |
1037 return rv; | 1043 return rv; |
1038 } | 1044 } |
1039 | 1045 |
1040 if (callback.is_null()) | 1046 if (callback.is_null()) |
1041 return ERR_IO_PENDING; | 1047 return ERR_IO_PENDING; |
1042 | 1048 |
1043 scoped_refptr<PacRequest> req(new PacRequest( | 1049 scoped_refptr<PacRequest> req(new PacRequest(this, url, method, load_flags, |
1044 this, url, load_flags, proxy_delegate, result, callback, net_log)); | 1050 proxy_delegate, result, callback, |
1051 net_log)); | |
1045 | 1052 |
1046 if (current_state_ == STATE_READY) { | 1053 if (current_state_ == STATE_READY) { |
1047 // Start the resolve request. | 1054 // Start the resolve request. |
1048 rv = req->Start(); | 1055 rv = req->Start(); |
1049 if (rv != ERR_IO_PENDING) | 1056 if (rv != ERR_IO_PENDING) |
1050 return req->QueryDidComplete(rv); | 1057 return req->QueryDidComplete(rv); |
1051 } else { | 1058 } else { |
1052 req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC); | 1059 req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC); |
1053 } | 1060 } |
1054 | 1061 |
1055 DCHECK_EQ(ERR_IO_PENDING, rv); | 1062 DCHECK_EQ(ERR_IO_PENDING, rv); |
1056 DCHECK(!ContainsPendingRequest(req.get())); | 1063 DCHECK(!ContainsPendingRequest(req.get())); |
1057 pending_requests_.insert(req); | 1064 pending_requests_.insert(req); |
1058 | 1065 |
1059 // Completion will be notified through |callback|, unless the caller cancels | 1066 // Completion will be notified through |callback|, unless the caller cancels |
1060 // the request using |pac_request|. | 1067 // the request using |pac_request|. |
1061 if (pac_request) | 1068 if (pac_request) |
1062 *pac_request = req.get(); | 1069 *pac_request = req.get(); |
1063 return rv; // ERR_IO_PENDING | 1070 return rv; // ERR_IO_PENDING |
1064 } | 1071 } |
1065 | 1072 |
1066 bool ProxyService::TryResolveProxySynchronously(const GURL& raw_url, | 1073 bool ProxyService::TryResolveProxySynchronously(const GURL& raw_url, |
1074 const std::string& method, | |
1067 int load_flags, | 1075 int load_flags, |
1068 ProxyInfo* result, | 1076 ProxyInfo* result, |
1069 ProxyDelegate* proxy_delegate, | 1077 ProxyDelegate* proxy_delegate, |
1070 const BoundNetLog& net_log) { | 1078 const BoundNetLog& net_log) { |
1071 CompletionCallback null_callback; | 1079 CompletionCallback null_callback; |
1072 return ResolveProxyHelper(raw_url, load_flags, result, null_callback, | 1080 return ResolveProxyHelper(raw_url, method, load_flags, result, null_callback, |
1073 nullptr /* pac_request*/, proxy_delegate, | 1081 nullptr /* pac_request*/, proxy_delegate, |
1074 net_log) == OK; | 1082 net_log) == OK; |
1075 } | 1083 } |
1076 | 1084 |
1077 int ProxyService::TryToCompleteSynchronously(const GURL& url, | 1085 int ProxyService::TryToCompleteSynchronously(const GURL& url, |
1078 int load_flags, | 1086 int load_flags, |
1079 ProxyDelegate* proxy_delegate, | 1087 ProxyDelegate* proxy_delegate, |
1080 ProxyInfo* result) { | 1088 ProxyInfo* result) { |
1081 DCHECK_NE(STATE_NONE, current_state_); | 1089 DCHECK_NE(STATE_NONE, current_state_); |
1082 | 1090 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1222 // due to ProxyScriptDeciderPoller. | 1230 // due to ProxyScriptDeciderPoller. |
1223 config_.set_id(fetched_config_.id()); | 1231 config_.set_id(fetched_config_.id()); |
1224 config_.set_source(fetched_config_.source()); | 1232 config_.set_source(fetched_config_.source()); |
1225 | 1233 |
1226 // Resume any requests which we had to defer until the PAC script was | 1234 // Resume any requests which we had to defer until the PAC script was |
1227 // downloaded. | 1235 // downloaded. |
1228 SetReady(); | 1236 SetReady(); |
1229 } | 1237 } |
1230 | 1238 |
1231 int ProxyService::ReconsiderProxyAfterError(const GURL& url, | 1239 int ProxyService::ReconsiderProxyAfterError(const GURL& url, |
1240 const std::string& method, | |
1232 int load_flags, | 1241 int load_flags, |
1233 int net_error, | 1242 int net_error, |
1234 ProxyInfo* result, | 1243 ProxyInfo* result, |
1235 const CompletionCallback& callback, | 1244 const CompletionCallback& callback, |
1236 PacRequest** pac_request, | 1245 PacRequest** pac_request, |
1237 ProxyDelegate* proxy_delegate, | 1246 ProxyDelegate* proxy_delegate, |
1238 const BoundNetLog& net_log) { | 1247 const BoundNetLog& net_log) { |
1239 DCHECK(CalledOnValidThread()); | 1248 DCHECK(CalledOnValidThread()); |
1240 | 1249 |
1241 // Check to see if we have a new config since ResolveProxy was called. We | 1250 // Check to see if we have a new config since ResolveProxy was called. We |
1242 // want to re-run ResolveProxy in two cases: 1) we have a new config, or 2) a | 1251 // want to re-run ResolveProxy in two cases: 1) we have a new config, or 2) a |
1243 // direct connection failed and we never tried the current config. | 1252 // direct connection failed and we never tried the current config. |
1244 | 1253 |
1245 DCHECK(result); | 1254 DCHECK(result); |
1246 bool re_resolve = result->config_id_ != config_.id(); | 1255 bool re_resolve = result->config_id_ != config_.id(); |
1247 | 1256 |
1248 if (re_resolve) { | 1257 if (re_resolve) { |
1249 // If we have a new config or the config was never tried, we delete the | 1258 // If we have a new config or the config was never tried, we delete the |
1250 // list of bad proxies and we try again. | 1259 // list of bad proxies and we try again. |
1251 proxy_retry_info_.clear(); | 1260 proxy_retry_info_.clear(); |
1252 return ResolveProxy(url, load_flags, result, callback, pac_request, | 1261 return ResolveProxy(url, method, load_flags, result, callback, pac_request, |
1253 proxy_delegate, net_log); | 1262 proxy_delegate, net_log); |
1254 } | 1263 } |
1255 | 1264 |
1256 DCHECK(!result->is_empty()); | 1265 DCHECK(!result->is_empty()); |
1257 ProxyServer bad_proxy = result->proxy_server(); | 1266 ProxyServer bad_proxy = result->proxy_server(); |
1258 | 1267 |
1259 // We don't have new proxy settings to try, try to fallback to the next proxy | 1268 // We don't have new proxy settings to try, try to fallback to the next proxy |
1260 // in the list. | 1269 // in the list. |
1261 bool did_fallback = result->Fallback(net_error, net_log); | 1270 bool did_fallback = result->Fallback(net_error, net_log); |
1262 | 1271 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1323 bool ProxyService::ContainsPendingRequest(PacRequest* req) { | 1332 bool ProxyService::ContainsPendingRequest(PacRequest* req) { |
1324 return pending_requests_.count(req) == 1; | 1333 return pending_requests_.count(req) == 1; |
1325 } | 1334 } |
1326 | 1335 |
1327 void ProxyService::RemovePendingRequest(PacRequest* req) { | 1336 void ProxyService::RemovePendingRequest(PacRequest* req) { |
1328 DCHECK(ContainsPendingRequest(req)); | 1337 DCHECK(ContainsPendingRequest(req)); |
1329 pending_requests_.erase(req); | 1338 pending_requests_.erase(req); |
1330 } | 1339 } |
1331 | 1340 |
1332 int ProxyService::DidFinishResolvingProxy(const GURL& url, | 1341 int ProxyService::DidFinishResolvingProxy(const GURL& url, |
1342 const std::string& method, | |
1333 int load_flags, | 1343 int load_flags, |
1334 ProxyDelegate* proxy_delegate, | 1344 ProxyDelegate* proxy_delegate, |
1335 ProxyInfo* result, | 1345 ProxyInfo* result, |
1336 int result_code, | 1346 int result_code, |
1337 const BoundNetLog& net_log, | 1347 const BoundNetLog& net_log, |
1338 base::TimeTicks start_time, | 1348 base::TimeTicks start_time, |
1339 bool script_executed) { | 1349 bool script_executed) { |
1340 // Don't track any metrics if start_time is 0, which will happen when the user | 1350 // Don't track any metrics if start_time is 0, which will happen when the user |
1341 // calls |TryResolveProxySynchronously|. | 1351 // calls |TryResolveProxySynchronously|. |
1342 if (!start_time.is_null()) { | 1352 if (!start_time.is_null()) { |
1343 TimeDelta diff = TimeTicks::Now() - start_time; | 1353 TimeDelta diff = TimeTicks::Now() - start_time; |
1344 if (script_executed) { | 1354 if (script_executed) { |
1345 // This function "fixes" the result code, so make sure script terminated | 1355 // This function "fixes" the result code, so make sure script terminated |
1346 // errors are tracked. Only track result codes that were a result of | 1356 // errors are tracked. Only track result codes that were a result of |
1347 // script execution. | 1357 // script execution. |
1348 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ScriptTerminated", | 1358 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ScriptTerminated", |
1349 result_code == ERR_PAC_SCRIPT_TERMINATED); | 1359 result_code == ERR_PAC_SCRIPT_TERMINATED); |
1350 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.GetProxyUsingScriptTime", | 1360 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.GetProxyUsingScriptTime", |
1351 diff, base::TimeDelta::FromMicroseconds(100), | 1361 diff, base::TimeDelta::FromMicroseconds(100), |
1352 base::TimeDelta::FromSeconds(20), 50); | 1362 base::TimeDelta::FromSeconds(20), 50); |
1353 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ProxyService.GetProxyUsingScriptResult", | 1363 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ProxyService.GetProxyUsingScriptResult", |
1354 std::abs(result_code)); | 1364 std::abs(result_code)); |
1355 } | 1365 } |
1356 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ResolvedUsingScript", | 1366 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ResolvedUsingScript", |
1357 script_executed); | 1367 script_executed); |
1358 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.ResolveProxyTime", diff, | 1368 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.ResolveProxyTime", diff, |
1359 base::TimeDelta::FromMicroseconds(100), | 1369 base::TimeDelta::FromMicroseconds(100), |
1360 base::TimeDelta::FromSeconds(20), 50); | 1370 base::TimeDelta::FromSeconds(20), 50); |
1361 } | 1371 } |
1372 | |
1362 // Log the result of the proxy resolution. | 1373 // Log the result of the proxy resolution. |
1363 if (result_code == OK) { | 1374 if (result_code == OK) { |
1364 // Allow the proxy delegate to interpose on the resolution decision, | 1375 // Allow the proxy delegate to interpose on the resolution decision, |
1365 // possibly modifying the ProxyInfo. | 1376 // possibly modifying the ProxyInfo. |
1366 if (proxy_delegate) | 1377 if (proxy_delegate) |
1367 proxy_delegate->OnResolveProxy(url, load_flags, *this, result); | 1378 proxy_delegate->OnResolveProxy(url, method, load_flags, *this, result); |
1368 | 1379 |
1369 net_log.AddEvent(NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, | 1380 net_log.AddEvent(NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, |
1370 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); | 1381 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); |
1371 | 1382 |
1372 // This check is done to only log the NetLog event when necessary, it's | 1383 // This check is done to only log the NetLog event when necessary, it's |
1373 // not a performance optimization. | 1384 // not a performance optimization. |
1374 if (!proxy_retry_info_.empty()) { | 1385 if (!proxy_retry_info_.empty()) { |
1375 result->DeprioritizeBadProxies(proxy_retry_info_); | 1386 result->DeprioritizeBadProxies(proxy_retry_info_); |
1376 net_log.AddEvent( | 1387 net_log.AddEvent( |
1377 NetLog::TYPE_PROXY_SERVICE_DEPRIORITIZED_BAD_PROXIES, | 1388 NetLog::TYPE_PROXY_SERVICE_DEPRIORITIZED_BAD_PROXIES, |
(...skipping 11 matching lines...) Expand all Loading... | |
1389 // This implicit fall-back to direct matches Firefox 3.5 and | 1400 // This implicit fall-back to direct matches Firefox 3.5 and |
1390 // Internet Explorer 8. For more information, see: | 1401 // Internet Explorer 8. For more information, see: |
1391 // | 1402 // |
1392 // http://www.chromium.org/developers/design-documents/proxy-settings-fall back | 1403 // http://www.chromium.org/developers/design-documents/proxy-settings-fall back |
1393 result->UseDirect(); | 1404 result->UseDirect(); |
1394 result_code = OK; | 1405 result_code = OK; |
1395 | 1406 |
1396 // Allow the proxy delegate to interpose on the resolution decision, | 1407 // Allow the proxy delegate to interpose on the resolution decision, |
1397 // possibly modifying the ProxyInfo. | 1408 // possibly modifying the ProxyInfo. |
1398 if (proxy_delegate) | 1409 if (proxy_delegate) |
1399 proxy_delegate->OnResolveProxy(url, load_flags, *this, result); | 1410 proxy_delegate->OnResolveProxy(url, method, load_flags, *this, result); |
1400 } else { | 1411 } else { |
1401 result_code = ERR_MANDATORY_PROXY_CONFIGURATION_FAILED; | 1412 result_code = ERR_MANDATORY_PROXY_CONFIGURATION_FAILED; |
1402 } | 1413 } |
1403 if (reset_config) { | 1414 if (reset_config) { |
1404 ResetProxyConfig(false); | 1415 ResetProxyConfig(false); |
1405 // If the ProxyResolver crashed, force it to be re-initialized for the | 1416 // If the ProxyResolver crashed, force it to be re-initialized for the |
1406 // next request by resetting the proxy config. If there are other pending | 1417 // next request by resetting the proxy config. If there are other pending |
1407 // requests, trigger the recreation immediately so those requests retry. | 1418 // requests, trigger the recreation immediately so those requests retry. |
1408 if (pending_requests_.size() > 1) | 1419 if (pending_requests_.size() > 1) |
1409 ApplyProxyConfigIfAvailable(); | 1420 ApplyProxyConfigIfAvailable(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1622 State previous_state = ResetProxyConfig(false); | 1633 State previous_state = ResetProxyConfig(false); |
1623 if (previous_state != STATE_NONE) | 1634 if (previous_state != STATE_NONE) |
1624 ApplyProxyConfigIfAvailable(); | 1635 ApplyProxyConfigIfAvailable(); |
1625 } | 1636 } |
1626 | 1637 |
1627 void ProxyService::OnDNSChanged() { | 1638 void ProxyService::OnDNSChanged() { |
1628 OnIPAddressChanged(); | 1639 OnIPAddressChanged(); |
1629 } | 1640 } |
1630 | 1641 |
1631 } // namespace net | 1642 } // namespace net |
OLD | NEW |