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 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
764 | 764 |
765 class ProxyService::PacRequest | 765 class ProxyService::PacRequest |
766 : public base::RefCounted<ProxyService::PacRequest> { | 766 : public base::RefCounted<ProxyService::PacRequest> { |
767 public: | 767 public: |
768 PacRequest(ProxyService* service, | 768 PacRequest(ProxyService* service, |
769 const GURL& url, | 769 const GURL& url, |
770 int load_flags, | 770 int load_flags, |
771 ProxyDelegate* proxy_delegate, | 771 ProxyDelegate* proxy_delegate, |
772 ProxyInfo* results, | 772 ProxyInfo* results, |
773 const CompletionCallback& user_callback, | 773 const CompletionCallback& user_callback, |
774 const BoundNetLog& net_log) | 774 const BoundNetLog& net_log, |
775 const std::string& method) | |
bengr
2016/02/16 20:00:14
Move the method to just after the url.
RyanSturm
2016/02/17 21:46:11
Done.
| |
775 : service_(service), | 776 : service_(service), |
776 user_callback_(user_callback), | 777 user_callback_(user_callback), |
777 results_(results), | 778 results_(results), |
778 url_(url), | 779 url_(url), |
779 load_flags_(load_flags), | 780 load_flags_(load_flags), |
780 proxy_delegate_(proxy_delegate), | 781 proxy_delegate_(proxy_delegate), |
781 resolve_job_(NULL), | 782 resolve_job_(NULL), |
782 config_id_(ProxyConfig::kInvalidConfigID), | 783 config_id_(ProxyConfig::kInvalidConfigID), |
783 config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), | 784 config_source_(PROXY_CONFIG_SOURCE_UNKNOWN), |
784 net_log_(net_log), | 785 net_log_(net_log), |
785 creation_time_(TimeTicks::Now()) { | 786 creation_time_(TimeTicks::Now()), |
787 method_(method) { | |
786 DCHECK(!user_callback.is_null()); | 788 DCHECK(!user_callback.is_null()); |
787 } | 789 } |
788 | 790 |
789 // Starts the resolve proxy request. | 791 // Starts the resolve proxy request. |
790 int Start() { | 792 int Start() { |
791 DCHECK(!was_cancelled()); | 793 DCHECK(!was_cancelled()); |
792 DCHECK(!is_started()); | 794 DCHECK(!is_started()); |
793 | 795 |
794 DCHECK(service_->config_.is_valid()); | 796 DCHECK(service_->config_.is_valid()); |
795 | 797 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
850 | 852 |
851 // This state is cleared when resolve_job_ is set to nullptr below. | 853 // This state is cleared when resolve_job_ is set to nullptr below. |
852 bool script_executed = is_started(); | 854 bool script_executed = is_started(); |
853 | 855 |
854 // Clear |resolve_job_| so is_started() returns false while | 856 // Clear |resolve_job_| so is_started() returns false while |
855 // DidFinishResolvingProxy() runs. | 857 // DidFinishResolvingProxy() runs. |
856 resolve_job_ = nullptr; | 858 resolve_job_ = nullptr; |
857 | 859 |
858 // Note that DidFinishResolvingProxy might modify |results_|. | 860 // Note that DidFinishResolvingProxy might modify |results_|. |
859 int rv = service_->DidFinishResolvingProxy( | 861 int rv = service_->DidFinishResolvingProxy( |
860 url_, load_flags_, proxy_delegate_, results_, result_code, net_log_, | 862 url_, load_flags_, proxy_delegate_, method_, results_, result_code, |
861 creation_time_, script_executed); | 863 net_log_, creation_time_, script_executed); |
862 | 864 |
863 // Make a note in the results which configuration was in use at the | 865 // Make a note in the results which configuration was in use at the |
864 // time of the resolve. | 866 // time of the resolve. |
865 results_->config_id_ = config_id_; | 867 results_->config_id_ = config_id_; |
866 results_->config_source_ = config_source_; | 868 results_->config_source_ = config_source_; |
867 results_->did_use_pac_script_ = true; | 869 results_->did_use_pac_script_ = true; |
868 results_->proxy_resolve_start_time_ = creation_time_; | 870 results_->proxy_resolve_start_time_ = creation_time_; |
869 results_->proxy_resolve_end_time_ = TimeTicks::Now(); | 871 results_->proxy_resolve_end_time_ = TimeTicks::Now(); |
870 | 872 |
871 // Reset the state associated with in-progress-resolve. | 873 // Reset the state associated with in-progress-resolve. |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
912 GURL url_; | 914 GURL url_; |
913 int load_flags_; | 915 int load_flags_; |
914 ProxyDelegate* proxy_delegate_; | 916 ProxyDelegate* proxy_delegate_; |
915 ProxyResolver::RequestHandle resolve_job_; | 917 ProxyResolver::RequestHandle resolve_job_; |
916 ProxyConfig::ID config_id_; // The config id when the resolve was started. | 918 ProxyConfig::ID config_id_; // The config id when the resolve was started. |
917 ProxyConfigSource config_source_; // The source of proxy settings. | 919 ProxyConfigSource config_source_; // The source of proxy settings. |
918 BoundNetLog net_log_; | 920 BoundNetLog net_log_; |
919 // Time when the request was created. Stored here rather than in |results_| | 921 // Time when the request was created. Stored here rather than in |results_| |
920 // because the time in |results_| will be cleared. | 922 // because the time in |results_| will be cleared. |
921 TimeTicks creation_time_; | 923 TimeTicks creation_time_; |
924 std::string method_; | |
bengr
2016/02/16 20:00:14
Move this up to before load_flags_ so as to group
RyanSturm
2016/02/17 21:46:11
Done.
| |
922 }; | 925 }; |
923 | 926 |
924 // ProxyService --------------------------------------------------------------- | 927 // ProxyService --------------------------------------------------------------- |
925 | 928 |
926 ProxyService::ProxyService(scoped_ptr<ProxyConfigService> config_service, | 929 ProxyService::ProxyService(scoped_ptr<ProxyConfigService> config_service, |
927 scoped_ptr<ProxyResolverFactory> resolver_factory, | 930 scoped_ptr<ProxyResolverFactory> resolver_factory, |
928 NetLog* net_log) | 931 NetLog* net_log) |
929 : resolver_factory_(std::move(resolver_factory)), | 932 : resolver_factory_(std::move(resolver_factory)), |
930 next_config_id_(1), | 933 next_config_id_(1), |
931 current_state_(STATE_NONE), | 934 current_state_(STATE_NONE), |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1007 std::move(proxy_config_service), | 1010 std::move(proxy_config_service), |
1008 make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL)); | 1011 make_scoped_ptr(new ProxyResolverFactoryForPacResult(pac_string)), NULL)); |
1009 } | 1012 } |
1010 | 1013 |
1011 int ProxyService::ResolveProxy(const GURL& raw_url, | 1014 int ProxyService::ResolveProxy(const GURL& raw_url, |
1012 int load_flags, | 1015 int load_flags, |
1013 ProxyInfo* result, | 1016 ProxyInfo* result, |
1014 const CompletionCallback& callback, | 1017 const CompletionCallback& callback, |
1015 PacRequest** pac_request, | 1018 PacRequest** pac_request, |
1016 ProxyDelegate* proxy_delegate, | 1019 ProxyDelegate* proxy_delegate, |
1020 const std::string& method, | |
bengr
2016/02/16 20:00:14
Move the method to just after the url.
RyanSturm
2016/02/17 21:46:12
Done.
| |
1017 const BoundNetLog& net_log) { | 1021 const BoundNetLog& net_log) { |
1018 DCHECK(!callback.is_null()); | 1022 DCHECK(!callback.is_null()); |
1019 return ResolveProxyHelper(raw_url, load_flags, result, callback, pac_request, | 1023 return ResolveProxyHelper(raw_url, load_flags, result, callback, pac_request, |
1020 proxy_delegate, net_log); | 1024 proxy_delegate, method, net_log); |
1021 } | 1025 } |
1022 | 1026 |
1023 int ProxyService::ResolveProxyHelper(const GURL& raw_url, | 1027 int ProxyService::ResolveProxyHelper(const GURL& raw_url, |
1024 int load_flags, | 1028 int load_flags, |
1025 ProxyInfo* result, | 1029 ProxyInfo* result, |
1026 const CompletionCallback& callback, | 1030 const CompletionCallback& callback, |
1027 PacRequest** pac_request, | 1031 PacRequest** pac_request, |
1028 ProxyDelegate* proxy_delegate, | 1032 ProxyDelegate* proxy_delegate, |
1033 const std::string& method, | |
bengr
2016/02/16 20:00:14
Move the method to just after the url.
RyanSturm
2016/02/17 21:46:12
Done.
| |
1029 const BoundNetLog& net_log) { | 1034 const BoundNetLog& net_log) { |
1035 DCHECK((proxy_delegate && !method.empty()) || !proxy_delegate); | |
1030 DCHECK(CalledOnValidThread()); | 1036 DCHECK(CalledOnValidThread()); |
1031 | 1037 |
1032 net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE); | 1038 net_log.BeginEvent(NetLog::TYPE_PROXY_SERVICE); |
1033 | 1039 |
1034 // Notify our polling-based dependencies that a resolve is taking place. | 1040 // Notify our polling-based dependencies that a resolve is taking place. |
1035 // This way they can schedule their polls in response to network activity. | 1041 // This way they can schedule their polls in response to network activity. |
1036 config_service_->OnLazyPoll(); | 1042 config_service_->OnLazyPoll(); |
1037 if (script_poller_.get()) | 1043 if (script_poller_.get()) |
1038 script_poller_->OnLazyPoll(); | 1044 script_poller_->OnLazyPoll(); |
1039 | 1045 |
1040 if (current_state_ == STATE_NONE) | 1046 if (current_state_ == STATE_NONE) |
1041 ApplyProxyConfigIfAvailable(); | 1047 ApplyProxyConfigIfAvailable(); |
1042 | 1048 |
1043 // Strip away any reference fragments and the username/password, as they | 1049 // Strip away any reference fragments and the username/password, as they |
1044 // are not relevant to proxy resolution. | 1050 // are not relevant to proxy resolution. |
1045 GURL url = SimplifyUrlForRequest(raw_url); | 1051 GURL url = SimplifyUrlForRequest(raw_url); |
1046 | 1052 |
1047 // Check if the request can be completed right away. (This is the case when | 1053 // Check if the request can be completed right away. (This is the case when |
1048 // using a direct connection for example). | 1054 // using a direct connection for example). |
1049 int rv = TryToCompleteSynchronously(url, load_flags, proxy_delegate, result); | 1055 int rv = TryToCompleteSynchronously(url, load_flags, proxy_delegate, result); |
1050 if (rv != ERR_IO_PENDING) { | 1056 if (rv != ERR_IO_PENDING) { |
1051 rv = DidFinishResolvingProxy( | 1057 rv = DidFinishResolvingProxy( |
1052 url, load_flags, proxy_delegate, result, rv, net_log, | 1058 url, load_flags, proxy_delegate, method, result, rv, net_log, |
1053 callback.is_null() ? TimeTicks() : TimeTicks::Now(), false); | 1059 callback.is_null() ? TimeTicks() : TimeTicks::Now(), false); |
1054 return rv; | 1060 return rv; |
1055 } | 1061 } |
1056 | 1062 |
1057 if (callback.is_null()) | 1063 if (callback.is_null()) |
1058 return ERR_IO_PENDING; | 1064 return ERR_IO_PENDING; |
1059 | 1065 |
1060 scoped_refptr<PacRequest> req(new PacRequest( | 1066 scoped_refptr<PacRequest> req(new PacRequest(this, url, load_flags, |
1061 this, url, load_flags, proxy_delegate, result, callback, net_log)); | 1067 proxy_delegate, result, callback, |
1068 net_log, method)); | |
1062 | 1069 |
1063 if (current_state_ == STATE_READY) { | 1070 if (current_state_ == STATE_READY) { |
1064 // Start the resolve request. | 1071 // Start the resolve request. |
1065 rv = req->Start(); | 1072 rv = req->Start(); |
1066 if (rv != ERR_IO_PENDING) | 1073 if (rv != ERR_IO_PENDING) |
1067 return req->QueryDidComplete(rv); | 1074 return req->QueryDidComplete(rv); |
1068 } else { | 1075 } else { |
1069 req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC); | 1076 req->net_log()->BeginEvent(NetLog::TYPE_PROXY_SERVICE_WAITING_FOR_INIT_PAC); |
1070 } | 1077 } |
1071 | 1078 |
1072 DCHECK_EQ(ERR_IO_PENDING, rv); | 1079 DCHECK_EQ(ERR_IO_PENDING, rv); |
1073 DCHECK(!ContainsPendingRequest(req.get())); | 1080 DCHECK(!ContainsPendingRequest(req.get())); |
1074 pending_requests_.insert(req); | 1081 pending_requests_.insert(req); |
1075 | 1082 |
1076 // Completion will be notified through |callback|, unless the caller cancels | 1083 // Completion will be notified through |callback|, unless the caller cancels |
1077 // the request using |pac_request|. | 1084 // the request using |pac_request|. |
1078 if (pac_request) | 1085 if (pac_request) |
1079 *pac_request = req.get(); | 1086 *pac_request = req.get(); |
1080 return rv; // ERR_IO_PENDING | 1087 return rv; // ERR_IO_PENDING |
1081 } | 1088 } |
1082 | 1089 |
1083 bool ProxyService::TryResolveProxySynchronously(const GURL& raw_url, | 1090 bool ProxyService::TryResolveProxySynchronously(const GURL& raw_url, |
1084 int load_flags, | 1091 int load_flags, |
1085 ProxyInfo* result, | 1092 ProxyInfo* result, |
1086 ProxyDelegate* proxy_delegate, | 1093 ProxyDelegate* proxy_delegate, |
1094 const std::string& method, | |
bengr
2016/02/16 20:00:14
Move the method to just after the url.
RyanSturm
2016/02/17 21:46:11
Done.
| |
1087 const BoundNetLog& net_log) { | 1095 const BoundNetLog& net_log) { |
1088 CompletionCallback null_callback; | 1096 CompletionCallback null_callback; |
1089 return ResolveProxyHelper(raw_url, load_flags, result, null_callback, | 1097 return ResolveProxyHelper(raw_url, load_flags, result, null_callback, |
1090 nullptr /* pac_request*/, proxy_delegate, | 1098 nullptr /* pac_request*/, proxy_delegate, method, |
1091 net_log) == OK; | 1099 net_log) == OK; |
1092 } | 1100 } |
1093 | 1101 |
1094 int ProxyService::TryToCompleteSynchronously(const GURL& url, | 1102 int ProxyService::TryToCompleteSynchronously(const GURL& url, |
1095 int load_flags, | 1103 int load_flags, |
1096 ProxyDelegate* proxy_delegate, | 1104 ProxyDelegate* proxy_delegate, |
1097 ProxyInfo* result) { | 1105 ProxyInfo* result) { |
1098 DCHECK_NE(STATE_NONE, current_state_); | 1106 DCHECK_NE(STATE_NONE, current_state_); |
1099 | 1107 |
1100 if (current_state_ != STATE_READY) | 1108 if (current_state_ != STATE_READY) |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1245 SetReady(); | 1253 SetReady(); |
1246 } | 1254 } |
1247 | 1255 |
1248 int ProxyService::ReconsiderProxyAfterError(const GURL& url, | 1256 int ProxyService::ReconsiderProxyAfterError(const GURL& url, |
1249 int load_flags, | 1257 int load_flags, |
1250 int net_error, | 1258 int net_error, |
1251 ProxyInfo* result, | 1259 ProxyInfo* result, |
1252 const CompletionCallback& callback, | 1260 const CompletionCallback& callback, |
1253 PacRequest** pac_request, | 1261 PacRequest** pac_request, |
1254 ProxyDelegate* proxy_delegate, | 1262 ProxyDelegate* proxy_delegate, |
1263 const std::string& method, | |
bengr
2016/02/16 20:00:14
Move the method to just after the url.
RyanSturm
2016/02/17 21:46:12
Done.
| |
1255 const BoundNetLog& net_log) { | 1264 const BoundNetLog& net_log) { |
1256 DCHECK(CalledOnValidThread()); | 1265 DCHECK(CalledOnValidThread()); |
1257 | 1266 |
1258 // Check to see if we have a new config since ResolveProxy was called. We | 1267 // Check to see if we have a new config since ResolveProxy was called. We |
1259 // want to re-run ResolveProxy in two cases: 1) we have a new config, or 2) a | 1268 // want to re-run ResolveProxy in two cases: 1) we have a new config, or 2) a |
1260 // direct connection failed and we never tried the current config. | 1269 // direct connection failed and we never tried the current config. |
1261 | 1270 |
1262 DCHECK(result); | 1271 DCHECK(result); |
1263 bool re_resolve = result->config_id_ != config_.id(); | 1272 bool re_resolve = result->config_id_ != config_.id(); |
1264 | 1273 |
1265 if (re_resolve) { | 1274 if (re_resolve) { |
1266 // If we have a new config or the config was never tried, we delete the | 1275 // If we have a new config or the config was never tried, we delete the |
1267 // list of bad proxies and we try again. | 1276 // list of bad proxies and we try again. |
1268 proxy_retry_info_.clear(); | 1277 proxy_retry_info_.clear(); |
1269 return ResolveProxy(url, load_flags, result, callback, pac_request, | 1278 return ResolveProxy(url, load_flags, result, callback, pac_request, |
1270 proxy_delegate, net_log); | 1279 proxy_delegate, method, net_log); |
1271 } | 1280 } |
1272 | 1281 |
1273 DCHECK(!result->is_empty()); | 1282 DCHECK(!result->is_empty()); |
1274 ProxyServer bad_proxy = result->proxy_server(); | 1283 ProxyServer bad_proxy = result->proxy_server(); |
1275 | 1284 |
1276 // We don't have new proxy settings to try, try to fallback to the next proxy | 1285 // We don't have new proxy settings to try, try to fallback to the next proxy |
1277 // in the list. | 1286 // in the list. |
1278 bool did_fallback = result->Fallback(net_error, net_log); | 1287 bool did_fallback = result->Fallback(net_error, net_log); |
1279 | 1288 |
1280 // Return synchronous failure if there is nothing left to fall-back to. | 1289 // Return synchronous failure if there is nothing left to fall-back to. |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1342 } | 1351 } |
1343 | 1352 |
1344 void ProxyService::RemovePendingRequest(PacRequest* req) { | 1353 void ProxyService::RemovePendingRequest(PacRequest* req) { |
1345 DCHECK(ContainsPendingRequest(req)); | 1354 DCHECK(ContainsPendingRequest(req)); |
1346 pending_requests_.erase(req); | 1355 pending_requests_.erase(req); |
1347 } | 1356 } |
1348 | 1357 |
1349 int ProxyService::DidFinishResolvingProxy(const GURL& url, | 1358 int ProxyService::DidFinishResolvingProxy(const GURL& url, |
1350 int load_flags, | 1359 int load_flags, |
1351 ProxyDelegate* proxy_delegate, | 1360 ProxyDelegate* proxy_delegate, |
1361 const std::string& method, | |
bengr
2016/02/16 20:00:14
Move the method to just after the url.
RyanSturm
2016/02/17 21:46:12
Done.
| |
1352 ProxyInfo* result, | 1362 ProxyInfo* result, |
1353 int result_code, | 1363 int result_code, |
1354 const BoundNetLog& net_log, | 1364 const BoundNetLog& net_log, |
1355 base::TimeTicks start_time, | 1365 base::TimeTicks start_time, |
1356 bool script_executed) { | 1366 bool script_executed) { |
1357 // Don't track any metrics if start_time is 0, which will happen when the user | 1367 // Don't track any metrics if start_time is 0, which will happen when the user |
1358 // calls |TryResolveProxySynchronously|. | 1368 // calls |TryResolveProxySynchronously|. |
1359 if (!start_time.is_null()) { | 1369 if (!start_time.is_null()) { |
1360 TimeDelta diff = TimeTicks::Now() - start_time; | 1370 TimeDelta diff = TimeTicks::Now() - start_time; |
1361 if (script_executed) { | 1371 if (script_executed) { |
1362 // This function "fixes" the result code, so make sure script terminated | 1372 // This function "fixes" the result code, so make sure script terminated |
1363 // errors are tracked. Only track result codes that were a result of | 1373 // errors are tracked. Only track result codes that were a result of |
1364 // script execution. | 1374 // script execution. |
1365 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ScriptTerminated", | 1375 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ScriptTerminated", |
1366 result_code == ERR_PAC_SCRIPT_TERMINATED); | 1376 result_code == ERR_PAC_SCRIPT_TERMINATED); |
1367 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.GetProxyUsingScriptTime", | 1377 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.GetProxyUsingScriptTime", |
1368 diff, base::TimeDelta::FromMicroseconds(100), | 1378 diff, base::TimeDelta::FromMicroseconds(100), |
1369 base::TimeDelta::FromSeconds(20), 50); | 1379 base::TimeDelta::FromSeconds(20), 50); |
1370 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ProxyService.GetProxyUsingScriptResult", | 1380 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.ProxyService.GetProxyUsingScriptResult", |
1371 std::abs(result_code)); | 1381 std::abs(result_code)); |
1372 } | 1382 } |
1373 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ResolvedUsingScript", | 1383 UMA_HISTOGRAM_BOOLEAN("Net.ProxyService.ResolvedUsingScript", |
1374 script_executed); | 1384 script_executed); |
1375 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.ResolveProxyTime", diff, | 1385 UMA_HISTOGRAM_CUSTOM_TIMES("Net.ProxyService.ResolveProxyTime", diff, |
1376 base::TimeDelta::FromMicroseconds(100), | 1386 base::TimeDelta::FromMicroseconds(100), |
1377 base::TimeDelta::FromSeconds(20), 50); | 1387 base::TimeDelta::FromSeconds(20), 50); |
1378 } | 1388 } |
1389 | |
1379 // Log the result of the proxy resolution. | 1390 // Log the result of the proxy resolution. |
1380 if (result_code == OK) { | 1391 if (result_code == OK) { |
1381 // Allow the proxy delegate to interpose on the resolution decision, | 1392 // Allow the proxy delegate to interpose on the resolution decision, |
1382 // possibly modifying the ProxyInfo. | 1393 // possibly modifying the ProxyInfo. |
1383 if (proxy_delegate) | 1394 if (proxy_delegate) |
1384 proxy_delegate->OnResolveProxy(url, load_flags, *this, result); | 1395 proxy_delegate->OnResolveProxy(url, load_flags, *this, method, result); |
1385 | 1396 |
1386 net_log.AddEvent(NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, | 1397 net_log.AddEvent(NetLog::TYPE_PROXY_SERVICE_RESOLVED_PROXY_LIST, |
1387 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); | 1398 base::Bind(&NetLogFinishedResolvingProxyCallback, result)); |
1388 | 1399 |
1389 // This check is done to only log the NetLog event when necessary, it's | 1400 // This check is done to only log the NetLog event when necessary, it's |
1390 // not a performance optimization. | 1401 // not a performance optimization. |
1391 if (!proxy_retry_info_.empty()) { | 1402 if (!proxy_retry_info_.empty()) { |
1392 result->DeprioritizeBadProxies(proxy_retry_info_); | 1403 result->DeprioritizeBadProxies(proxy_retry_info_); |
1393 net_log.AddEvent( | 1404 net_log.AddEvent( |
1394 NetLog::TYPE_PROXY_SERVICE_DEPRIORITIZED_BAD_PROXIES, | 1405 NetLog::TYPE_PROXY_SERVICE_DEPRIORITIZED_BAD_PROXIES, |
(...skipping 11 matching lines...) Expand all Loading... | |
1406 // This implicit fall-back to direct matches Firefox 3.5 and | 1417 // This implicit fall-back to direct matches Firefox 3.5 and |
1407 // Internet Explorer 8. For more information, see: | 1418 // Internet Explorer 8. For more information, see: |
1408 // | 1419 // |
1409 // http://www.chromium.org/developers/design-documents/proxy-settings-fall back | 1420 // http://www.chromium.org/developers/design-documents/proxy-settings-fall back |
1410 result->UseDirect(); | 1421 result->UseDirect(); |
1411 result_code = OK; | 1422 result_code = OK; |
1412 | 1423 |
1413 // Allow the proxy delegate to interpose on the resolution decision, | 1424 // Allow the proxy delegate to interpose on the resolution decision, |
1414 // possibly modifying the ProxyInfo. | 1425 // possibly modifying the ProxyInfo. |
1415 if (proxy_delegate) | 1426 if (proxy_delegate) |
1416 proxy_delegate->OnResolveProxy(url, load_flags, *this, result); | 1427 proxy_delegate->OnResolveProxy(url, load_flags, *this, method, result); |
1417 } else { | 1428 } else { |
1418 result_code = ERR_MANDATORY_PROXY_CONFIGURATION_FAILED; | 1429 result_code = ERR_MANDATORY_PROXY_CONFIGURATION_FAILED; |
1419 } | 1430 } |
1420 if (reset_config) { | 1431 if (reset_config) { |
1421 ResetProxyConfig(false); | 1432 ResetProxyConfig(false); |
1422 // If the ProxyResolver crashed, force it to be re-initialized for the | 1433 // If the ProxyResolver crashed, force it to be re-initialized for the |
1423 // next request by resetting the proxy config. If there are other pending | 1434 // next request by resetting the proxy config. If there are other pending |
1424 // requests, trigger the recreation immediately so those requests retry. | 1435 // requests, trigger the recreation immediately so those requests retry. |
1425 if (pending_requests_.size() > 1) | 1436 if (pending_requests_.size() > 1) |
1426 ApplyProxyConfigIfAvailable(); | 1437 ApplyProxyConfigIfAvailable(); |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1639 State previous_state = ResetProxyConfig(false); | 1650 State previous_state = ResetProxyConfig(false); |
1640 if (previous_state != STATE_NONE) | 1651 if (previous_state != STATE_NONE) |
1641 ApplyProxyConfigIfAvailable(); | 1652 ApplyProxyConfigIfAvailable(); |
1642 } | 1653 } |
1643 | 1654 |
1644 void ProxyService::OnDNSChanged() { | 1655 void ProxyService::OnDNSChanged() { |
1645 OnIPAddressChanged(); | 1656 OnIPAddressChanged(); |
1646 } | 1657 } |
1647 | 1658 |
1648 } // namespace net | 1659 } // namespace net |
OLD | NEW |