Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(142)

Side by Side Diff: net/http/http_stream_factory_impl_job.h

Issue 1326503003: Added a net::BidirectionalStream to expose a bidirectional streaming interface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address Comments Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 // Used to detach the Job from |request|. 79 // Used to detach the Job from |request|.
80 void Orphan(const Request* request); 80 void Orphan(const Request* request);
81 81
82 void SetPriority(RequestPriority priority); 82 void SetPriority(RequestPriority priority);
83 83
84 RequestPriority priority() const { return priority_; } 84 RequestPriority priority() const { return priority_; }
85 bool was_npn_negotiated() const; 85 bool was_npn_negotiated() const;
86 NextProto protocol_negotiated() const; 86 NextProto protocol_negotiated() const;
87 bool using_spdy() const; 87 bool using_spdy() const;
88 const BoundNetLog& net_log() const { return net_log_; } 88 const BoundNetLog& net_log() const { return net_log_; }
89 bool for_bidirectional() const { return for_bidirectional_; }
89 90
90 const SSLConfig& server_ssl_config() const; 91 const SSLConfig& server_ssl_config() const;
91 const SSLConfig& proxy_ssl_config() const; 92 const SSLConfig& proxy_ssl_config() const;
92 const ProxyInfo& proxy_info() const; 93 const ProxyInfo& proxy_info() const;
93 94
94 // Indicates whether or not this job is performing a preconnect. 95 // Indicates whether or not this job is performing a preconnect.
95 bool IsPreconnecting() const; 96 bool IsPreconnecting() const;
96 97
97 // Indicates whether or not this Job has been orphaned by a Request. 98 // Indicates whether or not this Job has been orphaned by a Request.
98 bool IsOrphaned() const; 99 bool IsOrphaned() const;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 // Returns appropriate error code otherwise. 188 // Returns appropriate error code otherwise.
188 int CheckAlternativeServiceValidityForOrigin( 189 int CheckAlternativeServiceValidityForOrigin(
189 base::WeakPtr<SpdySession> spdy_session); 190 base::WeakPtr<SpdySession> spdy_session);
190 191
191 SpdySessionPool* const spdy_session_pool_; 192 SpdySessionPool* const spdy_session_pool_;
192 const GURL origin_url_; 193 const GURL origin_url_;
193 const bool is_spdy_alternative_; 194 const bool is_spdy_alternative_;
194 }; 195 };
195 196
196 void OnStreamReadyCallback(); 197 void OnStreamReadyCallback();
198 void OnBidirectionalStreamReadyCallback();
197 void OnWebSocketHandshakeStreamReadyCallback(); 199 void OnWebSocketHandshakeStreamReadyCallback();
198 // This callback function is called when a new SPDY session is created. 200 // This callback function is called when a new SPDY session is created.
199 void OnNewSpdySessionReadyCallback(); 201 void OnNewSpdySessionReadyCallback();
200 void OnStreamFailedCallback(int result); 202 void OnStreamFailedCallback(int result);
201 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info); 203 void OnCertificateErrorCallback(int result, const SSLInfo& ssl_info);
202 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info, 204 void OnNeedsProxyAuthCallback(const HttpResponseInfo& response_info,
203 HttpAuthController* auth_controller); 205 HttpAuthController* auth_controller);
204 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info); 206 void OnNeedsClientAuthCallback(SSLCertRequestInfo* cert_info);
205 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info, 207 void OnHttpsProxyTunnelResponseCallback(const HttpResponseInfo& response_info,
206 HttpStream* stream); 208 HttpStream* stream);
(...skipping 14 matching lines...) Expand all
221 int DoWaitForJob(); 223 int DoWaitForJob();
222 int DoWaitForJobComplete(int result); 224 int DoWaitForJobComplete(int result);
223 int DoInitConnection(); 225 int DoInitConnection();
224 int DoInitConnectionComplete(int result); 226 int DoInitConnectionComplete(int result);
225 int DoWaitingUserAction(int result); 227 int DoWaitingUserAction(int result);
226 int DoCreateStream(); 228 int DoCreateStream();
227 int DoCreateStreamComplete(int result); 229 int DoCreateStreamComplete(int result);
228 int DoRestartTunnelAuth(); 230 int DoRestartTunnelAuth();
229 int DoRestartTunnelAuthComplete(int result); 231 int DoRestartTunnelAuthComplete(int result);
230 232
231 // Creates a SpdyHttpStream from the given values and sets to |stream_|. Does 233 // Creates a SpdyHttpStream or a BidirectionalStream from the given values
234 // and sets to |stream_| or |bidirectional_stream_| respectively. Does
232 // nothing if |stream_factory_| is for WebSockets. 235 // nothing if |stream_factory_| is for WebSockets.
233 int SetSpdyHttpStream(base::WeakPtr<SpdySession> session, bool direct); 236 int SetSpdyHttpStreamOrBidirectionalStream(base::WeakPtr<SpdySession> session,
237 bool direct);
234 238
235 // Returns to STATE_INIT_CONNECTION and resets some state. 239 // Returns to STATE_INIT_CONNECTION and resets some state.
236 void ReturnToStateInitConnection(bool close_connection); 240 void ReturnToStateInitConnection(bool close_connection);
237 241
238 // Set the motivation for this request onto the underlying socket. 242 // Set the motivation for this request onto the underlying socket.
239 void SetSocketMotivation(); 243 void SetSocketMotivation();
240 244
241 bool IsHttpsProxyAndHttpUrl() const; 245 bool IsHttpsProxyAndHttpUrl() const;
242 246
243 // Is this a SPDY or QUIC alternative Job? 247 // Is this a SPDY or QUIC alternative Job?
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 365
362 scoped_refptr<HttpAuthController> 366 scoped_refptr<HttpAuthController>
363 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; 367 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS];
364 368
365 // True when the tunnel is in the process of being established - we can't 369 // True when the tunnel is in the process of being established - we can't
366 // read from the socket until the tunnel is done. 370 // read from the socket until the tunnel is done.
367 bool establishing_tunnel_; 371 bool establishing_tunnel_;
368 372
369 scoped_ptr<HttpStream> stream_; 373 scoped_ptr<HttpStream> stream_;
370 scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_; 374 scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_;
375 scoped_ptr<BidirectionalStream> bidirectional_stream_;
371 376
372 // True if we negotiated NPN. 377 // True if we negotiated NPN.
373 bool was_npn_negotiated_; 378 bool was_npn_negotiated_;
374 379
375 // Protocol negotiated with the server. 380 // Protocol negotiated with the server.
376 NextProto protocol_negotiated_; 381 NextProto protocol_negotiated_;
377 382
378 // 0 if we're not preconnecting. Otherwise, the number of streams to 383 // 0 if we're not preconnecting. Otherwise, the number of streams to
379 // preconnect. 384 // preconnect.
380 int num_streams_; 385 int num_streams_;
381 386
382 scoped_ptr<ValidSpdySessionPool> valid_spdy_session_pool_; 387 scoped_ptr<ValidSpdySessionPool> valid_spdy_session_pool_;
383 388
384 // Initialized when we create a new SpdySession. 389 // Initialized when we create a new SpdySession.
385 base::WeakPtr<SpdySession> new_spdy_session_; 390 base::WeakPtr<SpdySession> new_spdy_session_;
386 391
387 // Initialized when we have an existing SpdySession. 392 // Initialized when we have an existing SpdySession.
388 base::WeakPtr<SpdySession> existing_spdy_session_; 393 base::WeakPtr<SpdySession> existing_spdy_session_;
389 394
390 // Only used if |new_spdy_session_| is non-NULL. 395 // Only used if |new_spdy_session_| is non-NULL.
391 bool spdy_session_direct_; 396 bool spdy_session_direct_;
392 397
393 JobStatus job_status_; 398 JobStatus job_status_;
394 JobStatus other_job_status_; 399 JobStatus other_job_status_;
395 400
401 // True if BidirectionalStream is requested.
402 bool for_bidirectional_;
403
396 base::WeakPtrFactory<Job> ptr_factory_; 404 base::WeakPtrFactory<Job> ptr_factory_;
397 405
398 DISALLOW_COPY_AND_ASSIGN(Job); 406 DISALLOW_COPY_AND_ASSIGN(Job);
399 }; 407 };
400 408
401 } // namespace net 409 } // namespace net
402 410
403 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 411 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698