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

Unified Diff: net/spdy/spdy_network_transaction.cc

Issue 2919011: Implement MAX_CONCURRENT_STREAMS SETTINGS header (Closed)
Patch Set: landing soon on a repo near you Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_network_transaction.h ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_network_transaction.cc
diff --git a/net/spdy/spdy_network_transaction.cc b/net/spdy/spdy_network_transaction.cc
index 05a4a5a7faa209f80a62c9d05ac84fefa0246f1a..78145538f9060b9afdd498fca708fe8ecfbc4671 100644
--- a/net/spdy/spdy_network_transaction.cc
+++ b/net/spdy/spdy_network_transaction.cc
@@ -112,6 +112,7 @@ LoadState SpdyNetworkTransaction::GetLoadState() const {
if (spdy_.get())
return spdy_->GetLoadState();
return LOAD_STATE_CONNECTING;
+ case STATE_GET_STREAM_COMPLETE:
case STATE_SEND_REQUEST_COMPLETE:
return LOAD_STATE_SENDING_REQUEST;
case STATE_READ_HEADERS_COMPLETE:
@@ -168,6 +169,12 @@ int SpdyNetworkTransaction::DoLoop(int result) {
net_log_.EndEvent(NetLog::TYPE_SPDY_TRANSACTION_INIT_CONNECTION, NULL);
rv = DoInitConnectionComplete(rv);
break;
+ case STATE_GET_STREAM:
+ DCHECK_EQ(OK, rv);
+ rv = DoGetStream();
+ break;
+ case STATE_GET_STREAM_COMPLETE:
+ rv = DoGetStreamComplete(rv);
case STATE_SEND_REQUEST:
DCHECK_EQ(OK, rv);
net_log_.BeginEvent(NetLog::TYPE_SPDY_TRANSACTION_SEND_REQUEST, NULL);
@@ -243,57 +250,54 @@ int SpdyNetworkTransaction::DoInitConnectionComplete(int result) {
if (result < 0)
return result;
- next_state_ = STATE_SEND_REQUEST;
+ next_state_ = STATE_GET_STREAM;
return OK;
}
-int SpdyNetworkTransaction::DoSendRequest() {
- next_state_ = STATE_SEND_REQUEST_COMPLETE;
- CHECK(!stream_.get());
+int SpdyNetworkTransaction::DoGetStream() {
+ next_state_ = STATE_GET_STREAM_COMPLETE;
// It is possible that the spdy session was shut down while it was
// asynchronously waiting to connect.
- if(spdy_->IsClosed())
+ if (spdy_->IsClosed())
return ERR_CONNECTION_CLOSED;
- UploadDataStream* upload_data = NULL;
+ CHECK(!stream_.get());
+
+ stream_.reset(new SpdyHttpStream());
+ return stream_->InitializeStream(spdy_, *request_,
+ net_log_, &io_callback_);
+}
+
+int SpdyNetworkTransaction::DoGetStreamComplete(int result) {
+ if (result < 0) {
+ return result;
+ }
+
+ next_state_ = STATE_SEND_REQUEST;
+ return OK;
+}
+
+int SpdyNetworkTransaction::DoSendRequest() {
+ next_state_ = STATE_SEND_REQUEST_COMPLETE;
+
+ UploadDataStream* upload_data_stream = NULL;
if (request_->upload_data) {
int error_code;
- upload_data = UploadDataStream::Create(request_->upload_data, &error_code);
- if (!upload_data)
+ upload_data_stream = UploadDataStream::Create(request_->upload_data,
+ &error_code);
+ if (!upload_data_stream)
return error_code;
}
- scoped_refptr<SpdyStream> spdy_stream;
- if (request_->method == "GET") {
- int error = spdy_->GetPushStream(request_->url, &spdy_stream, net_log_);
- if (error != OK)
- return error;
- }
- if (spdy_stream.get()) {
- DCHECK(spdy_stream->pushed());
- CHECK(spdy_stream->GetDelegate() == NULL);
- stream_.reset(new SpdyHttpStream(spdy_stream));
- stream_->InitializeRequest(*request_, base::Time::Now(), NULL);
- // "vary" field?
- } else {
- int error = spdy_->CreateStream(request_->url,
- request_->priority,
- &spdy_stream,
- net_log_);
- if (error != OK)
- return error;
- DCHECK(!spdy_stream->pushed());
- CHECK(spdy_stream->GetDelegate() == NULL);
- stream_.reset(new SpdyHttpStream(spdy_stream));
- stream_->InitializeRequest(*request_, base::Time::Now(), upload_data);
- }
+ stream_->InitializeRequest(base::Time::Now(), upload_data_stream);
spdy_ = NULL;
+
return stream_->SendRequest(&response_, &io_callback_);
}
int SpdyNetworkTransaction::DoSendRequestComplete(int result) {
if (result < 0) {
- stream_.reset() ;
+ stream_.reset();
return result;
}
« no previous file with comments | « net/spdy/spdy_network_transaction.h ('k') | net/spdy/spdy_network_transaction_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698