OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_H_ | 5 #ifndef NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 6 #define NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Indicates whether or not this job is performing a preconnect. | 89 // Indicates whether or not this job is performing a preconnect. |
90 bool IsPreconnecting() const; | 90 bool IsPreconnecting() const; |
91 | 91 |
92 // Indicates whether or not this Job has been orphaned by a Request. | 92 // Indicates whether or not this Job has been orphaned by a Request. |
93 bool IsOrphaned() const; | 93 bool IsOrphaned() const; |
94 | 94 |
95 // Called to indicate that this job succeeded, and some other jobs | 95 // Called to indicate that this job succeeded, and some other jobs |
96 // will be orphaned. | 96 // will be orphaned. |
97 void ReportJobSuccededForRequest(); | 97 void ReportJobSuccededForRequest(); |
98 | 98 |
| 99 // Marks that the other |job| has completed. |
| 100 void MarkOtherJobComplete(const Job& job); |
| 101 |
99 private: | 102 private: |
100 enum State { | 103 enum State { |
101 STATE_START, | 104 STATE_START, |
102 STATE_RESOLVE_PROXY, | 105 STATE_RESOLVE_PROXY, |
103 STATE_RESOLVE_PROXY_COMPLETE, | 106 STATE_RESOLVE_PROXY_COMPLETE, |
104 | 107 |
105 // Note that when Alternate-Protocol says we can connect to an alternate | 108 // Note that when Alternate-Protocol says we can connect to an alternate |
106 // port using a different protocol, we have the choice of communicating over | 109 // port using a different protocol, we have the choice of communicating over |
107 // the original protocol, or speaking the alternate protocol (currently, | 110 // the original protocol, or speaking the alternate protocol (currently, |
108 // only npn-spdy) over an alternate port. For a cold page load, the http | 111 // only npn-spdy) over an alternate port. For a cold page load, the http |
(...skipping 17 matching lines...) Expand all Loading... |
126 STATE_RESTART_TUNNEL_AUTH, | 129 STATE_RESTART_TUNNEL_AUTH, |
127 STATE_RESTART_TUNNEL_AUTH_COMPLETE, | 130 STATE_RESTART_TUNNEL_AUTH_COMPLETE, |
128 STATE_CREATE_STREAM, | 131 STATE_CREATE_STREAM, |
129 STATE_CREATE_STREAM_COMPLETE, | 132 STATE_CREATE_STREAM_COMPLETE, |
130 STATE_DRAIN_BODY_FOR_AUTH_RESTART, | 133 STATE_DRAIN_BODY_FOR_AUTH_RESTART, |
131 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, | 134 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE, |
132 STATE_DONE, | 135 STATE_DONE, |
133 STATE_NONE | 136 STATE_NONE |
134 }; | 137 }; |
135 | 138 |
| 139 enum JobStatus { |
| 140 STATUS_RUNNING, |
| 141 STATUS_FAILED, |
| 142 STATUS_BROKEN, |
| 143 STATUS_SUCCEEDED |
| 144 }; |
| 145 |
136 void OnStreamReadyCallback(); | 146 void OnStreamReadyCallback(); |
137 void OnWebSocketHandshakeStreamReadyCallback(); | 147 void OnWebSocketHandshakeStreamReadyCallback(); |
138 // This callback function is called when a new SPDY session is created. | 148 // This callback function is called when a new SPDY session is created. |
139 void OnNewSpdySessionReadyCallback(); | 149 void OnNewSpdySessionReadyCallback(); |
140 void OnStreamFailedCallback(int result); | 150 void OnStreamFailedCallback(int result); |
141 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); | 151 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); |
142 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, | 152 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, |
143 HttpAuthController* auth_controller); | 153 HttpAuthController* auth_controller); |
144 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); | 154 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); |
145 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, | 155 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 bool ShouldForceSpdySSL() const; | 225 bool ShouldForceSpdySSL() const; |
216 | 226 |
217 // Should we force SPDY to run without SSL for this stream request. | 227 // Should we force SPDY to run without SSL for this stream request. |
218 bool ShouldForceSpdyWithoutSSL() const; | 228 bool ShouldForceSpdyWithoutSSL() const; |
219 | 229 |
220 // Should we force QUIC for this stream request. | 230 // Should we force QUIC for this stream request. |
221 bool ShouldForceQuic() const; | 231 bool ShouldForceQuic() const; |
222 | 232 |
223 bool IsRequestEligibleForPipelining(); | 233 bool IsRequestEligibleForPipelining(); |
224 | 234 |
| 235 void MaybeMarkAlternateProtocolBroken(); |
| 236 |
225 // Record histograms of latency until Connect() completes. | 237 // Record histograms of latency until Connect() completes. |
226 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); | 238 static void LogHttpConnectedMetrics(const ClientSocketHandle& handle); |
227 | 239 |
228 // Invoked by the transport socket pool after host resolution is complete | 240 // Invoked by the transport socket pool after host resolution is complete |
229 // to allow the connection to be aborted, if a matching SPDY session can | 241 // to allow the connection to be aborted, if a matching SPDY session can |
230 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a | 242 // be found. Will return ERR_SPDY_SESSION_ALREADY_EXISTS if such a |
231 // session is found, and OK otherwise. | 243 // session is found, and OK otherwise. |
232 static int OnHostResolution(SpdySessionPool* spdy_session_pool, | 244 static int OnHostResolution(SpdySessionPool* spdy_session_pool, |
233 const SpdySessionKey& spdy_session_key, | 245 const SpdySessionKey& spdy_session_key, |
234 const AddressList& addresses, | 246 const AddressList& addresses, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 | 336 |
325 // Only used if |new_spdy_session_| is non-NULL. | 337 // Only used if |new_spdy_session_| is non-NULL. |
326 bool spdy_session_direct_; | 338 bool spdy_session_direct_; |
327 | 339 |
328 // Key used to identify the HttpPipelinedHost for |request_|. | 340 // Key used to identify the HttpPipelinedHost for |request_|. |
329 scoped_ptr<HttpPipelinedHost::Key> http_pipelining_key_; | 341 scoped_ptr<HttpPipelinedHost::Key> http_pipelining_key_; |
330 | 342 |
331 // True if an existing pipeline can handle this job's request. | 343 // True if an existing pipeline can handle this job's request. |
332 bool existing_available_pipeline_; | 344 bool existing_available_pipeline_; |
333 | 345 |
| 346 JobStatus job_status_; |
| 347 JobStatus other_job_status_; |
| 348 |
334 base::WeakPtrFactory<Job> ptr_factory_; | 349 base::WeakPtrFactory<Job> ptr_factory_; |
335 | 350 |
336 DISALLOW_COPY_AND_ASSIGN(Job); | 351 DISALLOW_COPY_AND_ASSIGN(Job); |
337 }; | 352 }; |
338 | 353 |
339 } // namespace net | 354 } // namespace net |
340 | 355 |
341 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ | 356 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ |
OLD | NEW |