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

Side by Side Diff: net/spdy/spdy_stream.cc

Issue 2174943002: Avoid SpdyHeaderBlock copy in SpdyStream::OnPushPromiseHeadersReceived(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_stream.h" 5 #include "net/spdy/spdy_stream.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 if (type_ == SPDY_PUSH_STREAM && 458 if (type_ == SPDY_PUSH_STREAM &&
459 response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) { 459 response_headers_status_ == RESPONSE_HEADERS_ARE_COMPLETE) {
460 session_->ResetStream( 460 session_->ResetStream(
461 stream_id_, RST_STREAM_PROTOCOL_ERROR, 461 stream_id_, RST_STREAM_PROTOCOL_ERROR,
462 "Additional headers received for push stream"); 462 "Additional headers received for push stream");
463 return ERR_SPDY_PROTOCOL_ERROR; 463 return ERR_SPDY_PROTOCOL_ERROR;
464 } 464 }
465 return MergeWithResponseHeaders(additional_response_headers); 465 return MergeWithResponseHeaders(additional_response_headers);
466 } 466 }
467 467
468 void SpdyStream::OnPushPromiseHeadersReceived(const SpdyHeaderBlock& headers) { 468 void SpdyStream::OnPushPromiseHeadersReceived(SpdyHeaderBlock headers) {
469 CHECK(!request_headers_valid_); 469 CHECK(!request_headers_valid_);
470 CHECK_EQ(io_state_, STATE_IDLE); 470 CHECK_EQ(io_state_, STATE_IDLE);
471 CHECK_EQ(type_, SPDY_PUSH_STREAM); 471 CHECK_EQ(type_, SPDY_PUSH_STREAM);
472 DCHECK(!delegate_); 472 DCHECK(!delegate_);
473 473
474 io_state_ = STATE_RESERVED_REMOTE; 474 io_state_ = STATE_RESERVED_REMOTE;
475 request_headers_ = headers.Clone(); 475 request_headers_ = std::move(headers);
476 request_headers_valid_ = true; 476 request_headers_valid_ = true;
477 url_from_header_block_ = GetUrlFromHeaderBlock(request_headers_); 477 url_from_header_block_ = GetUrlFromHeaderBlock(request_headers_);
478 } 478 }
479 479
480 void SpdyStream::OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) { 480 void SpdyStream::OnDataReceived(std::unique_ptr<SpdyBuffer> buffer) {
481 DCHECK(session_->IsStreamActive(stream_id_)); 481 DCHECK(session_->IsStreamActive(stream_id_));
482 482
483 // Track our bandwidth. 483 // Track our bandwidth.
484 recv_bytes_ += buffer ? buffer->GetRemainingSize() : 0; 484 recv_bytes_ += buffer ? buffer->GetRemainingSize() : 0;
485 recv_last_byte_time_ = base::TimeTicks::Now(); 485 recv_last_byte_time_ = base::TimeTicks::Now();
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 931 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
932 state); 932 state);
933 break; 933 break;
934 } 934 }
935 return description; 935 return description;
936 } 936 }
937 937
938 #undef STATE_CASE 938 #undef STATE_CASE
939 939
940 } // namespace net 940 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream.h ('k') | net/spdy/spdy_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698