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/base/privacy_mode.h" | 9 #include "net/base/privacy_mode.h" |
10 #include "net/http/http_stream_factory_impl_job.h" | 10 #include "net/http/http_stream_factory_impl_job.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 const SSLConfig& server_ssl_config, | 129 const SSLConfig& server_ssl_config, |
130 const SSLConfig& proxy_ssl_config, | 130 const SSLConfig& proxy_ssl_config, |
131 HttpStreamRequest::StreamType stream_type) override; | 131 HttpStreamRequest::StreamType stream_type) override; |
132 | 132 |
133 // Invoked to notify the Request and Factory of the readiness of new | 133 // Invoked to notify the Request and Factory of the readiness of new |
134 // SPDY session. | 134 // SPDY session. |
135 void OnNewSpdySessionReady(Job* job, | 135 void OnNewSpdySessionReady(Job* job, |
136 const base::WeakPtr<SpdySession>& spdy_session, | 136 const base::WeakPtr<SpdySession>& spdy_session, |
137 bool direct) override; | 137 bool direct) override; |
138 | 138 |
| 139 // Invoked when the orphaned |job| finishes. |
| 140 void OnOrphanedJobComplete(const Job* job) override; |
| 141 |
139 // Invoked when the |job| finishes pre-connecting sockets. | 142 // Invoked when the |job| finishes pre-connecting sockets. |
140 void OnPreconnectsComplete(Job* job) override; | 143 void OnPreconnectsComplete(Job* job) override; |
141 | 144 |
142 // Invoked to record connection attempts made by the socket layer to | 145 // Invoked to record connection attempts made by the socket layer to |
143 // Request if |job| is associated with Request. | 146 // Request if |job| is associated with Request. |
144 void AddConnectionAttemptsToRequest( | 147 void AddConnectionAttemptsToRequest( |
145 Job* job, | 148 Job* job, |
146 const ConnectionAttempts& attempts) override; | 149 const ConnectionAttempts& attempts) override; |
147 | 150 |
148 // Invoked when |job| finishes initiating a connection. | 151 // Invoked when |job| finishes initiating a connection. |
149 // Resume the other job if there's an error raised. | 152 // Resume the other job if there's an error raised. |
150 void OnConnectionInitialized(Job* job, int rv) override; | 153 void OnConnectionInitialized(Job* job, int rv) override; |
151 | 154 |
152 // Return false if |job| can advance to the next state. Otherwise, |job| | 155 // Return false if |job| can advance to the next state. Otherwise, |job| |
153 // will wait for Job::Resume() to be called before advancing. | 156 // will wait for Job::Resume() to be called before advancing. |
154 bool ShouldWait(Job* job) override; | 157 bool ShouldWait(Job* job) override; |
155 | 158 |
156 // Called when |job| determines the appropriate |spdy_session_key| for the | 159 // Called when |job| determines the appropriate |spdy_session_key| for the |
157 // Request. Note that this does not mean that SPDY is necessarily supported | 160 // Request. Note that this does not mean that SPDY is necessarily supported |
158 // for this SpdySessionKey, since we may need to wait for NPN to complete | 161 // for this SpdySessionKey, since we may need to wait for NPN to complete |
159 // before knowing if SPDY is available. | 162 // before knowing if SPDY is available. |
160 void SetSpdySessionKey(Job* job, | 163 void SetSpdySessionKey(Job* job, |
161 const SpdySessionKey& spdy_session_key) override; | 164 const SpdySessionKey& spdy_session_key) override; |
162 | 165 |
163 // Remove session from the SpdySessionRequestMap. | 166 // Remove session from the SpdySessionRequestMap. |
164 void RemoveRequestFromSpdySessionRequestMapForJob(Job* job) override; | 167 void RemoveRequestFromSpdySessionRequestMapForJob(Job* job) override; |
165 | 168 |
166 const NetLogWithSource* GetNetLog() const override; | 169 const NetLogWithSource* GetNetLog(Job* job) const override; |
167 | 170 |
168 void MaybeSetWaitTimeForMainJob(const base::TimeDelta& delay) override; | 171 void MaybeSetWaitTimeForMainJob(const base::TimeDelta& delay) override; |
169 | 172 |
170 WebSocketHandshakeStreamBase::CreateHelper* | 173 WebSocketHandshakeStreamBase::CreateHelper* |
171 websocket_handshake_stream_create_helper() override; | 174 websocket_handshake_stream_create_helper() override; |
172 | 175 |
173 bool is_preconnect() const { return is_preconnect_; } | 176 bool is_preconnect() const { return is_preconnect_; } |
174 | 177 |
175 // Returns true if |this| has a pending main job that is not completed. | 178 // Returns true if |this| has a pending main job that is not completed. |
176 bool HasPendingMainJob() const; | 179 bool HasPendingMainJob() const; |
(...skipping 21 matching lines...) Expand all Loading... |
198 | 201 |
199 // Called when |request_| is destructed. | 202 // Called when |request_| is destructed. |
200 // Job(s) associated with but not bound to |request_| will be deleted. | 203 // Job(s) associated with but not bound to |request_| will be deleted. |
201 void CancelJobs(); | 204 void CancelJobs(); |
202 | 205 |
203 // Called after BindJob() to notify the unbound job that its result should be | 206 // Called after BindJob() to notify the unbound job that its result should be |
204 // ignored by JobController. The unbound job can be canceled or continue until | 207 // ignored by JobController. The unbound job can be canceled or continue until |
205 // completion. | 208 // completion. |
206 void OrphanUnboundJob(); | 209 void OrphanUnboundJob(); |
207 | 210 |
208 // Invoked when the orphaned |job| finishes. | |
209 void OnOrphanedJobComplete(const Job* job); | |
210 | |
211 // Called when a Job succeeds. | 211 // Called when a Job succeeds. |
212 void OnJobSucceeded(Job* job); | 212 void OnJobSucceeded(Job* job); |
213 | 213 |
214 // Marks completion of the |request_|. | 214 // Marks completion of the |request_|. |
215 void MarkRequestComplete(bool was_alpn_negotiated, | 215 void MarkRequestComplete(bool was_alpn_negotiated, |
216 NextProto negotiated_protocol, | 216 NextProto negotiated_protocol, |
217 bool using_spdy); | 217 bool using_spdy); |
218 | 218 |
219 // Must be called when the alternative job fails. |net_error| is the net error | 219 // Must be called when the alternative job fails. |net_error| is the net error |
220 // of the failed alternative job. | 220 // of the failed alternative job. |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 PrivacyMode privacy_mode_; | 332 PrivacyMode privacy_mode_; |
333 | 333 |
334 const NetLogWithSource net_log_; | 334 const NetLogWithSource net_log_; |
335 | 335 |
336 base::WeakPtrFactory<JobController> ptr_factory_; | 336 base::WeakPtrFactory<JobController> ptr_factory_; |
337 }; | 337 }; |
338 | 338 |
339 } // namespace net | 339 } // namespace net |
340 | 340 |
341 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ | 341 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_CONTROLLER_H_ |
OLD | NEW |