| 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/http/http_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
| 6 | 6 |
| 7 #include "base/string_number_conversions.h" | 7 #include "base/string_number_conversions.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "googleurl/src/gurl.h" | 9 #include "googleurl/src/gurl.h" |
| 10 #include "net/base/net_log.h" | 10 #include "net/base/net_log.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 GURL alternate_url; | 66 GURL alternate_url; |
| 67 bool has_alternate_protocol = | 67 bool has_alternate_protocol = |
| 68 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); | 68 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); |
| 69 Job* alternate_job = NULL; | 69 Job* alternate_job = NULL; |
| 70 if (has_alternate_protocol) { | 70 if (has_alternate_protocol) { |
| 71 HttpRequestInfo alternate_request_info = request_info; | 71 HttpRequestInfo alternate_request_info = request_info; |
| 72 alternate_request_info.url = alternate_url; | 72 alternate_request_info.url = alternate_url; |
| 73 alternate_job = | 73 alternate_job = |
| 74 new Job(this, session_, alternate_request_info, server_ssl_config, | 74 new Job(this, session_, alternate_request_info, server_ssl_config, |
| 75 proxy_ssl_config, net_log); | 75 proxy_ssl_config, net_log.net_log()); |
| 76 request->AttachJob(alternate_job); | 76 request->AttachJob(alternate_job); |
| 77 alternate_job->MarkAsAlternate(request_info.url); | 77 alternate_job->MarkAsAlternate(request_info.url); |
| 78 } | 78 } |
| 79 | 79 |
| 80 Job* job = new Job(this, session_, request_info, server_ssl_config, | 80 Job* job = new Job(this, session_, request_info, server_ssl_config, |
| 81 proxy_ssl_config, net_log); | 81 proxy_ssl_config, net_log.net_log()); |
| 82 request->AttachJob(job); | 82 request->AttachJob(job); |
| 83 if (alternate_job) { | 83 if (alternate_job) { |
| 84 job->WaitFor(alternate_job); | 84 job->WaitFor(alternate_job); |
| 85 // Make sure to wait until we call WaitFor(), before starting | 85 // Make sure to wait until we call WaitFor(), before starting |
| 86 // |alternate_job|, otherwise |alternate_job| will not notify |job| | 86 // |alternate_job|, otherwise |alternate_job| will not notify |job| |
| 87 // appropriately. | 87 // appropriately. |
| 88 alternate_job->Start(request); | 88 alternate_job->Start(request); |
| 89 } | 89 } |
| 90 // Even if |alternate_job| has already finished, it won't have notified the | 90 // Even if |alternate_job| has already finished, it won't have notified the |
| 91 // request yet, since we defer that to the next iteration of the MessageLoop, | 91 // request yet, since we defer that to the next iteration of the MessageLoop, |
| 92 // so starting |job| is always safe. | 92 // so starting |job| is always safe. |
| 93 job->Start(request); | 93 job->Start(request); |
| 94 return request; | 94 return request; |
| 95 } | 95 } |
| 96 | 96 |
| 97 void HttpStreamFactoryImpl::PreconnectStreams( | 97 void HttpStreamFactoryImpl::PreconnectStreams( |
| 98 int num_streams, | 98 int num_streams, |
| 99 const HttpRequestInfo& request_info, | 99 const HttpRequestInfo& request_info, |
| 100 const SSLConfig& server_ssl_config, | 100 const SSLConfig& server_ssl_config, |
| 101 const SSLConfig& proxy_ssl_config, | 101 const SSLConfig& proxy_ssl_config) { |
| 102 const BoundNetLog& net_log) { | |
| 103 GURL alternate_url; | 102 GURL alternate_url; |
| 104 bool has_alternate_protocol = | 103 bool has_alternate_protocol = |
| 105 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); | 104 GetAlternateProtocolRequestFor(request_info.url, &alternate_url); |
| 106 Job* job = NULL; | 105 Job* job = NULL; |
| 107 if (has_alternate_protocol) { | 106 if (has_alternate_protocol) { |
| 108 HttpRequestInfo alternate_request_info = request_info; | 107 HttpRequestInfo alternate_request_info = request_info; |
| 109 alternate_request_info.url = alternate_url; | 108 alternate_request_info.url = alternate_url; |
| 110 job = new Job(this, session_, alternate_request_info, server_ssl_config, | 109 job = new Job(this, session_, alternate_request_info, server_ssl_config, |
| 111 proxy_ssl_config, net_log); | 110 proxy_ssl_config, session_->net_log()); |
| 112 job->MarkAsAlternate(request_info.url); | 111 job->MarkAsAlternate(request_info.url); |
| 113 } else { | 112 } else { |
| 114 job = new Job(this, session_, request_info, server_ssl_config, | 113 job = new Job(this, session_, request_info, server_ssl_config, |
| 115 proxy_ssl_config, net_log); | 114 proxy_ssl_config, session_->net_log()); |
| 116 } | 115 } |
| 117 preconnect_job_set_.insert(job); | 116 preconnect_job_set_.insert(job); |
| 118 job->Preconnect(num_streams); | 117 job->Preconnect(num_streams); |
| 119 } | 118 } |
| 120 | 119 |
| 121 void HttpStreamFactoryImpl::AddTLSIntolerantServer(const HostPortPair& server) { | 120 void HttpStreamFactoryImpl::AddTLSIntolerantServer(const HostPortPair& server) { |
| 122 tls_intolerant_servers_.insert(server); | 121 tls_intolerant_servers_.insert(server); |
| 123 } | 122 } |
| 124 | 123 |
| 125 bool HttpStreamFactoryImpl::IsTLSIntolerantServer( | 124 bool HttpStreamFactoryImpl::IsTLSIntolerantServer( |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 false, // not using_spdy | 243 false, // not using_spdy |
| 245 stream->net_log()); | 244 stream->net_log()); |
| 246 request->OnStreamReady(NULL, | 245 request->OnStreamReady(NULL, |
| 247 stream->used_ssl_config(), | 246 stream->used_ssl_config(), |
| 248 stream->used_proxy_info(), | 247 stream->used_proxy_info(), |
| 249 stream); | 248 stream); |
| 250 } | 249 } |
| 251 } | 250 } |
| 252 | 251 |
| 253 } // namespace net | 252 } // namespace net |
| OLD | NEW |