OLD | NEW |
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2016 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/http/http_stream_factory_impl_job_controller.h" | 5 #include "net/http/http_stream_factory_impl_job_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
862 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.AlternateServiceFailed", | 862 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.AlternateServiceFailed", |
863 -alternative_job_net_error_); | 863 -alternative_job_net_error_); |
864 | 864 |
865 if (alternative_job_net_error_ == ERR_NETWORK_CHANGED || | 865 if (alternative_job_net_error_ == ERR_NETWORK_CHANGED || |
866 alternative_job_net_error_ == ERR_INTERNET_DISCONNECTED) { | 866 alternative_job_net_error_ == ERR_INTERNET_DISCONNECTED) { |
867 // No need to mark alternative service or proxy as broken. | 867 // No need to mark alternative service or proxy as broken. |
868 return; | 868 return; |
869 } | 869 } |
870 | 870 |
871 if (failed_alternative_proxy_server_.is_valid()) { | 871 if (failed_alternative_proxy_server_.is_valid()) { |
872 ProxyDelegate* proxy_delegate = session_->params().proxy_delegate; | 872 ProxyDelegate* proxy_delegate = session_->context().proxy_delegate; |
873 if (proxy_delegate) { | 873 if (proxy_delegate) { |
874 proxy_delegate->OnAlternativeProxyBroken( | 874 proxy_delegate->OnAlternativeProxyBroken( |
875 failed_alternative_proxy_server_); | 875 failed_alternative_proxy_server_); |
876 } | 876 } |
877 } else { | 877 } else { |
878 HistogramBrokenAlternateProtocolLocation( | 878 HistogramBrokenAlternateProtocolLocation( |
879 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT); | 879 BROKEN_ALTERNATE_PROTOCOL_LOCATION_HTTP_STREAM_FACTORY_IMPL_JOB_ALT); |
880 session_->http_server_properties()->MarkAlternativeServiceBroken( | 880 session_->http_server_properties()->MarkAlternativeServiceBroken( |
881 failed_alternative_service_); | 881 failed_alternative_service_); |
882 } | 882 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 return false; | 1074 return false; |
1075 } | 1075 } |
1076 | 1076 |
1077 if (!url.SchemeIs(url::kHttpScheme)) { | 1077 if (!url.SchemeIs(url::kHttpScheme)) { |
1078 // Only HTTP URLs can be fetched through alternative proxy server, since the | 1078 // Only HTTP URLs can be fetched through alternative proxy server, since the |
1079 // alternative proxy server may not support fetching of URLs with other | 1079 // alternative proxy server may not support fetching of URLs with other |
1080 // schemes. | 1080 // schemes. |
1081 return false; | 1081 return false; |
1082 } | 1082 } |
1083 | 1083 |
1084 ProxyDelegate* proxy_delegate = session_->params().proxy_delegate; | 1084 ProxyDelegate* proxy_delegate = session_->context().proxy_delegate; |
1085 if (!proxy_delegate) | 1085 if (!proxy_delegate) |
1086 return false; | 1086 return false; |
1087 | 1087 |
1088 proxy_delegate->GetAlternativeProxy(url, proxy_info.proxy_server(), | 1088 proxy_delegate->GetAlternativeProxy(url, proxy_info.proxy_server(), |
1089 alternative_proxy_server); | 1089 alternative_proxy_server); |
1090 | 1090 |
1091 if (!alternative_proxy_server->is_valid()) | 1091 if (!alternative_proxy_server->is_valid()) |
1092 return false; | 1092 return false; |
1093 | 1093 |
1094 DCHECK(!(*alternative_proxy_server == proxy_info.proxy_server())); | 1094 DCHECK(!(*alternative_proxy_server == proxy_info.proxy_server())); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1137 return; | 1137 return; |
1138 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1138 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
1139 alternative_job_->Start(request_->stream_type()); | 1139 alternative_job_->Start(request_->stream_type()); |
1140 } | 1140 } |
1141 | 1141 |
1142 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1142 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
1143 return !request_ || (job_bound_ && bound_job_ != job); | 1143 return !request_ || (job_bound_ && bound_job_ != job); |
1144 } | 1144 } |
1145 | 1145 |
1146 } // namespace net | 1146 } // namespace net |
OLD | NEW |