| 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/base/host_port_pair.h" |
| 9 #include "net/base/privacy_mode.h" | 9 #include "net/base/privacy_mode.h" |
| 10 #include "net/http/http_stream_factory_impl_job.h" | 10 #include "net/http/http_stream_factory_impl_job.h" |
| 11 #include "net/http/http_stream_factory_impl_request.h" | 11 #include "net/http/http_stream_factory_impl_request.h" |
| 12 | 12 |
| 13 namespace net { | 13 namespace net { |
| 14 | 14 |
| 15 class NetLogWithSource; | 15 class NetLogWithSource; |
| 16 | 16 |
| 17 // HttpStreamFactoryImpl::JobController manages Request and Job(s). | 17 // HttpStreamFactoryImpl::JobController manages Request and Job(s). |
| 18 class HttpStreamFactoryImpl::JobController | 18 class HttpStreamFactoryImpl::JobController |
| 19 : public HttpStreamFactoryImpl::Job::Delegate, | 19 : public HttpStreamFactoryImpl::Job::Delegate, |
| 20 public HttpStreamFactoryImpl::Request::Helper { | 20 public HttpStreamFactoryImpl::Request::Helper { |
| 21 public: | 21 public: |
| 22 JobController(HttpStreamFactoryImpl* factory, | 22 JobController(HttpStreamFactoryImpl* factory, |
| 23 HttpStreamRequest::Delegate* delegate, | 23 HttpStreamRequest::Delegate* delegate, |
| 24 HttpNetworkSession* session, | 24 HttpNetworkSession* session, |
| 25 JobFactory* job_factory, | 25 JobFactory* job_factory, |
| 26 const HttpRequestInfo& request_info, | 26 const HttpRequestInfo& request_info, |
| 27 bool is_preconnect); | 27 bool is_preconnect, |
| 28 bool enable_ip_based_pooling); |
| 28 | 29 |
| 29 ~JobController() override; | 30 ~JobController() override; |
| 30 | 31 |
| 31 bool for_websockets() override; | 32 bool for_websockets() override; |
| 32 | 33 |
| 33 // Used in tests only for verification purpose. | 34 // Used in tests only for verification purpose. |
| 34 const Job* main_job() const { return main_job_.get(); } | 35 const Job* main_job() const { return main_job_.get(); } |
| 35 const Job* alternative_job() const { return alternative_job_.get(); } | 36 const Job* alternative_job() const { return alternative_job_.get(); } |
| 36 | 37 |
| 37 GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); | 38 GURL ApplyHostMappingRules(const GURL& url, HostPortPair* endpoint); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 // reference and is safe as |request_| will notify |this| JobController | 282 // reference and is safe as |request_| will notify |this| JobController |
| 282 // when it's destructed by calling OnRequestComplete(), which nulls | 283 // when it's destructed by calling OnRequestComplete(), which nulls |
| 283 // |request_|. | 284 // |request_|. |
| 284 Request* request_; | 285 Request* request_; |
| 285 | 286 |
| 286 HttpStreamRequest::Delegate* const delegate_; | 287 HttpStreamRequest::Delegate* const delegate_; |
| 287 | 288 |
| 288 // True if this JobController is used to preconnect streams. | 289 // True if this JobController is used to preconnect streams. |
| 289 const bool is_preconnect_; | 290 const bool is_preconnect_; |
| 290 | 291 |
| 292 // Enable pooling to a SpdySession with matching IP and certificate even if |
| 293 // the SpdySessionKey is different. |
| 294 const bool enable_ip_based_pooling_; |
| 295 |
| 291 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a | 296 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a |
| 292 // connection. If |alternative_job_| is unable to do so, |this| will notify | 297 // connection. If |alternative_job_| is unable to do so, |this| will notify |
| 293 // |main_job_| to proceed and then race the two jobs. | 298 // |main_job_| to proceed and then race the two jobs. |
| 294 std::unique_ptr<Job> main_job_; | 299 std::unique_ptr<Job> main_job_; |
| 295 std::unique_ptr<Job> alternative_job_; | 300 std::unique_ptr<Job> alternative_job_; |
| 296 | 301 |
| 297 // Net error code of the failed alternative job. Set to OK by default. | 302 // Net error code of the failed alternative job. Set to OK by default. |
| 298 int alternative_job_net_error_; | 303 int alternative_job_net_error_; |
| 299 | 304 |
| 300 // Either and only one of these records failed alternative service/proxy | 305 // Either and only one of these records failed alternative service/proxy |
| (...skipping 25 matching lines...) Expand all Loading... |
| 326 PrivacyMode privacy_mode_; | 331 PrivacyMode privacy_mode_; |
| 327 | 332 |
| 328 const NetLogWithSource net_log_; | 333 const NetLogWithSource net_log_; |
| 329 | 334 |
| 330 base::WeakPtrFactory<JobController> ptr_factory_; | 335 base::WeakPtrFactory<JobController> ptr_factory_; |
| 331 }; | 336 }; |
| 332 | 337 |
| 333 } // namespace net | 338 } // namespace net |
| 334 | 339 |
| 335 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 340 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
| OLD | NEW |