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

Side by Side Diff: net/quic/bidirectional_stream_quic_impl.cc

Issue 2096713002: Reduce SpdyHeaderBlock copies with move semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: clear() does not work after all. Created 4 years, 6 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/quic/bidirectional_stream_quic_impl.h" 5 #include "net/quic/bidirectional_stream_quic_impl.h"
6 6
7 #include <utility>
8
7 #include "base/bind.h" 9 #include "base/bind.h"
8 #include "base/location.h" 10 #include "base/location.h"
9 #include "base/logging.h" 11 #include "base/logging.h"
10 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
11 #include "net/http/bidirectional_stream_request_info.h" 13 #include "net/http/bidirectional_stream_request_info.h"
12 #include "net/quic/quic_connection.h" 14 #include "net/quic/quic_connection.h"
13 #include "net/socket/next_proto.h" 15 #include "net/socket/next_proto.h"
14 #include "net/spdy/spdy_header_block.h" 16 #include "net/spdy/spdy_header_block.h"
15 #include "net/spdy/spdy_http_utils.h" 17 #include "net/spdy/spdy_http_utils.h"
16 18
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 SpdyHeaderBlock headers; 91 SpdyHeaderBlock headers;
90 HttpRequestInfo http_request_info; 92 HttpRequestInfo http_request_info;
91 http_request_info.url = request_info_->url; 93 http_request_info.url = request_info_->url;
92 http_request_info.method = request_info_->method; 94 http_request_info.method = request_info_->method;
93 http_request_info.extra_headers = request_info_->extra_headers; 95 http_request_info.extra_headers = request_info_->extra_headers;
94 96
95 CreateSpdyHeadersFromHttpRequest(http_request_info, 97 CreateSpdyHeadersFromHttpRequest(http_request_info,
96 http_request_info.extra_headers, HTTP2, true, 98 http_request_info.extra_headers, HTTP2, true,
97 &headers); 99 &headers);
98 size_t headers_bytes_sent = stream_->WriteHeaders( 100 size_t headers_bytes_sent = stream_->WriteHeaders(
99 headers, request_info_->end_stream_on_headers, nullptr); 101 std::move(headers), request_info_->end_stream_on_headers, nullptr);
100 headers_bytes_sent_ += headers_bytes_sent; 102 headers_bytes_sent_ += headers_bytes_sent;
101 has_sent_headers_ = true; 103 has_sent_headers_ = true;
102 } 104 }
103 105
104 int BidirectionalStreamQuicImpl::ReadData(IOBuffer* buffer, int buffer_len) { 106 int BidirectionalStreamQuicImpl::ReadData(IOBuffer* buffer, int buffer_len) {
105 DCHECK(buffer); 107 DCHECK(buffer);
106 DCHECK(buffer_len); 108 DCHECK(buffer_len);
107 109
108 if (!stream_) { 110 if (!stream_) {
109 // If the stream is already closed, there is no body to read. 111 // If the stream is already closed, there is no body to read.
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 void BidirectionalStreamQuicImpl::ResetStream() { 348 void BidirectionalStreamQuicImpl::ResetStream() {
347 if (!stream_) 349 if (!stream_)
348 return; 350 return;
349 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 351 closed_stream_received_bytes_ = stream_->stream_bytes_read();
350 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 352 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
351 stream_->SetDelegate(nullptr); 353 stream_->SetDelegate(nullptr);
352 stream_ = nullptr; 354 stream_ = nullptr;
353 } 355 }
354 356
355 } // namespace net 357 } // namespace net
OLDNEW
« no previous file with comments | « net/http/http_proxy_client_socket_pool_unittest.cc ('k') | net/quic/bidirectional_stream_quic_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698