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

Unified Diff: net/spdy/buffered_spdy_framer.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/buffered_spdy_framer.h ('k') | net/spdy/buffered_spdy_framer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/buffered_spdy_framer.cc
diff --git a/net/spdy/buffered_spdy_framer.cc b/net/spdy/buffered_spdy_framer.cc
index 2133b03dd5b2d4405a7e6cea2b6951d855612f8b..0a48f163e6400c7f5df113bba90672f6110b0f1b 100644
--- a/net/spdy/buffered_spdy_framer.cc
+++ b/net/spdy/buffered_spdy_framer.cc
@@ -4,6 +4,8 @@
#include "net/spdy/buffered_spdy_framer.h"
+#include <utility>
+
#include "base/logging.h"
#include "base/strings/string_util.h"
@@ -376,14 +378,12 @@ SpdySerializedFrame* BufferedSpdyFramer::CreateSynStream(
SpdyStreamId associated_stream_id,
SpdyPriority priority,
SpdyControlFlags flags,
- const SpdyHeaderBlock* headers) {
- SpdySynStreamIR syn_stream(stream_id);
+ SpdyHeaderBlock headers) {
+ SpdySynStreamIR syn_stream(stream_id, std::move(headers));
syn_stream.set_associated_to_stream_id(associated_stream_id);
syn_stream.set_priority(priority);
syn_stream.set_fin((flags & CONTROL_FLAG_FIN) != 0);
syn_stream.set_unidirectional((flags & CONTROL_FLAG_UNIDIRECTIONAL) != 0);
- // TODO(hkhalil): Avoid copy here.
- syn_stream.set_header_block(*headers);
return new SpdySerializedFrame(spdy_framer_.SerializeSynStream(syn_stream));
}
@@ -392,11 +392,9 @@ SpdySerializedFrame* BufferedSpdyFramer::CreateSynStream(
SpdySerializedFrame* BufferedSpdyFramer::CreateSynReply(
SpdyStreamId stream_id,
SpdyControlFlags flags,
- const SpdyHeaderBlock* headers) {
- SpdySynReplyIR syn_reply(stream_id);
+ SpdyHeaderBlock headers) {
+ SpdySynReplyIR syn_reply(stream_id, std::move(headers));
syn_reply.set_fin(flags & CONTROL_FLAG_FIN);
- // TODO(hkhalil): Avoid copy here.
- syn_reply.set_header_block(*headers);
return new SpdySerializedFrame(spdy_framer_.SerializeSynReply(syn_reply));
}
@@ -448,14 +446,13 @@ SpdySerializedFrame* BufferedSpdyFramer::CreateHeaders(
SpdyStreamId stream_id,
SpdyControlFlags flags,
int weight,
- const SpdyHeaderBlock* headers) {
- SpdyHeadersIR headers_ir(stream_id);
+ SpdyHeaderBlock headers) {
+ SpdyHeadersIR headers_ir(stream_id, std::move(headers));
headers_ir.set_fin((flags & CONTROL_FLAG_FIN) != 0);
if (flags & HEADERS_FLAG_PRIORITY) {
headers_ir.set_has_priority(true);
headers_ir.set_weight(weight);
}
- headers_ir.set_header_block(*headers);
return new SpdySerializedFrame(spdy_framer_.SerializeHeaders(headers_ir));
}
@@ -483,9 +480,9 @@ SpdySerializedFrame* BufferedSpdyFramer::CreateDataFrame(SpdyStreamId stream_id,
SpdySerializedFrame* BufferedSpdyFramer::CreatePushPromise(
SpdyStreamId stream_id,
SpdyStreamId promised_stream_id,
- const SpdyHeaderBlock* headers) {
- SpdyPushPromiseIR push_promise_ir(stream_id, promised_stream_id);
- push_promise_ir.set_header_block(*headers);
+ SpdyHeaderBlock headers) {
+ SpdyPushPromiseIR push_promise_ir(stream_id, promised_stream_id,
+ std::move(headers));
return new SpdySerializedFrame(
spdy_framer_.SerializePushPromise(push_promise_ir));
}
« no previous file with comments | « net/spdy/buffered_spdy_framer.h ('k') | net/spdy/buffered_spdy_framer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698