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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 void OnRequestComplete() override; | 59 void OnRequestComplete() override; |
60 | 60 |
61 // Called to resume the HttpStream creation process when necessary | 61 // Called to resume the HttpStream creation process when necessary |
62 // Proxy authentication credentials are collected. | 62 // Proxy authentication credentials are collected. |
63 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials) override; | 63 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials) override; |
64 | 64 |
65 // Called when the priority of transaction changes. | 65 // Called when the priority of transaction changes. |
66 void SetPriority(RequestPriority priority) override; | 66 void SetPriority(RequestPriority priority) override; |
67 | 67 |
68 // From HttpStreamFactoryImpl::Job::Delegate. | 68 // From HttpStreamFactoryImpl::Job::Delegate. |
69 | |
70 // Invoked when |job| has alternative service identified borken. | |
71 void OnAlternativeServiceBroken(Job* job) override; | |
72 | |
73 // Invoked when |job| has alternative proxy server identified broken. | |
74 void OnAlternativeProxyServerBroken(Job* job) override; | |
75 | |
69 // Invoked when |job| has an HttpStream ready. | 76 // Invoked when |job| has an HttpStream ready. |
70 void OnStreamReady(Job* job, | 77 void OnStreamReady(Job* job, |
71 const SSLConfig& used_ssl_config, | 78 const SSLConfig& used_ssl_config, |
72 const ProxyInfo& used_proxy_info) override; | 79 const ProxyInfo& used_proxy_info) override; |
73 | 80 |
74 // Invoked when |job| has a BidirectionalStream ready. | 81 // Invoked when |job| has a BidirectionalStream ready. |
75 void OnBidirectionalStreamImplReady( | 82 void OnBidirectionalStreamImplReady( |
76 Job* job, | 83 Job* job, |
77 const SSLConfig& used_ssl_config, | 84 const SSLConfig& used_ssl_config, |
78 const ProxyInfo& used_proxy_info) override; | 85 const ProxyInfo& used_proxy_info) override; |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
194 void OrphanUnboundJob(); | 201 void OrphanUnboundJob(); |
195 | 202 |
196 // Called when a Job succeeds. | 203 // Called when a Job succeeds. |
197 void OnJobSucceeded(Job* job); | 204 void OnJobSucceeded(Job* job); |
198 | 205 |
199 // Marks completion of the |request_|. | 206 // Marks completion of the |request_|. |
200 void MarkRequestComplete(bool was_npn_negotiated, | 207 void MarkRequestComplete(bool was_npn_negotiated, |
201 NextProto negotiated_protocol, | 208 NextProto negotiated_protocol, |
202 bool using_spdy); | 209 bool using_spdy); |
203 | 210 |
211 // Only be called in successful cases when a job manages to serve the request. | |
212 void MaybeMarkAlternativeServiceBroken(); | |
213 | |
204 void MaybeNotifyFactoryOfCompletion(); | 214 void MaybeNotifyFactoryOfCompletion(); |
205 | 215 |
206 // Called to resume the main job with delay. | 216 // Called to resume the main job with delay. |
207 void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay); | 217 void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay); |
208 | 218 |
209 void ResumeMainJob(); | 219 void ResumeMainJob(); |
210 | 220 |
211 // Returns true if QUIC is whitelisted for |host|. | 221 // Returns true if QUIC is whitelisted for |host|. |
212 bool IsQuicWhitelistedForHost(const std::string& host); | 222 bool IsQuicWhitelistedForHost(const std::string& host); |
213 | 223 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 | 258 |
249 // True if this JobController is used to preconnect streams. | 259 // True if this JobController is used to preconnect streams. |
250 bool is_preconnect_; | 260 bool is_preconnect_; |
251 | 261 |
252 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a | 262 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a |
253 // connection. If |alternative_job_| is unable to do so, |this| will notify | 263 // connection. If |alternative_job_| is unable to do so, |this| will notify |
254 // |main_job_| to proceed and then race the two jobs. | 264 // |main_job_| to proceed and then race the two jobs. |
255 std::unique_ptr<Job> main_job_; | 265 std::unique_ptr<Job> main_job_; |
256 std::unique_ptr<Job> alternative_job_; | 266 std::unique_ptr<Job> alternative_job_; |
257 | 267 |
268 // True if |alternative_job_| uses alternative service and discovers it as | |
269 // broken. | |
270 bool alternative_service_is_broken_; | |
tbansal1
2016/09/13 05:06:45
Is it possible to remove the bool variable since
| |
271 AlternativeService broken_alternative_service_; | |
272 // True if |alternative_job_| uses alternative proxy server and discovers it | |
273 // as broken or failed. | |
274 bool alternative_proxy_server_is_broken_; | |
275 ProxyServer broken_alternative_proxy_server_; | |
276 | |
258 // True if a Job has ever been bound to the |request_|. | 277 // True if a Job has ever been bound to the |request_|. |
259 bool job_bound_; | 278 bool job_bound_; |
260 | 279 |
261 // True if the main job has to wait for the alternative job: i.e., the main | 280 // True if the main job has to wait for the alternative job: i.e., the main |
262 // job must not create a connection until it is resumed. | 281 // job must not create a connection until it is resumed. |
263 bool main_job_is_blocked_; | 282 bool main_job_is_blocked_; |
264 // Waiting time for the main job before it is resumed. | 283 // Waiting time for the main job before it is resumed. |
265 base::TimeDelta main_job_wait_time_; | 284 base::TimeDelta main_job_wait_time_; |
266 | 285 |
267 // At the point where a Job is irrevocably tied to |request_|, we set this. | 286 // At the point where a Job is irrevocably tied to |request_|, we set this. |
268 // It will be nulled when the |request_| is finished. | 287 // It will be nulled when the |request_| is finished. |
269 Job* bound_job_; | 288 Job* bound_job_; |
270 | 289 |
271 // True if an alternative proxy server job can be started to fetch |request_|. | 290 // True if an alternative proxy server job can be started to fetch |request_|. |
272 bool can_start_alternative_proxy_job_; | 291 bool can_start_alternative_proxy_job_; |
273 | 292 |
274 base::WeakPtrFactory<JobController> ptr_factory_; | 293 base::WeakPtrFactory<JobController> ptr_factory_; |
275 }; | 294 }; |
276 | 295 |
277 } // namespace net | 296 } // namespace net |
278 | 297 |
279 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 298 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
OLD | NEW |