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 876 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
887 void HttpStreamFactoryImpl::JobController::MaybeNotifyFactoryOfCompletion() { | 887 void HttpStreamFactoryImpl::JobController::MaybeNotifyFactoryOfCompletion() { |
888 if (!request_ && !main_job_ && !alternative_job_) { | 888 if (!request_ && !main_job_ && !alternative_job_) { |
889 DCHECK(!bound_job_); | 889 DCHECK(!bound_job_); |
890 factory_->OnJobControllerComplete(this); | 890 factory_->OnJobControllerComplete(this); |
891 } | 891 } |
892 } | 892 } |
893 | 893 |
894 GURL HttpStreamFactoryImpl::JobController::ApplyHostMappingRules( | 894 GURL HttpStreamFactoryImpl::JobController::ApplyHostMappingRules( |
895 const GURL& url, | 895 const GURL& url, |
896 HostPortPair* endpoint) { | 896 HostPortPair* endpoint) { |
897 const HostMappingRules* mapping_rules = session_->params().host_mapping_rules; | 897 const HostMappingRules* mapping_rules = |
898 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) { | 898 &session_->params().host_mapping_rules; |
899 if (mapping_rules->RewriteHost(endpoint)) { | |
Randy Smith (Not in Mondays)
2017/05/25 17:50:48
nit, suggestion: This might all fit on one line wi
mmenke
2017/05/25 18:07:10
Done.
| |
899 url::Replacements<char> replacements; | 900 url::Replacements<char> replacements; |
900 const std::string port_str = base::UintToString(endpoint->port()); | 901 const std::string port_str = base::UintToString(endpoint->port()); |
901 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); | 902 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); |
902 replacements.SetHost(endpoint->host().c_str(), | 903 replacements.SetHost(endpoint->host().c_str(), |
903 url::Component(0, endpoint->host().size())); | 904 url::Component(0, endpoint->host().size())); |
904 return url.ReplaceComponents(replacements); | 905 return url.ReplaceComponents(replacements); |
905 } | 906 } |
906 return url; | 907 return url; |
907 } | 908 } |
908 | 909 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1140 return; | 1141 return; |
1141 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1142 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
1142 alternative_job_->Start(request_->stream_type()); | 1143 alternative_job_->Start(request_->stream_type()); |
1143 } | 1144 } |
1144 | 1145 |
1145 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1146 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
1146 return !request_ || (job_bound_ && bound_job_ != job); | 1147 return !request_ || (job_bound_ && bound_job_ != job); |
1147 } | 1148 } |
1148 | 1149 |
1149 } // namespace net | 1150 } // namespace net |
OLD | NEW |