| 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 ebd73f24ab7fcf8119c3e7db3b6f47cee2636ad2..944fc17c560e5b845283d5ce78d04f0b25c6eec1 100644
|
| --- a/net/http/http_pipelined_connection_impl.cc
|
| +++ b/net/http/http_pipelined_connection_impl.cc
|
| @@ -59,9 +59,13 @@ HttpPipelinedConnectionImpl::Factory::CreateNewPipeline(
|
| const BoundNetLog& net_log,
|
| bool was_npn_negotiated,
|
| NextProto protocol_negotiated) {
|
| - return new HttpPipelinedConnectionImpl(connection, delegate, origin,
|
| - used_ssl_config, used_proxy_info,
|
| - net_log, was_npn_negotiated,
|
| + return new HttpPipelinedConnectionImpl(connection,
|
| + delegate,
|
| + origin,
|
| + used_ssl_config,
|
| + used_proxy_info,
|
| + net_log,
|
| + was_npn_negotiated,
|
| protocol_negotiated);
|
| }
|
|
|
| @@ -94,9 +98,8 @@ HttpPipelinedConnectionImpl::HttpPipelinedConnectionImpl(
|
| active_read_id_(0),
|
| read_still_on_call_stack_(false) {
|
| CHECK(connection_.get());
|
| - net_log_.BeginEvent(
|
| - NetLog::TYPE_HTTP_PIPELINED_CONNECTION,
|
| - base::Bind(&NetLogHostPortPairCallback, &origin));
|
| + net_log_.BeginEvent(NetLog::TYPE_HTTP_PIPELINED_CONNECTION,
|
| + base::Bind(&NetLogHostPortPairCallback, &origin));
|
| }
|
|
|
| HttpPipelinedConnectionImpl::~HttpPipelinedConnectionImpl() {
|
| @@ -269,12 +272,13 @@ int HttpPipelinedConnectionImpl::DoStartNextDeferredRequest(int result) {
|
|
|
| int HttpPipelinedConnectionImpl::DoSendActiveRequest(int result) {
|
| CHECK(stream_info_map_[active_send_request_->pipeline_id].parser.get());
|
| - int rv = stream_info_map_[active_send_request_->pipeline_id].parser->
|
| - SendRequest(active_send_request_->request_line,
|
| - active_send_request_->headers,
|
| - active_send_request_->response,
|
| - base::Bind(&HttpPipelinedConnectionImpl::OnSendIOCallback,
|
| - base::Unretained(this)));
|
| + int rv =
|
| + stream_info_map_[active_send_request_->pipeline_id].parser->SendRequest(
|
| + active_send_request_->request_line,
|
| + active_send_request_->headers,
|
| + active_send_request_->response,
|
| + base::Bind(&HttpPipelinedConnectionImpl::OnSendIOCallback,
|
| + base::Unretained(this)));
|
| stream_info_map_[active_send_request_->pipeline_id].state = STREAM_SENDING;
|
| send_next_state_ = SEND_STATE_COMPLETE;
|
| return rv;
|
| @@ -287,10 +291,9 @@ int HttpPipelinedConnectionImpl::DoSendComplete(int result) {
|
|
|
| request_order_.push(active_send_request_->pipeline_id);
|
| stream_info_map_[active_send_request_->pipeline_id].state = STREAM_SENT;
|
| - net_log_.AddEvent(
|
| - NetLog::TYPE_HTTP_PIPELINED_CONNECTION_SENT_REQUEST,
|
| - stream_info_map_[active_send_request_->pipeline_id].source.
|
| - ToEventParametersCallback());
|
| + net_log_.AddEvent(NetLog::TYPE_HTTP_PIPELINED_CONNECTION_SENT_REQUEST,
|
| + stream_info_map_[active_send_request_->pipeline_id]
|
| + .source.ToEventParametersCallback());
|
|
|
| if (result == ERR_SOCKET_NOT_CONNECTED && completed_one_request_) {
|
| result = ERR_PIPELINE_EVICTION;
|
| @@ -301,7 +304,9 @@ int HttpPipelinedConnectionImpl::DoSendComplete(int result) {
|
|
|
| if (!send_still_on_call_stack_) {
|
| QueueUserCallback(active_send_request_->pipeline_id,
|
| - active_send_request_->callback, result, FROM_HERE);
|
| + active_send_request_->callback,
|
| + result,
|
| + FROM_HERE);
|
| }
|
|
|
| active_send_request_.reset();
|
| @@ -335,7 +340,8 @@ int HttpPipelinedConnectionImpl::DoEvictPendingSendRequests(int result) {
|
| }
|
|
|
| int HttpPipelinedConnectionImpl::ReadResponseHeaders(
|
| - int pipeline_id, const CompletionCallback& callback) {
|
| + int pipeline_id,
|
| + const CompletionCallback& callback) {
|
| CHECK(ContainsKey(stream_info_map_, pipeline_id));
|
| CHECK_EQ(STREAM_SENT, stream_info_map_[pipeline_id].state);
|
| CHECK(stream_info_map_[pipeline_id].read_headers_callback.is_null());
|
| @@ -477,8 +483,7 @@ int HttpPipelinedConnectionImpl::DoReadHeadersComplete(int result) {
|
| read_next_state_ = READ_STATE_WAITING_FOR_CLOSE;
|
| if (result < OK) {
|
| if (completed_one_request_ &&
|
| - (result == ERR_CONNECTION_CLOSED ||
|
| - result == ERR_EMPTY_RESPONSE ||
|
| + (result == ERR_CONNECTION_CLOSED || result == ERR_EMPTY_RESPONSE ||
|
| result == ERR_SOCKET_NOT_CONNECTED)) {
|
| // These usually indicate that pipelining failed on the server side. In
|
| // that case, we should retry without pipelining.
|
| @@ -492,7 +497,8 @@ int HttpPipelinedConnectionImpl::DoReadHeadersComplete(int result) {
|
| if (!read_still_on_call_stack_) {
|
| QueueUserCallback(active_read_id_,
|
| stream_info_map_[active_read_id_].read_headers_callback,
|
| - result, FROM_HERE);
|
| + result,
|
| + FROM_HERE);
|
| }
|
|
|
| return result;
|
| @@ -539,13 +545,12 @@ int HttpPipelinedConnectionImpl::DoEvictPendingReadHeaders(int result) {
|
| return result;
|
| }
|
|
|
| -void HttpPipelinedConnectionImpl::Close(int pipeline_id,
|
| - bool not_reusable) {
|
| +void HttpPipelinedConnectionImpl::Close(int pipeline_id, bool not_reusable) {
|
| CHECK(ContainsKey(stream_info_map_, pipeline_id));
|
| - net_log_.AddEvent(
|
| - NetLog::TYPE_HTTP_PIPELINED_CONNECTION_STREAM_CLOSED,
|
| - base::Bind(&NetLogStreamClosedCallback,
|
| - stream_info_map_[pipeline_id].source, not_reusable));
|
| + net_log_.AddEvent(NetLog::TYPE_HTTP_PIPELINED_CONNECTION_STREAM_CLOSED,
|
| + base::Bind(&NetLogStreamClosedCallback,
|
| + stream_info_map_[pipeline_id].source,
|
| + not_reusable));
|
| switch (stream_info_map_[pipeline_id].state) {
|
| case STREAM_CREATED:
|
| stream_info_map_[pipeline_id].state = STREAM_UNUSED;
|
| @@ -567,8 +572,7 @@ void HttpPipelinedConnectionImpl::Close(int pipeline_id,
|
| case STREAM_READ_PENDING:
|
| usable_ = false;
|
| stream_info_map_[pipeline_id].state = STREAM_CLOSED;
|
| - if (!request_order_.empty() &&
|
| - pipeline_id == request_order_.front() &&
|
| + if (!request_order_.empty() && pipeline_id == request_order_.front() &&
|
| read_next_state_ == READ_STATE_NONE) {
|
| read_next_state_ = READ_STATE_EVICT_PENDING_READS;
|
| DoReadHeadersLoop(OK);
|
| @@ -600,7 +604,9 @@ void HttpPipelinedConnectionImpl::Close(int pipeline_id,
|
| }
|
|
|
| int HttpPipelinedConnectionImpl::ReadResponseBody(
|
| - int pipeline_id, IOBuffer* buf, int buf_len,
|
| + int pipeline_id,
|
| + IOBuffer* buf,
|
| + int buf_len,
|
| const CompletionCallback& callback) {
|
| CHECK(ContainsKey(stream_info_map_, pipeline_id));
|
| CHECK_EQ(active_read_id_, pipeline_id);
|
| @@ -627,15 +633,15 @@ bool HttpPipelinedConnectionImpl::IsResponseBodyComplete(
|
| int pipeline_id) const {
|
| CHECK(ContainsKey(stream_info_map_, pipeline_id));
|
| CHECK(stream_info_map_.find(pipeline_id)->second.parser.get());
|
| - return stream_info_map_.find(pipeline_id)->second.parser->
|
| - IsResponseBodyComplete();
|
| + return stream_info_map_.find(pipeline_id)
|
| + ->second.parser->IsResponseBodyComplete();
|
| }
|
|
|
| bool HttpPipelinedConnectionImpl::CanFindEndOfResponse(int pipeline_id) const {
|
| CHECK(ContainsKey(stream_info_map_, pipeline_id));
|
| CHECK(stream_info_map_.find(pipeline_id)->second.parser.get());
|
| - return stream_info_map_.find(pipeline_id)->second.parser->
|
| - CanFindEndOfResponse();
|
| + return stream_info_map_.find(pipeline_id)
|
| + ->second.parser->CanFindEndOfResponse();
|
| }
|
|
|
| bool HttpPipelinedConnectionImpl::IsConnectionReused(int pipeline_id) const {
|
| @@ -662,7 +668,8 @@ int64 HttpPipelinedConnectionImpl::GetTotalReceivedBytes(
|
| }
|
|
|
| bool HttpPipelinedConnectionImpl::GetLoadTimingInfo(
|
| - int pipeline_id, LoadTimingInfo* load_timing_info) const {
|
| + int pipeline_id,
|
| + LoadTimingInfo* load_timing_info) const {
|
| return connection_->GetLoadTimingInfo(IsConnectionReused(pipeline_id),
|
| load_timing_info);
|
| }
|
| @@ -730,7 +737,7 @@ void HttpPipelinedConnectionImpl::CheckHeadersForPipelineCompatibility(
|
| return;
|
| }
|
| if (info->headers->HasHeader(
|
| - HttpAuth::GetChallengeHeaderName(HttpAuth::AUTH_SERVER))) {
|
| + HttpAuth::GetChallengeHeaderName(HttpAuth::AUTH_SERVER))) {
|
| ReportPipelineFeedback(pipeline_id, AUTHENTICATION_REQUIRED);
|
| return;
|
| }
|
| @@ -766,22 +773,26 @@ void HttpPipelinedConnectionImpl::ReportPipelineFeedback(int pipeline_id,
|
| feedback_str = "UNKNOWN";
|
| break;
|
| }
|
| - net_log_.AddEvent(
|
| - NetLog::TYPE_HTTP_PIPELINED_CONNECTION_RECEIVED_HEADERS,
|
| - base::Bind(&NetLogReceivedHeadersCallback,
|
| - stream_info_map_[pipeline_id].source, &feedback_str));
|
| + net_log_.AddEvent(NetLog::TYPE_HTTP_PIPELINED_CONNECTION_RECEIVED_HEADERS,
|
| + base::Bind(&NetLogReceivedHeadersCallback,
|
| + stream_info_map_[pipeline_id].source,
|
| + &feedback_str));
|
| delegate_->OnPipelineFeedback(this, feedback);
|
| }
|
|
|
| void HttpPipelinedConnectionImpl::QueueUserCallback(
|
| - int pipeline_id, const CompletionCallback& callback, int rv,
|
| + int pipeline_id,
|
| + const CompletionCallback& callback,
|
| + int rv,
|
| const tracked_objects::Location& from_here) {
|
| CHECK(stream_info_map_[pipeline_id].pending_user_callback.is_null());
|
| stream_info_map_[pipeline_id].pending_user_callback = callback;
|
| base::MessageLoop::current()->PostTask(
|
| from_here,
|
| base::Bind(&HttpPipelinedConnectionImpl::FireUserCallback,
|
| - weak_factory_.GetWeakPtr(), pipeline_id, rv));
|
| + weak_factory_.GetWeakPtr(),
|
| + pipeline_id,
|
| + rv));
|
| }
|
|
|
| void HttpPipelinedConnectionImpl::FireUserCallback(int pipeline_id,
|
| @@ -823,21 +834,18 @@ bool HttpPipelinedConnectionImpl::was_npn_negotiated() const {
|
| return was_npn_negotiated_;
|
| }
|
|
|
| -NextProto HttpPipelinedConnectionImpl::protocol_negotiated()
|
| - const {
|
| +NextProto HttpPipelinedConnectionImpl::protocol_negotiated() const {
|
| return protocol_negotiated_;
|
| }
|
|
|
| HttpPipelinedConnectionImpl::PendingSendRequest::PendingSendRequest()
|
| - : pipeline_id(0),
|
| - response(NULL) {
|
| + : pipeline_id(0), response(NULL) {
|
| }
|
|
|
| HttpPipelinedConnectionImpl::PendingSendRequest::~PendingSendRequest() {
|
| }
|
|
|
| -HttpPipelinedConnectionImpl::StreamInfo::StreamInfo()
|
| - : state(STREAM_CREATED) {
|
| +HttpPipelinedConnectionImpl::StreamInfo::StreamInfo() : state(STREAM_CREATED) {
|
| }
|
|
|
| HttpPipelinedConnectionImpl::StreamInfo::~StreamInfo() {
|
|
|