| 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 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
| 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include "net/base/host_port_pair.h" |
| 8 #include "net/http/http_stream_factory_impl_job.h" | 9 #include "net/http/http_stream_factory_impl_job.h" |
| 9 #include "net/http/http_stream_factory_impl_request.h" | 10 #include "net/http/http_stream_factory_impl_request.h" |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 // HttpStreamFactoryImpl::JobController manages Request and Job(s). | 14 // HttpStreamFactoryImpl::JobController manages Request and Job(s). |
| 14 class HttpStreamFactoryImpl::JobController | 15 class HttpStreamFactoryImpl::JobController |
| 15 : public HttpStreamFactoryImpl::Job::Delegate, | 16 : public HttpStreamFactoryImpl::Job::Delegate, |
| 16 public HttpStreamFactoryImpl::Request::Helper { | 17 public HttpStreamFactoryImpl::Request::Helper { |
| 17 public: | 18 public: |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 const SSLConfig& used_ssl_config, | 108 const SSLConfig& used_ssl_config, |
| 108 SSLCertRequestInfo* cert_info) override; | 109 SSLCertRequestInfo* cert_info) override; |
| 109 | 110 |
| 110 // Invoked when |job| needs proxy authentication. | 111 // Invoked when |job| needs proxy authentication. |
| 111 void OnNeedsProxyAuth(Job* job, | 112 void OnNeedsProxyAuth(Job* job, |
| 112 const HttpResponseInfo& proxy_response, | 113 const HttpResponseInfo& proxy_response, |
| 113 const SSLConfig& used_ssl_config, | 114 const SSLConfig& used_ssl_config, |
| 114 const ProxyInfo& used_proxy_info, | 115 const ProxyInfo& used_proxy_info, |
| 115 HttpAuthController* auth_controller) override; | 116 HttpAuthController* auth_controller) override; |
| 116 | 117 |
| 118 void OnResolveProxyComplete( |
| 119 Job* job, |
| 120 const HttpRequestInfo& request_info, |
| 121 RequestPriority priority, |
| 122 const SSLConfig& server_ssl_config, |
| 123 const SSLConfig& proxy_ssl_config, |
| 124 HttpStreamRequest::StreamType stream_type) override; |
| 125 |
| 117 // Invoked to notify the Request and Factory of the readiness of new | 126 // Invoked to notify the Request and Factory of the readiness of new |
| 118 // SPDY session. | 127 // SPDY session. |
| 119 void OnNewSpdySessionReady(Job* job, | 128 void OnNewSpdySessionReady(Job* job, |
| 120 const base::WeakPtr<SpdySession>& spdy_session, | 129 const base::WeakPtr<SpdySession>& spdy_session, |
| 121 bool direct) override; | 130 bool direct) override; |
| 122 | 131 |
| 123 // Invoked when the orphaned |job| finishes. | 132 // Invoked when the orphaned |job| finishes. |
| 124 void OnOrphanedJobComplete(const Job* job) override; | 133 void OnOrphanedJobComplete(const Job* job) override; |
| 125 | 134 |
| 126 // Invoked when the |job| finishes pre-connecting sockets. | 135 // Invoked when the |job| finishes pre-connecting sockets. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 HttpStreamRequest::StreamType stream_type); | 217 HttpStreamRequest::StreamType stream_type); |
| 209 | 218 |
| 210 AlternativeService GetAlternativeServiceForInternal( | 219 AlternativeService GetAlternativeServiceForInternal( |
| 211 const HttpRequestInfo& request_info, | 220 const HttpRequestInfo& request_info, |
| 212 HttpStreamRequest::Delegate* delegate, | 221 HttpStreamRequest::Delegate* delegate, |
| 213 HttpStreamRequest::StreamType stream_type); | 222 HttpStreamRequest::StreamType stream_type); |
| 214 | 223 |
| 215 // Remove session from the SpdySessionRequestMap. | 224 // Remove session from the SpdySessionRequestMap. |
| 216 void RemoveRequestFromSpdySessionRequestMap(); | 225 void RemoveRequestFromSpdySessionRequestMap(); |
| 217 | 226 |
| 227 // Returns true if the |request_| can be fetched via an alternative |
| 228 // proxy server, and sets |alternative_proxy_server| to the available |
| 229 // alternative proxy server. |alternative_proxy_server| should not be null, |
| 230 // and is owned by the caller. |
| 231 bool ShouldCreateAlternativeProxyServerJob( |
| 232 Job* job, |
| 233 const ProxyInfo& proxy_info_, |
| 234 const GURL& url, |
| 235 ProxyServer* alternative_proxy_server) const; |
| 236 |
| 218 HttpStreamFactoryImpl* factory_; | 237 HttpStreamFactoryImpl* factory_; |
| 219 HttpNetworkSession* session_; | 238 HttpNetworkSession* session_; |
| 220 JobFactory* job_factory_; | 239 JobFactory* job_factory_; |
| 221 | 240 |
| 222 // Request will be handed out to factory once created. This just keeps an | 241 // Request will be handed out to factory once created. This just keeps an |
| 223 // reference and is safe as |request_| will notify |this| JobController | 242 // reference and is safe as |request_| will notify |this| JobController |
| 224 // when it's destructed by calling OnRequestComplete(), which nulls | 243 // when it's destructed by calling OnRequestComplete(), which nulls |
| 225 // |request_|. | 244 // |request_|. |
| 226 Request* request_; | 245 Request* request_; |
| 227 | 246 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 242 // True if the main job has to wait for the alternative job: i.e., the main | 261 // True if the main job has to wait for the alternative job: i.e., the main |
| 243 // job must not create a connection until it is resumed. | 262 // job must not create a connection until it is resumed. |
| 244 bool main_job_is_blocked_; | 263 bool main_job_is_blocked_; |
| 245 // Waiting time for the main job before it is resumed. | 264 // Waiting time for the main job before it is resumed. |
| 246 base::TimeDelta main_job_wait_time_; | 265 base::TimeDelta main_job_wait_time_; |
| 247 | 266 |
| 248 // At the point where a Job is irrevocably tied to |request_|, we set this. | 267 // At the point where a Job is irrevocably tied to |request_|, we set this. |
| 249 // It will be nulled when the |request_| is finished. | 268 // It will be nulled when the |request_| is finished. |
| 250 Job* bound_job_; | 269 Job* bound_job_; |
| 251 | 270 |
| 271 // True if an alternative proxy server job can be started to fetch |request_|. |
| 272 bool can_start_alternative_proxy_job_; |
| 273 |
| 252 base::WeakPtrFactory<JobController> ptr_factory_; | 274 base::WeakPtrFactory<JobController> ptr_factory_; |
| 253 }; | 275 }; |
| 254 | 276 |
| 255 } // namespace net | 277 } // namespace net |
| 256 | 278 |
| 257 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 279 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
| OLD | NEW |