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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 void OrphanUnboundJob(); | 194 void OrphanUnboundJob(); |
195 | 195 |
196 // Called when a Job succeeds. | 196 // Called when a Job succeeds. |
197 void OnJobSucceeded(Job* job); | 197 void OnJobSucceeded(Job* job); |
198 | 198 |
199 // Marks completion of the |request_|. | 199 // Marks completion of the |request_|. |
200 void MarkRequestComplete(bool was_npn_negotiated, | 200 void MarkRequestComplete(bool was_npn_negotiated, |
201 NextProto negotiated_protocol, | 201 NextProto negotiated_protocol, |
202 bool using_spdy); | 202 bool using_spdy); |
203 | 203 |
| 204 // Must be called when |alternative_job_| fails. |
| 205 void OnAlternativeJobFailed(Job* job); |
| 206 |
| 207 // Called to report to http_server_properties to mark alternative service |
| 208 // broken. |
| 209 void ReportBrokenAlternativeService(); |
| 210 |
204 void MaybeNotifyFactoryOfCompletion(); | 211 void MaybeNotifyFactoryOfCompletion(); |
205 | 212 |
206 // Called to resume the main job with delay. | 213 // Called to resume the main job with delay. |
207 void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay); | 214 void MaybeResumeMainJob(Job* job, const base::TimeDelta& delay); |
208 | 215 |
209 void ResumeMainJob(); | 216 void ResumeMainJob(); |
210 | 217 |
211 // Returns true if QUIC is whitelisted for |host|. | 218 // Returns true if QUIC is whitelisted for |host|. |
212 bool IsQuicWhitelistedForHost(const std::string& host); | 219 bool IsQuicWhitelistedForHost(const std::string& host); |
213 | 220 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 | 255 |
249 // True if this JobController is used to preconnect streams. | 256 // True if this JobController is used to preconnect streams. |
250 bool is_preconnect_; | 257 bool is_preconnect_; |
251 | 258 |
252 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a | 259 // |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 | 260 // connection. If |alternative_job_| is unable to do so, |this| will notify |
254 // |main_job_| to proceed and then race the two jobs. | 261 // |main_job_| to proceed and then race the two jobs. |
255 std::unique_ptr<Job> main_job_; | 262 std::unique_ptr<Job> main_job_; |
256 std::unique_ptr<Job> alternative_job_; | 263 std::unique_ptr<Job> alternative_job_; |
257 | 264 |
| 265 // True if |alternative_job_| uses alternative service/proxy server and it |
| 266 // fails. |
| 267 bool alternative_job_failed_; |
| 268 |
| 269 // Either and only one of these records failed alternative service/proxy |
| 270 // server that |alternative_job_| uses. |
| 271 AlternativeService failed_alternative_service_; |
| 272 ProxyServer failed_alternative_proxy_server_; |
| 273 |
258 // True if a Job has ever been bound to the |request_|. | 274 // True if a Job has ever been bound to the |request_|. |
259 bool job_bound_; | 275 bool job_bound_; |
260 | 276 |
261 // True if the main job has to wait for the alternative job: i.e., the main | 277 // 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. | 278 // job must not create a connection until it is resumed. |
263 bool main_job_is_blocked_; | 279 bool main_job_is_blocked_; |
264 // Waiting time for the main job before it is resumed. | 280 // Waiting time for the main job before it is resumed. |
265 base::TimeDelta main_job_wait_time_; | 281 base::TimeDelta main_job_wait_time_; |
266 | 282 |
267 // At the point where a Job is irrevocably tied to |request_|, we set this. | 283 // At the point where a Job is irrevocably tied to |request_|, we set this. |
268 // It will be nulled when the |request_| is finished. | 284 // It will be nulled when the |request_| is finished. |
269 Job* bound_job_; | 285 Job* bound_job_; |
270 | 286 |
271 // True if an alternative proxy server job can be started to fetch |request_|. | 287 // True if an alternative proxy server job can be started to fetch |request_|. |
272 bool can_start_alternative_proxy_job_; | 288 bool can_start_alternative_proxy_job_; |
273 | 289 |
274 base::WeakPtrFactory<JobController> ptr_factory_; | 290 base::WeakPtrFactory<JobController> ptr_factory_; |
275 }; | 291 }; |
276 | 292 |
277 } // namespace net | 293 } // namespace net |
278 | 294 |
279 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 295 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
OLD | NEW |