| 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/http/http_stream_factory_impl_job.h" | 9 #include "net/http/http_stream_factory_impl_job.h" |
| 10 #include "net/http/http_stream_factory_impl_request.h" | 10 #include "net/http/http_stream_factory_impl_request.h" |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 | 207 |
| 208 // Must be called when |alternative_job_| fails. | 208 // Must be called when |alternative_job_| fails. |
| 209 void OnAlternativeJobFailed(Job* job); | 209 void OnAlternativeJobFailed(Job* job); |
| 210 | 210 |
| 211 // Called to report to http_server_properties to mark alternative service | 211 // Called to report to http_server_properties to mark alternative service |
| 212 // broken. | 212 // broken. |
| 213 void ReportBrokenAlternativeService(); | 213 void ReportBrokenAlternativeService(); |
| 214 | 214 |
| 215 void MaybeNotifyFactoryOfCompletion(); | 215 void MaybeNotifyFactoryOfCompletion(); |
| 216 | 216 |
| 217 // Called to resume the main job with delay. | 217 // Called to resume the main job with delay. Main job is resumed only when |
| 218 // |alternative_job_| has failed or |main_job_wait_time_| elapsed. |
| 218 void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay); | 219 void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay); |
| 219 | 220 |
| 220 void ResumeMainJob(); | 221 void ResumeMainJob(); |
| 221 | 222 |
| 222 // Returns true if QUIC is whitelisted for |host|. | 223 // Returns true if QUIC is whitelisted for |host|. |
| 223 bool IsQuicWhitelistedForHost(const std::string& host); | 224 bool IsQuicWhitelistedForHost(const std::string& host); |
| 224 | 225 |
| 225 AlternativeService GetAlternativeServiceFor( | 226 AlternativeService GetAlternativeServiceFor( |
| 226 const HttpRequestInfo& request_info, | 227 const HttpRequestInfo& request_info, |
| 227 HttpStreamRequest::Delegate* delegate, | 228 HttpStreamRequest::Delegate* delegate, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 245 const GURL& url, | 246 const GURL& url, |
| 246 ProxyServer* alternative_proxy_server) const; | 247 ProxyServer* alternative_proxy_server) const; |
| 247 | 248 |
| 248 // Records histogram metrics for the usage of alternative protocol. Must be | 249 // Records histogram metrics for the usage of alternative protocol. Must be |
| 249 // called when |job| has succeeded and the other job will be orphaned. | 250 // called when |job| has succeeded and the other job will be orphaned. |
| 250 void ReportAlternateProtocolUsage(Job* job) const; | 251 void ReportAlternateProtocolUsage(Job* job) const; |
| 251 | 252 |
| 252 // Starts the |alternative_job_|. | 253 // Starts the |alternative_job_|. |
| 253 void StartAlternativeProxyServerJob(); | 254 void StartAlternativeProxyServerJob(); |
| 254 | 255 |
| 256 // Returns whether |job| is an orphaned job. |
| 257 bool IsJobOrphaned(Job* job) const; |
| 258 |
| 255 HttpStreamFactoryImpl* factory_; | 259 HttpStreamFactoryImpl* factory_; |
| 256 HttpNetworkSession* session_; | 260 HttpNetworkSession* session_; |
| 257 JobFactory* job_factory_; | 261 JobFactory* job_factory_; |
| 258 | 262 |
| 259 // Request will be handed out to factory once created. This just keeps an | 263 // Request will be handed out to factory once created. This just keeps an |
| 260 // reference and is safe as |request_| will notify |this| JobController | 264 // reference and is safe as |request_| will notify |this| JobController |
| 261 // when it's destructed by calling OnRequestComplete(), which nulls | 265 // when it's destructed by calling OnRequestComplete(), which nulls |
| 262 // |request_|. | 266 // |request_|. |
| 263 Request* request_; | 267 Request* request_; |
| 264 | 268 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 | 301 |
| 298 // True if an alternative proxy server job can be started to fetch |request_|. | 302 // True if an alternative proxy server job can be started to fetch |request_|. |
| 299 bool can_start_alternative_proxy_job_; | 303 bool can_start_alternative_proxy_job_; |
| 300 | 304 |
| 301 base::WeakPtrFactory<JobController> ptr_factory_; | 305 base::WeakPtrFactory<JobController> ptr_factory_; |
| 302 }; | 306 }; |
| 303 | 307 |
| 304 } // namespace net | 308 } // namespace net |
| 305 | 309 |
| 306 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 310 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
| OLD | NEW |