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 | |
142 // Invoked when the |job| finishes pre-connecting sockets. | 139 // Invoked when the |job| finishes pre-connecting sockets. |
143 void OnPreconnectsComplete(Job* job) override; | 140 void OnPreconnectsComplete(Job* job) override; |
144 | 141 |
145 // Invoked to record connection attempts made by the socket layer to | 142 // Invoked to record connection attempts made by the socket layer to |
146 // Request if |job| is associated with Request. | 143 // Request if |job| is associated with Request. |
147 void AddConnectionAttemptsToRequest( | 144 void AddConnectionAttemptsToRequest( |
148 Job* job, | 145 Job* job, |
149 const ConnectionAttempts& attempts) override; | 146 const ConnectionAttempts& attempts) override; |
150 | 147 |
151 // Invoked when |job| finishes initiating a connection. | 148 // Invoked when |job| finishes initiating a connection. |
152 // Resume the other job if there's an error raised. | 149 // Resume the other job if there's an error raised. |
153 void OnConnectionInitialized(Job* job, int rv) override; | 150 void OnConnectionInitialized(Job* job, int rv) override; |
154 | 151 |
155 // Return false if |job| can advance to the next state. Otherwise, |job| | 152 // Return false if |job| can advance to the next state. Otherwise, |job| |
156 // will wait for Job::Resume() to be called before advancing. | 153 // will wait for Job::Resume() to be called before advancing. |
157 bool ShouldWait(Job* job) override; | 154 bool ShouldWait(Job* job) override; |
158 | 155 |
159 // Called when |job| determines the appropriate |spdy_session_key| for the | 156 // Called when |job| determines the appropriate |spdy_session_key| for the |
160 // Request. Note that this does not mean that SPDY is necessarily supported | 157 // Request. Note that this does not mean that SPDY is necessarily supported |
161 // for this SpdySessionKey, since we may need to wait for NPN to complete | 158 // for this SpdySessionKey, since we may need to wait for NPN to complete |
162 // before knowing if SPDY is available. | 159 // before knowing if SPDY is available. |
163 void SetSpdySessionKey(Job* job, | 160 void SetSpdySessionKey(Job* job, |
164 const SpdySessionKey& spdy_session_key) override; | 161 const SpdySessionKey& spdy_session_key) override; |
165 | 162 |
166 // Remove session from the SpdySessionRequestMap. | 163 // Remove session from the SpdySessionRequestMap. |
167 void RemoveRequestFromSpdySessionRequestMapForJob(Job* job) override; | 164 void RemoveRequestFromSpdySessionRequestMapForJob(Job* job) override; |
168 | 165 |
169 const NetLogWithSource* GetNetLog(Job* job) const override; | 166 const NetLogWithSource* GetNetLog() const override; |
170 | 167 |
171 void MaybeSetWaitTimeForMainJob(const base::TimeDelta& delay) override; | 168 void MaybeSetWaitTimeForMainJob(const base::TimeDelta& delay) override; |
172 | 169 |
173 WebSocketHandshakeStreamBase::CreateHelper* | 170 WebSocketHandshakeStreamBase::CreateHelper* |
174 websocket_handshake_stream_create_helper() override; | 171 websocket_handshake_stream_create_helper() override; |
175 | 172 |
176 bool is_preconnect() const { return is_preconnect_; } | 173 bool is_preconnect() const { return is_preconnect_; } |
177 | 174 |
178 // Returns true if |this| has a pending main job that is not completed. | 175 // Returns true if |this| has a pending main job that is not completed. |
179 bool HasPendingMainJob() const; | 176 bool HasPendingMainJob() const; |
(...skipping 21 matching lines...) Expand all Loading... |
201 | 198 |
202 // Called when |request_| is destructed. | 199 // Called when |request_| is destructed. |
203 // Job(s) associated with but not bound to |request_| will be deleted. | 200 // Job(s) associated with but not bound to |request_| will be deleted. |
204 void CancelJobs(); | 201 void CancelJobs(); |
205 | 202 |
206 // Called after BindJob() to notify the unbound job that its result should be | 203 // Called after BindJob() to notify the unbound job that its result should be |
207 // ignored by JobController. The unbound job can be canceled or continue until | 204 // ignored by JobController. The unbound job can be canceled or continue until |
208 // completion. | 205 // completion. |
209 void OrphanUnboundJob(); | 206 void OrphanUnboundJob(); |
210 | 207 |
| 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 |