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

Unified Diff: net/http/http_stream_factory_impl.cc

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 side-by-side diff with in-line comments
Download patch
Index: net/http/http_stream_factory_impl.cc
diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc
index 93b85df394c223f1ec0b7644111c55d1aee545c8..e7d1ac34311b51abf7b5f8ea4c607f18946efa49 100644
--- a/net/http/http_stream_factory_impl.cc
+++ b/net/http/http_stream_factory_impl.cc
@@ -18,6 +18,10 @@
#include "net/spdy/spdy_http_stream.h"
#include "url/gurl.h"
+#if defined(ENABLE_BIDIRECTIONAL_STREAM)
+#include "net/spdy/bidirectional_stream_spdy_job.h"
+#endif
+
namespace net {
HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session,
@@ -76,6 +80,34 @@ HttpStreamRequest* HttpStreamFactoryImpl::RequestWebSocketHandshakeStream(
net_log);
}
+HttpStreamRequest* HttpStreamFactoryImpl::RequestBidirectionalStreamJob(
+ const HttpRequestInfo& request_info,
+ RequestPriority priority,
+ const SSLConfig& server_ssl_config,
+ const SSLConfig& proxy_ssl_config,
+ HttpStreamRequest::Delegate* delegate,
+ const BoundNetLog& net_log) {
+ DCHECK(!for_websockets_);
+ DCHECK(request_info.url.SchemeIs(url::kHttpsScheme));
+
+// TODO(xunjieli): Create QUIC's version of BidirectionalStreamJob.
+#if defined(ENABLE_BIDIRECTIONAL_STREAM)
+ Request* request =
+ new Request(request_info.url, this, delegate, nullptr, net_log,
+ Request::BIDIRECTIONAL_STREAM_SPDY_JOB);
+ Job* job = new Job(this, session_, request_info, priority, server_ssl_config,
+ proxy_ssl_config, net_log.net_log());
+ request->AttachJob(job);
+
+ job->Start(request);
+ return request;
+
+#else
+ DCHECK(false);
+ return nullptr;
+#endif
+}
+
HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal(
const HttpRequestInfo& request_info,
RequestPriority priority,
@@ -85,11 +117,9 @@ HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal(
WebSocketHandshakeStreamBase::CreateHelper*
websocket_handshake_stream_create_helper,
const BoundNetLog& net_log) {
- Request* request = new Request(request_info.url,
- this,
- delegate,
+ Request* request = new Request(request_info.url, this, delegate,
websocket_handshake_stream_create_helper,
- net_log);
+ net_log, Request::HTTP_STREAM);
Job* job = new Job(this, session_, request_info, priority, server_ssl_config,
proxy_ssl_config, net_log.net_log());
request->AttachJob(job);
@@ -275,12 +305,18 @@ void HttpStreamFactoryImpl::OnNewSpdySessionReady(
// TODO(ricea): Restore this code path when WebSocket over SPDY
// implementation is ready.
NOTREACHED();
+ } else if (request->for_bidirectional()) {
+#if defined(ENABLE_BIDIRECTIONAL_STREAM)
+ request->OnBidirectionalStreamJobReady(
+ nullptr, used_ssl_config, used_proxy_info,
+ new BidirectionalStreamSpdyJob(spdy_session));
+#else
+ DCHECK(false);
+#endif
} else {
bool use_relative_url = direct || request->url().SchemeIs("https");
request->OnStreamReady(
- NULL,
- used_ssl_config,
- used_proxy_info,
+ nullptr, used_ssl_config, used_proxy_info,
new SpdyHttpStream(spdy_session, use_relative_url));
}
}

Powered by Google App Engine
This is Rietveld 408576698