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

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: Use std::move Created 5 years 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 OnBidirectionalStreamJobReadyCallback();
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 BidirectionalStreamJob from the given values
234 // and sets to |stream_| or |bidirectional_stream_job_| 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 SetSpdyHttpStreamOrBidirectionalStreamJob(
237 base::WeakPtr<SpdySession> session,
238 bool direct);
234 239
235 // Returns to STATE_INIT_CONNECTION and resets some state. 240 // Returns to STATE_INIT_CONNECTION and resets some state.
236 void ReturnToStateInitConnection(bool close_connection); 241 void ReturnToStateInitConnection(bool close_connection);
237 242
238 // Set the motivation for this request onto the underlying socket. 243 // Set the motivation for this request onto the underlying socket.
239 void SetSocketMotivation(); 244 void SetSocketMotivation();
240 245
241 bool IsHttpsProxyAndHttpUrl() const; 246 bool IsHttpsProxyAndHttpUrl() const;
242 247
243 // Is this a SPDY or QUIC alternative Job? 248 // Is this a SPDY or QUIC alternative Job?
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 366
362 scoped_refptr<HttpAuthController> 367 scoped_refptr<HttpAuthController>
363 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS]; 368 auth_controllers_[HttpAuth::AUTH_NUM_TARGETS];
364 369
365 // True when the tunnel is in the process of being established - we can't 370 // True when the tunnel is in the process of being established - we can't
366 // read from the socket until the tunnel is done. 371 // read from the socket until the tunnel is done.
367 bool establishing_tunnel_; 372 bool establishing_tunnel_;
368 373
369 scoped_ptr<HttpStream> stream_; 374 scoped_ptr<HttpStream> stream_;
370 scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_; 375 scoped_ptr<WebSocketHandshakeStreamBase> websocket_stream_;
376 scoped_ptr<BidirectionalStreamJob> bidirectional_stream_job_;
mef 2015/12/21 17:31:43 Forward-declare BidirectionalStreamJob?
xunjieli 2015/12/21 22:01:22 Done.
371 377
372 // True if we negotiated NPN. 378 // True if we negotiated NPN.
373 bool was_npn_negotiated_; 379 bool was_npn_negotiated_;
374 380
375 // Protocol negotiated with the server. 381 // Protocol negotiated with the server.
376 NextProto protocol_negotiated_; 382 NextProto protocol_negotiated_;
377 383
378 // 0 if we're not preconnecting. Otherwise, the number of streams to 384 // 0 if we're not preconnecting. Otherwise, the number of streams to
379 // preconnect. 385 // preconnect.
380 int num_streams_; 386 int num_streams_;
381 387
382 scoped_ptr<ValidSpdySessionPool> valid_spdy_session_pool_; 388 scoped_ptr<ValidSpdySessionPool> valid_spdy_session_pool_;
383 389
384 // Initialized when we create a new SpdySession. 390 // Initialized when we create a new SpdySession.
385 base::WeakPtr<SpdySession> new_spdy_session_; 391 base::WeakPtr<SpdySession> new_spdy_session_;
386 392
387 // Initialized when we have an existing SpdySession. 393 // Initialized when we have an existing SpdySession.
388 base::WeakPtr<SpdySession> existing_spdy_session_; 394 base::WeakPtr<SpdySession> existing_spdy_session_;
389 395
390 // Only used if |new_spdy_session_| is non-NULL. 396 // Only used if |new_spdy_session_| is non-NULL.
391 bool spdy_session_direct_; 397 bool spdy_session_direct_;
392 398
393 JobStatus job_status_; 399 JobStatus job_status_;
394 JobStatus other_job_status_; 400 JobStatus other_job_status_;
395 401
402 // True if BidirectionalStreamJob is requested.
403 bool for_bidirectional_;
404
396 base::WeakPtrFactory<Job> ptr_factory_; 405 base::WeakPtrFactory<Job> ptr_factory_;
397 406
398 DISALLOW_COPY_AND_ASSIGN(Job); 407 DISALLOW_COPY_AND_ASSIGN(Job);
399 }; 408 };
400 409
401 } // namespace net 410 } // namespace net
402 411
403 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_ 412 #endif // NET_HTTP_HTTP_STREAM_FACTORY_IMPL_JOB_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698