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

Unified Diff: net/tools/quic/quic_simple_server_stream.cc

Issue 2093553004: Reduce SpdyHeaderBlock copies with move semantics in shared code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove non-shared files (into a separate CL). 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/tools/quic/quic_simple_server_stream.h ('k') | net/tools/quic/quic_spdy_client_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/tools/quic/quic_simple_server_stream.cc
diff --git a/net/tools/quic/quic_simple_server_stream.cc b/net/tools/quic/quic_simple_server_stream.cc
index 21a7a8fd2adddda326d9e036a2e0f9cddf271dff..27c4dfd4f4a1e792ece44748041b264a2d1054c1 100644
--- a/net/tools/quic/quic_simple_server_stream.cc
+++ b/net/tools/quic/quic_simple_server_stream.cc
@@ -5,6 +5,7 @@
#include "net/tools/quic/quic_simple_server_stream.h"
#include <list>
+#include <utility>
#include "base/logging.h"
#include "base/stl_util.h"
@@ -211,7 +212,7 @@ void QuicSimpleServerStream::SendNotFoundResponse() {
SpdyHeaderBlock headers;
headers[":status"] = "404";
headers["content-length"] = base::IntToString(strlen(kNotFoundResponseBody));
- SendHeadersAndBody(headers, kNotFoundResponseBody);
+ SendHeadersAndBody(std::move(headers), kNotFoundResponseBody);
}
void QuicSimpleServerStream::SendErrorResponse() {
@@ -219,19 +220,20 @@ void QuicSimpleServerStream::SendErrorResponse() {
SpdyHeaderBlock headers;
headers[":status"] = "500";
headers["content-length"] = base::UintToString(strlen(kErrorResponseBody));
- SendHeadersAndBody(headers, kErrorResponseBody);
+ SendHeadersAndBody(std::move(headers), kErrorResponseBody);
}
void QuicSimpleServerStream::SendHeadersAndBody(
- const SpdyHeaderBlock& response_headers,
+ SpdyHeaderBlock response_headers,
StringPiece body) {
- SendHeadersAndBodyAndTrailers(response_headers, body, SpdyHeaderBlock());
+ SendHeadersAndBodyAndTrailers(std::move(response_headers), body,
+ SpdyHeaderBlock());
}
void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers(
- const SpdyHeaderBlock& response_headers,
+ SpdyHeaderBlock response_headers,
StringPiece body,
- const SpdyHeaderBlock& response_trailers) {
+ SpdyHeaderBlock response_trailers) {
// This server only supports SPDY and HTTP, and neither handles bidirectional
// streaming.
if (!reading_stopped()) {
@@ -242,7 +244,7 @@ void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers(
bool send_fin = (body.empty() && response_trailers.empty());
DVLOG(1) << "Writing headers (fin = " << send_fin
<< ") : " << response_headers.DebugString();
- WriteHeaders(response_headers, send_fin, nullptr);
+ WriteHeaders(std::move(response_headers), send_fin, nullptr);
if (send_fin) {
// Nothing else to send.
return;
@@ -261,7 +263,7 @@ void QuicSimpleServerStream::SendHeadersAndBodyAndTrailers(
// Send the trailers. A FIN is always sent with trailers.
DVLOG(1) << "Writing trailers (fin = true): "
<< response_trailers.DebugString();
- WriteTrailers(response_trailers, nullptr);
+ WriteTrailers(std::move(response_trailers), nullptr);
}
const char* const QuicSimpleServerStream::kErrorResponseBody = "bad";
« no previous file with comments | « net/tools/quic/quic_simple_server_stream.h ('k') | net/tools/quic/quic_spdy_client_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698