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