| 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/http/http_stream_factory_impl.h" | 8 #include "net/http/http_stream_factory_impl.h" |
| 9 | 9 |
| 10 namespace net { | 10 namespace net { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // Called when |request_| is destructed. | 43 // Called when |request_| is destructed. |
| 44 // Job(s) associated with but not bound to |request_| will be deleted. | 44 // Job(s) associated with but not bound to |request_| will be deleted. |
| 45 // |request_| and |bound_job_| will be nulled if ever set. | 45 // |request_| and |bound_job_| will be nulled if ever set. |
| 46 void OnRequestFinish(); | 46 void OnRequestFinish(); |
| 47 | 47 |
| 48 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials); | 48 int RestartTunnelWithProxyAuth(const AuthCredentials& credentials); |
| 49 | 49 |
| 50 void SetPriority(RequestPriority priority); | 50 void SetPriority(RequestPriority priority); |
| 51 | 51 |
| 52 /* Methods below are called by HttpStreamFactoryImpl::Job only */ | 52 /* Methods below are called by HttpStreamFactoryImpl::Job only */ |
| 53 |
| 54 // Called when |job| is in STATE_WAIT_FOR_JOB. Set Job to |
| 55 // STATE_INIT_CONNECTION |
| 56 // if there's no Job blocking |job| and there's no waiting time. |
| 57 // Otherwise resume |job| after wait_time. |
| 58 int ScheduleJob(Job* job); |
| 59 |
| 53 void OnStreamReady(Job* job, | 60 void OnStreamReady(Job* job, |
| 54 const SSLConfig& used_ssl_config, | 61 const SSLConfig& used_ssl_config, |
| 55 const ProxyInfo& used_proxy_info); | 62 const ProxyInfo& used_proxy_info); |
| 56 void OnBidirectionalStreamImplReady(Job* job, | 63 void OnBidirectionalStreamImplReady(Job* job, |
| 57 const SSLConfig& used_ssl_config, | 64 const SSLConfig& used_ssl_config, |
| 58 const ProxyInfo& used_proxy_info); | 65 const ProxyInfo& used_proxy_info); |
| 59 void OnWebSocketHandshakeStreamReady(Job* job, | 66 void OnWebSocketHandshakeStreamReady(Job* job, |
| 60 const SSLConfig& used_ssl_config, | 67 const SSLConfig& used_ssl_config, |
| 61 const ProxyInfo& used_proxy_info, | 68 const ProxyInfo& used_proxy_info, |
| 62 WebSocketHandshakeStreamBase* stream); | 69 WebSocketHandshakeStreamBase* stream); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 113 |
| 107 // Called when |job| determines the appropriate |spdy_session_key| for the | 114 // Called when |job| determines the appropriate |spdy_session_key| for the |
| 108 // Request. Note that this does not mean that SPDY is necessarily supported | 115 // Request. Note that this does not mean that SPDY is necessarily supported |
| 109 // for this SpdySessionKey, since we may need to wait for NPN to complete | 116 // for this SpdySessionKey, since we may need to wait for NPN to complete |
| 110 // before knowing if SPDY is available. | 117 // before knowing if SPDY is available. |
| 111 void SetSpdySessionKey(Job* job, const SpdySessionKey& spdy_session_key); | 118 void SetSpdySessionKey(Job* job, const SpdySessionKey& spdy_session_key); |
| 112 | 119 |
| 113 // Remove session from the SpdySessionRequestMap. | 120 // Remove session from the SpdySessionRequestMap. |
| 114 void RemoveRequestFromSpdySessionRequestMap(Job* job); | 121 void RemoveRequestFromSpdySessionRequestMap(Job* job); |
| 115 | 122 |
| 123 void MaybeResumeOtherJob(Job* job, const base::TimeDelta& delay); |
| 124 |
| 116 const BoundNetLog* GetNetLog(Job* job) const; | 125 const BoundNetLog* GetNetLog(Job* job) const; |
| 117 | 126 |
| 127 bool blocking() { return blocking_; } |
| 128 |
| 118 WebSocketHandshakeStreamBase::CreateHelper* | 129 WebSocketHandshakeStreamBase::CreateHelper* |
| 119 websocket_handshake_stream_create_helper(); | 130 websocket_handshake_stream_create_helper(); |
| 120 | 131 |
| 121 private: | 132 private: |
| 122 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, SetPriority); | 133 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, SetPriority); |
| 123 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob); | 134 FRIEND_TEST_ALL_PREFIXES(HttpStreamFactoryImplRequestTest, DelayMainJob); |
| 124 | 135 |
| 125 // Creates Job(s) for |request_|. Job(s) will be owned by |this|. | 136 // Creates Job(s) for |request_|. Job(s) will be owned by |this|. |
| 126 void CreateJobs(const HttpRequestInfo& request_info, | 137 void CreateJobs(const HttpRequestInfo& request_info, |
| 127 RequestPriority priority, | 138 RequestPriority priority, |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 | 198 |
| 188 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a | 199 // |main_job_| is a job waiting to see if |alternative_job_| can reuse a |
| 189 // connection. If |alternative_job_| is unable to do so, |this| will notify | 200 // connection. If |alternative_job_| is unable to do so, |this| will notify |
| 190 // |main_job_| to proceed and then race the two jobs. | 201 // |main_job_| to proceed and then race the two jobs. |
| 191 std::unique_ptr<Job> main_job_; | 202 std::unique_ptr<Job> main_job_; |
| 192 std::unique_ptr<Job> alternative_job_; | 203 std::unique_ptr<Job> alternative_job_; |
| 193 | 204 |
| 194 // True if ever a job is explicitly bounded to the |request_|. | 205 // True if ever a job is explicitly bounded to the |request_|. |
| 195 bool job_bounded_; | 206 bool job_bounded_; |
| 196 | 207 |
| 208 // True if the |main_job_| has to wait for |alternative_job_|; |
| 209 bool blocking_; |
| 210 |
| 197 // At the point where a Job is irrevocably tied to |request_|, we set this. | 211 // At the point where a Job is irrevocably tied to |request_|, we set this. |
| 198 Job* bound_job_; | 212 Job* bound_job_; |
| 199 }; | 213 }; |
| 200 | 214 |
| 201 } // namespace net | 215 } // namespace net |
| 202 | 216 |
| 203 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 217 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
| OLD | NEW |