summaryrefslogtreecommitdiffstats
path: root/net/http
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 19:05:18 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-18 19:05:18 +0000
commit78bf2aa62eb081644cf3b76bb36e95de1a730658 (patch)
tree26b891501661a39aee029106d6ace10620b81aa1 /net/http
parent00f71870f67dcb264c0eabe3060fd06a3c9259af (diff)
downloadchromium_src-78bf2aa62eb081644cf3b76bb36e95de1a730658.zip
chromium_src-78bf2aa62eb081644cf3b76bb36e95de1a730658.tar.gz
chromium_src-78bf2aa62eb081644cf3b76bb36e95de1a730658.tar.bz2
Revert 50215 because of crashes - Refactor SpdyStream to get HTTP specific out of the interface and members.
Add SpdyStream::Delegate interface and SpdyHttpStream implements SpdyStream::Delegate. SpdyHeaderBlock<>HTTP request/response conversion functions moved from spdy_session.cc to spdy_http_stream.cc. All interface between SpdySession and SpdyStream uses SpdyHeaderBlock instead of HttpRequestInfo,HttpResponseInfo. BUG=42320,46925 TEST=none Review URL: http://codereview.chromium.org/2667002 TBR=ukai@chromium.org Review URL: http://codereview.chromium.org/2827015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@50268 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/http')
-rw-r--r--net/http/http_network_transaction.cc38
-rw-r--r--net/http/http_network_transaction.h2
2 files changed, 12 insertions, 28 deletions
diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc
index d670024..ccc956b 100644
--- a/net/http/http_network_transaction.cc
+++ b/net/http/http_network_transaction.cc
@@ -507,10 +507,10 @@ int HttpNetworkTransaction::Read(IOBuffer* buf, int buf_len,
// Are we using SPDY or HTTP?
if (using_spdy_) {
DCHECK(!http_stream_.get());
- DCHECK(spdy_http_stream_->GetResponseInfo()->headers);
+ DCHECK(spdy_stream_->GetResponseInfo()->headers);
next_state = STATE_SPDY_READ_BODY;
} else {
- DCHECK(!spdy_http_stream_.get());
+ DCHECK(!spdy_stream_.get());
next_state = STATE_READ_BODY;
if (!connection_->is_initialized())
@@ -593,8 +593,8 @@ HttpNetworkTransaction::~HttpNetworkTransaction() {
if (pac_request_)
session_->proxy_service()->CancelPacRequest(pac_request_);
- if (spdy_http_stream_.get())
- spdy_http_stream_->Cancel();
+ if (spdy_stream_.get())
+ spdy_stream_->Cancel();
}
void HttpNetworkTransaction::DoCallback(int rv) {
@@ -1498,7 +1498,7 @@ int HttpNetworkTransaction::DoDrainBodyForAuthRestartComplete(int result) {
int HttpNetworkTransaction::DoSpdySendRequest() {
next_state_ = STATE_SPDY_SEND_REQUEST_COMPLETE;
- CHECK(!spdy_http_stream_.get());
+ CHECK(!spdy_stream_.get());
// First we get a SPDY session. Theoretically, we've just negotiated one, but
// if one already exists, then screw it, use the existing one! Otherwise,
@@ -1529,25 +1529,9 @@ int HttpNetworkTransaction::DoSpdySendRequest() {
return error_code;
}
headers_valid_ = false;
- scoped_refptr<SpdyStream> spdy_stream;
- if (request_->method == "GET")
- spdy_stream = spdy_session->GetPushStream(request_->url, net_log_);
- if (spdy_stream.get()) {
- DCHECK(spdy_stream->pushed());
- CHECK(spdy_stream->GetDelegate() == NULL);
- spdy_http_stream_ = new SpdyHttpStream(spdy_stream);
- spdy_http_stream_->InitializeRequest(*request_, base::Time::Now(), NULL);
- } else {
- spdy_stream = spdy_session->CreateStream(request_->url,
- request_->priority,
- net_log_);
- DCHECK(!spdy_stream->pushed());
- CHECK(spdy_stream->GetDelegate() == NULL);
- spdy_http_stream_ = new SpdyHttpStream(spdy_stream);
- spdy_http_stream_->InitializeRequest(
- *request_, base::Time::Now(), upload_data);
- }
- return spdy_http_stream_->SendRequest(&response_, &io_callback_);
+ spdy_stream_ = spdy_session->GetOrCreateStream(
+ *request_, upload_data, net_log_);
+ return spdy_stream_->SendRequest(upload_data, &response_, &io_callback_);
}
int HttpNetworkTransaction::DoSpdySendRequestComplete(int result) {
@@ -1560,7 +1544,7 @@ int HttpNetworkTransaction::DoSpdySendRequestComplete(int result) {
int HttpNetworkTransaction::DoSpdyReadHeaders() {
next_state_ = STATE_SPDY_READ_HEADERS_COMPLETE;
- return spdy_http_stream_->ReadResponseHeaders(&io_callback_);
+ return spdy_stream_->ReadResponseHeaders(&io_callback_);
}
int HttpNetworkTransaction::DoSpdyReadHeadersComplete(int result) {
@@ -1576,7 +1560,7 @@ int HttpNetworkTransaction::DoSpdyReadHeadersComplete(int result) {
int HttpNetworkTransaction::DoSpdyReadBody() {
next_state_ = STATE_SPDY_READ_BODY_COMPLETE;
- return spdy_http_stream_->ReadResponseBody(
+ return spdy_stream_->ReadResponseBody(
read_buf_, read_buf_len_, &io_callback_);
}
@@ -1585,7 +1569,7 @@ int HttpNetworkTransaction::DoSpdyReadBodyComplete(int result) {
read_buf_len_ = 0;
if (result <= 0)
- spdy_http_stream_ = NULL;
+ spdy_stream_ = NULL;
return result;
}
diff --git a/net/http/http_network_transaction.h b/net/http/http_network_transaction.h
index e481052..147c5e2 100644
--- a/net/http/http_network_transaction.h
+++ b/net/http/http_network_transaction.h
@@ -338,7 +338,7 @@ class HttpNetworkTransaction : public HttpTransaction {
scoped_ptr<ClientSocketHandle> connection_;
scoped_ptr<HttpStream> http_stream_;
- scoped_refptr<SpdyHttpStream> spdy_http_stream_;
+ scoped_refptr<SpdyHttpStream> spdy_stream_;
bool reused_socket_;
// True if we've validated the headers that the stream parser has returned.