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

Side by Side Diff: net/http/http_stream_factory_impl_request.cc

Issue 1744693002: Implement QUIC-based net::BidirectionalStream (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@basecl
Patch Set: Address Ryan's comments Created 4 years, 9 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 #include "net/http/http_stream_factory_impl_request.h" 5 #include "net/http/http_stream_factory_impl_request.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "net/http/http_stream_factory_impl_job.h" 10 #include "net/http/http_stream_factory_impl_job.h"
(...skipping 17 matching lines...) Expand all
28 : url_(url), 28 : url_(url),
29 factory_(factory), 29 factory_(factory),
30 websocket_handshake_stream_create_helper_( 30 websocket_handshake_stream_create_helper_(
31 websocket_handshake_stream_create_helper), 31 websocket_handshake_stream_create_helper),
32 delegate_(delegate), 32 delegate_(delegate),
33 net_log_(net_log), 33 net_log_(net_log),
34 completed_(false), 34 completed_(false),
35 was_npn_negotiated_(false), 35 was_npn_negotiated_(false),
36 protocol_negotiated_(kProtoUnknown), 36 protocol_negotiated_(kProtoUnknown),
37 using_spdy_(false), 37 using_spdy_(false),
38 for_bidirectional_(stream_type == BIDIRECTIONAL_STREAM_SPDY_JOB) { 38 stream_type_(stream_type) {
39 DCHECK(factory_); 39 DCHECK(factory_);
40 DCHECK(delegate_); 40 DCHECK(delegate_);
41 41
42 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_REQUEST); 42 net_log_.BeginEvent(NetLog::TYPE_HTTP_STREAM_REQUEST);
43 } 43 }
44 44
45 HttpStreamFactoryImpl::Request::~Request() { 45 HttpStreamFactoryImpl::Request::~Request() {
46 if (bound_job_.get()) 46 if (bound_job_.get())
47 DCHECK(jobs_.empty()); 47 DCHECK(jobs_.empty());
48 48
(...skipping 27 matching lines...) Expand all
76 protocol_negotiated_ = protocol_negotiated; 76 protocol_negotiated_ = protocol_negotiated;
77 using_spdy_ = using_spdy; 77 using_spdy_ = using_spdy;
78 } 78 }
79 79
80 void HttpStreamFactoryImpl::Request::OnStreamReady( 80 void HttpStreamFactoryImpl::Request::OnStreamReady(
81 Job* job, 81 Job* job,
82 const SSLConfig& used_ssl_config, 82 const SSLConfig& used_ssl_config,
83 const ProxyInfo& used_proxy_info, 83 const ProxyInfo& used_proxy_info,
84 HttpStream* stream) { 84 HttpStream* stream) {
85 DCHECK(!factory_->for_websockets_); 85 DCHECK(!factory_->for_websockets_);
86 DCHECK(!for_bidirectional_); 86 DCHECK_EQ(HttpStreamRequest::HTTP_STREAM, stream_type_);
87 DCHECK(stream); 87 DCHECK(stream);
88 DCHECK(completed_); 88 DCHECK(completed_);
89 89
90 OnJobSucceeded(job); 90 OnJobSucceeded(job);
91 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream); 91 delegate_->OnStreamReady(used_ssl_config, used_proxy_info, stream);
92 } 92 }
93 93
94 void HttpStreamFactoryImpl::Request::OnBidirectionalStreamJobReady( 94 void HttpStreamFactoryImpl::Request::OnBidirectionalStreamJobReady(
95 Job* job, 95 Job* job,
96 const SSLConfig& used_ssl_config, 96 const SSLConfig& used_ssl_config,
97 const ProxyInfo& used_proxy_info, 97 const ProxyInfo& used_proxy_info,
98 BidirectionalStreamJob* stream_job) { 98 BidirectionalStreamJob* stream_job) {
99 DCHECK(!factory_->for_websockets_); 99 DCHECK(!factory_->for_websockets_);
100 DCHECK(for_bidirectional_); 100 DCHECK_EQ(HttpStreamRequest::BIDIRECTIONAL_STREAM, stream_type_);
101 DCHECK(stream_job); 101 DCHECK(stream_job);
102 DCHECK(completed_); 102 DCHECK(completed_);
103 103
104 OnJobSucceeded(job); 104 OnJobSucceeded(job);
105 delegate_->OnBidirectionalStreamJobReady(used_ssl_config, used_proxy_info, 105 delegate_->OnBidirectionalStreamJobReady(used_ssl_config, used_proxy_info,
106 stream_job); 106 stream_job);
107 } 107 }
108 108
109 void HttpStreamFactoryImpl::Request::OnWebSocketHandshakeStreamReady( 109 void HttpStreamFactoryImpl::Request::OnWebSocketHandshakeStreamReady(
110 Job* job, 110 Job* job,
111 const SSLConfig& used_ssl_config, 111 const SSLConfig& used_ssl_config,
112 const ProxyInfo& used_proxy_info, 112 const ProxyInfo& used_proxy_info,
113 WebSocketHandshakeStreamBase* stream) { 113 WebSocketHandshakeStreamBase* stream) {
114 DCHECK(factory_->for_websockets_); 114 DCHECK(factory_->for_websockets_);
115 DCHECK(!for_bidirectional_); 115 DCHECK_EQ(HttpStreamRequest::HTTP_STREAM, stream_type_);
116 DCHECK(stream); 116 DCHECK(stream);
117 DCHECK(completed_); 117 DCHECK(completed_);
118 118
119 OnJobSucceeded(job); 119 OnJobSucceeded(job);
120 delegate_->OnWebSocketHandshakeStreamReady( 120 delegate_->OnWebSocketHandshakeStreamReady(
121 used_ssl_config, used_proxy_info, stream); 121 used_ssl_config, used_proxy_info, stream);
122 } 122 }
123 123
124 void HttpStreamFactoryImpl::Request::OnStreamFailed( 124 void HttpStreamFactoryImpl::Request::OnStreamFailed(
125 Job* job, 125 Job* job,
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 const BoundNetLog net_log = job->net_log(); 307 const BoundNetLog net_log = job->net_log();
308 308
309 Complete(was_npn_negotiated, protocol_negotiated, using_spdy); 309 Complete(was_npn_negotiated, protocol_negotiated, using_spdy);
310 310
311 // Cache this so we can still use it if the request is deleted. 311 // Cache this so we can still use it if the request is deleted.
312 HttpStreamFactoryImpl* factory = factory_; 312 HttpStreamFactoryImpl* factory = factory_;
313 if (factory->for_websockets_) { 313 if (factory->for_websockets_) {
314 // TODO(ricea): Re-instate this code when WebSockets over SPDY is 314 // TODO(ricea): Re-instate this code when WebSockets over SPDY is
315 // implemented. 315 // implemented.
316 NOTREACHED(); 316 NOTREACHED();
317 } else if (for_bidirectional_) { 317 } else if (stream_type_ == HttpStreamRequest::BIDIRECTIONAL_STREAM) {
318 DCHECK(bidirectional_stream_job); 318 DCHECK(bidirectional_stream_job);
319 DCHECK(!stream); 319 DCHECK(!stream);
320 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM) 320 #if BUILDFLAG(ENABLE_BIDIRECTIONAL_STREAM)
321 delegate_->OnBidirectionalStreamJobReady( 321 delegate_->OnBidirectionalStreamJobReady(
322 job->server_ssl_config(), job->proxy_info(), 322 job->server_ssl_config(), job->proxy_info(),
323 bidirectional_stream_job.release()); 323 bidirectional_stream_job.release());
324 #else 324 #else
325 NOTREACHED(); 325 NOTREACHED();
326 #endif 326 #endif
327 } else { 327 } else {
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 } 415 }
416 // We may have other jobs in |jobs_|. For example, if we start multiple jobs 416 // We may have other jobs in |jobs_|. For example, if we start multiple jobs
417 // for Alternate-Protocol. 417 // for Alternate-Protocol.
418 BindJob(job); 418 BindJob(job);
419 return; 419 return;
420 } 420 }
421 DCHECK(jobs_.empty()); 421 DCHECK(jobs_.empty());
422 } 422 }
423 423
424 } // namespace net 424 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698