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

Unified Diff: net/http/http_pipelined_connection_impl.cc

Issue 8586015: Slow start pipelining. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add missing files Created 9 years, 1 month 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_pipelined_connection_impl.cc
diff --git a/net/http/http_pipelined_connection_impl.cc b/net/http/http_pipelined_connection_impl.cc
index 82c788f903edbaf88a8861f94bb81e3ea8dcd06d..6f730d38b2bb86df5e9d0df2d6a989d7cb21a2c2 100644
--- a/net/http/http_pipelined_connection_impl.cc
+++ b/net/http/http_pipelined_connection_impl.cc
@@ -9,7 +9,9 @@
#include "net/base/io_buffer.h"
#include "net/http/http_pipelined_stream.h"
#include "net/http/http_request_info.h"
+#include "net/http/http_response_headers.h"
#include "net/http/http_stream_parser.h"
+#include "net/http/http_version.h"
#include "net/socket/client_socket_handle.h"
namespace net {
@@ -165,7 +167,7 @@ int HttpPipelinedConnectionImpl::DoSendRequestLoop(int result) {
rv = DoEvictPendingSendRequests(rv);
break;
default:
- NOTREACHED() << "bad send state: " << state;
+ CHECK(false) << "bad send state: " << state;
rv = ERR_FAILED;
break;
}
@@ -335,7 +337,7 @@ int HttpPipelinedConnectionImpl::DoReadHeadersLoop(int result) {
case READ_STATE_NONE:
break;
default:
- NOTREACHED() << "bad read state";
+ CHECK(false) << "bad read state";
rv = ERR_FAILED;
break;
}
@@ -392,7 +394,7 @@ int HttpPipelinedConnectionImpl::DoStartNextDeferredRead(int result) {
break;
default:
- NOTREACHED() << "Unexpected read state: "
+ CHECK(false) << "Unexpected read state: "
<< stream_info_map_[next_id].state;
}
@@ -423,6 +425,8 @@ int HttpPipelinedConnectionImpl::DoReadHeadersComplete(int result) {
usable_ = false;
}
+ CheckHeadersForPipelineCompatibility(result, active_read_id_);
+
if (!read_still_on_call_stack_) {
QueueUserCallback(active_read_id_,
stream_info_map_[active_read_id_].read_headers_callback,
@@ -443,6 +447,7 @@ int HttpPipelinedConnectionImpl::DoReadStreamClosed() {
CHECK_EQ(stream_info_map_[active_read_id_].state, STREAM_CLOSED);
active_read_id_ = 0;
if (!usable_) {
+ // TODO(simonjam): Don't wait this long to evict.
read_next_state_ = READ_STATE_EVICT_PENDING_READS;
return OK;
}
@@ -525,7 +530,7 @@ void HttpPipelinedConnectionImpl::Close(int pipeline_id,
break;
default:
- NOTREACHED();
+ CHECK(false);
break;
}
}
@@ -606,6 +611,27 @@ void HttpPipelinedConnectionImpl::GetSSLCertRequestInfo(
cert_request_info);
}
+void HttpPipelinedConnectionImpl::CheckHeadersForPipelineCompatibility(
+ int result,
+ int pipeline_id) {
+ if (result < OK) {
+ delegate_->OnPipelineFeedback(this, SOCKET_ERROR);
+ return;
+ }
+ HttpResponseInfo* info = GetResponseInfo(pipeline_id);
+ const HttpVersion required_version(1, 1);
+ if (info->headers->GetParsedHttpVersion() < required_version) {
+ delegate_->OnPipelineFeedback(this, OLD_HTTP_VERSION);
+ return;
+ }
+ if (!info->headers->IsKeepAlive() || !CanFindEndOfResponse(pipeline_id)) {
+ usable_ = false;
+ delegate_->OnPipelineFeedback(this, MUST_CLOSE_CONNECTION);
+ return;
+ }
+ delegate_->OnPipelineFeedback(this, OK);
+}
+
void HttpPipelinedConnectionImpl::QueueUserCallback(
int pipeline_id,
OldCompletionCallback* callback,

Powered by Google App Engine
This is Rietveld 408576698