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

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

Issue 1852423004: Implement SpdySerializedFrame move semantics. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/quic/quic_headers_stream_test.cc ('k') | net/quic/test_tools/quic_test_packet_maker.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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/spdy_utils.h" 5 #include "net/quic/spdy_utils.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 10 matching lines...) Expand all
21 namespace net { 21 namespace net {
22 22
23 // static 23 // static
24 string SpdyUtils::SerializeUncompressedHeaders(const SpdyHeaderBlock& headers) { 24 string SpdyUtils::SerializeUncompressedHeaders(const SpdyHeaderBlock& headers) {
25 SpdyMajorVersion spdy_version = HTTP2; 25 SpdyMajorVersion spdy_version = HTTP2;
26 26
27 size_t length = SpdyFramer::GetSerializedLength(spdy_version, &headers); 27 size_t length = SpdyFramer::GetSerializedLength(spdy_version, &headers);
28 SpdyFrameBuilder builder(length, spdy_version); 28 SpdyFrameBuilder builder(length, spdy_version);
29 SpdyFramer framer(spdy_version); 29 SpdyFramer framer(spdy_version);
30 framer.SerializeHeaderBlockWithoutCompression(&builder, headers); 30 framer.SerializeHeaderBlockWithoutCompression(&builder, headers);
31 scoped_ptr<SpdyFrame> block(builder.take()); 31 SpdySerializedFrame block(builder.take());
32 return string(block->data(), length); 32 return string(block.data(), length);
33 } 33 }
34 34
35 // static 35 // static
36 bool SpdyUtils::ParseHeaders(const char* data, 36 bool SpdyUtils::ParseHeaders(const char* data,
37 uint32_t data_len, 37 uint32_t data_len,
38 int64_t* content_length, 38 int64_t* content_length,
39 SpdyHeaderBlock* headers) { 39 SpdyHeaderBlock* headers) {
40 SpdyFramer framer(HTTP2); 40 SpdyFramer framer(HTTP2);
41 if (!framer.ParseHeaderBlockInBuffer(data, data_len, headers) || 41 if (!framer.ParseHeaderBlockInBuffer(data, data_len, headers) ||
42 headers->empty()) { 42 headers->empty()) {
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 return GURL(GetUrlFromHeaderBlock(headers)).host(); 136 return GURL(GetUrlFromHeaderBlock(headers)).host();
137 } 137 }
138 138
139 // static 139 // static
140 bool SpdyUtils::UrlIsValid(const SpdyHeaderBlock& headers) { 140 bool SpdyUtils::UrlIsValid(const SpdyHeaderBlock& headers) {
141 string url(GetUrlFromHeaderBlock(headers)); 141 string url(GetUrlFromHeaderBlock(headers));
142 return url != "" && GURL(url).is_valid(); 142 return url != "" && GURL(url).is_valid();
143 } 143 }
144 144
145 } // namespace net 145 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_headers_stream_test.cc ('k') | net/quic/test_tools/quic_test_packet_maker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698