| 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 874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 void HttpStreamFactoryImpl::JobController::MaybeNotifyFactoryOfCompletion() { | 885 void HttpStreamFactoryImpl::JobController::MaybeNotifyFactoryOfCompletion() { |
| 886 if (!request_ && !main_job_ && !alternative_job_) { | 886 if (!request_ && !main_job_ && !alternative_job_) { |
| 887 DCHECK(!bound_job_); | 887 DCHECK(!bound_job_); |
| 888 factory_->OnJobControllerComplete(this); | 888 factory_->OnJobControllerComplete(this); |
| 889 } | 889 } |
| 890 } | 890 } |
| 891 | 891 |
| 892 GURL HttpStreamFactoryImpl::JobController::ApplyHostMappingRules( | 892 GURL HttpStreamFactoryImpl::JobController::ApplyHostMappingRules( |
| 893 const GURL& url, | 893 const GURL& url, |
| 894 HostPortPair* endpoint) { | 894 HostPortPair* endpoint) { |
| 895 const HostMappingRules* mapping_rules = session_->params().host_mapping_rules; | 895 if (session_->params().host_mapping_rules.RewriteHost(endpoint)) { |
| 896 if (mapping_rules && mapping_rules->RewriteHost(endpoint)) { | |
| 897 url::Replacements<char> replacements; | 896 url::Replacements<char> replacements; |
| 898 const std::string port_str = base::UintToString(endpoint->port()); | 897 const std::string port_str = base::UintToString(endpoint->port()); |
| 899 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); | 898 replacements.SetPort(port_str.c_str(), url::Component(0, port_str.size())); |
| 900 replacements.SetHost(endpoint->host().c_str(), | 899 replacements.SetHost(endpoint->host().c_str(), |
| 901 url::Component(0, endpoint->host().size())); | 900 url::Component(0, endpoint->host().size())); |
| 902 return url.ReplaceComponents(replacements); | 901 return url.ReplaceComponents(replacements); |
| 903 } | 902 } |
| 904 return url; | 903 return url; |
| 905 } | 904 } |
| 906 | 905 |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1138 return; | 1137 return; |
| 1139 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); | 1138 DCHECK(alternative_job_->alternative_proxy_server().is_valid()); |
| 1140 alternative_job_->Start(request_->stream_type()); | 1139 alternative_job_->Start(request_->stream_type()); |
| 1141 } | 1140 } |
| 1142 | 1141 |
| 1143 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { | 1142 bool HttpStreamFactoryImpl::JobController::IsJobOrphaned(Job* job) const { |
| 1144 return !request_ || (job_bound_ && bound_job_ != job); | 1143 return !request_ || (job_bound_ && bound_job_ != job); |
| 1145 } | 1144 } |
| 1146 | 1145 |
| 1147 } // namespace net | 1146 } // namespace net |
| OLD | NEW |