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

Side by Side Diff: net/spdy/hpack_encoder.h

Issue 1263803002: Replace SpdyNameValueBlock typedef with SpdyHeaderBlock. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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/hpack_decoder_test.cc ('k') | net/spdy/hpack_encoder.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef NET_SPDY_HPACK_ENCODER_H_ 5 #ifndef NET_SPDY_HPACK_ENCODER_H_
6 #define NET_SPDY_HPACK_ENCODER_H_ 6 #define NET_SPDY_HPACK_ENCODER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "base/strings/string_piece.h" 15 #include "base/strings/string_piece.h"
16 #include "net/base/net_export.h" 16 #include "net/base/net_export.h"
17 #include "net/spdy/hpack_header_table.h" 17 #include "net/spdy/hpack_header_table.h"
18 #include "net/spdy/hpack_output_stream.h" 18 #include "net/spdy/hpack_output_stream.h"
19 #include "net/spdy/spdy_protocol.h"
19 20
20 // An HpackEncoder encodes header sets as outlined in 21 // An HpackEncoder encodes header sets as outlined in
21 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08 22 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-08
22 23
23 namespace net { 24 namespace net {
24 25
25 class HpackHuffmanTable; 26 class HpackHuffmanTable;
26 27
27 namespace test { 28 namespace test {
28 class HpackEncoderPeer; 29 class HpackEncoderPeer;
29 } // namespace test 30 } // namespace test
30 31
31 class NET_EXPORT_PRIVATE HpackEncoder { 32 class NET_EXPORT_PRIVATE HpackEncoder {
32 public: 33 public:
33 friend class test::HpackEncoderPeer; 34 friend class test::HpackEncoderPeer;
34 35
35 // |table| is an initialized HPACK Huffman table, having an 36 // |table| is an initialized HPACK Huffman table, having an
36 // externally-managed lifetime which spans beyond HpackEncoder. 37 // externally-managed lifetime which spans beyond HpackEncoder.
37 explicit HpackEncoder(const HpackHuffmanTable& table); 38 explicit HpackEncoder(const HpackHuffmanTable& table);
38 ~HpackEncoder(); 39 ~HpackEncoder();
39 40
40 // Encodes the given header set into the given string. Returns 41 // Encodes the given header set into the given string. Returns
41 // whether or not the encoding was successful. 42 // whether or not the encoding was successful.
42 bool EncodeHeaderSet(const std::map<std::string, std::string>& header_set, 43 bool EncodeHeaderSet(const SpdyHeaderBlock& header_set, std::string* output);
43 std::string* output);
44 44
45 // Encodes the given header set into the given string. Only non-indexed 45 // Encodes the given header set into the given string. Only non-indexed
46 // literal representations are emitted, bypassing the header table. Huffman 46 // literal representations are emitted, bypassing the header table. Huffman
47 // coding is also not used. Returns whether the encoding was successful. 47 // coding is also not used. Returns whether the encoding was successful.
48 bool EncodeHeaderSetWithoutCompression( 48 bool EncodeHeaderSetWithoutCompression(const SpdyHeaderBlock& header_set,
49 const std::map<std::string, std::string>& header_set, 49 std::string* output);
50 std::string* output);
51 50
52 // Called upon a change to SETTINGS_HEADER_TABLE_SIZE. Specifically, this 51 // Called upon a change to SETTINGS_HEADER_TABLE_SIZE. Specifically, this
53 // is to be called after receiving (and sending an acknowledgement for) a 52 // is to be called after receiving (and sending an acknowledgement for) a
54 // SETTINGS_HEADER_TABLE_SIZE update from the remote decoding endpoint. 53 // SETTINGS_HEADER_TABLE_SIZE update from the remote decoding endpoint.
55 void ApplyHeaderTableSizeSetting(size_t size_setting) { 54 void ApplyHeaderTableSizeSetting(size_t size_setting) {
56 header_table_.SetSettingsHeaderTableSize(size_setting); 55 header_table_.SetSettingsHeaderTableSize(size_setting);
57 } 56 }
58 57
59 // Sets externally-owned storage for aggregating character counts of emitted 58 // Sets externally-owned storage for aggregating character counts of emitted
60 // literal representations. 59 // literal representations.
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 // Externally-owned, nullable storage for character counts of literals. 94 // Externally-owned, nullable storage for character counts of literals.
96 std::vector<size_t>* char_counts_; 95 std::vector<size_t>* char_counts_;
97 size_t* total_char_counts_; 96 size_t* total_char_counts_;
98 97
99 DISALLOW_COPY_AND_ASSIGN(HpackEncoder); 98 DISALLOW_COPY_AND_ASSIGN(HpackEncoder);
100 }; 99 };
101 100
102 } // namespace net 101 } // namespace net
103 102
104 #endif // NET_SPDY_HPACK_ENCODER_H_ 103 #endif // NET_SPDY_HPACK_ENCODER_H_
OLDNEW
« no previous file with comments | « net/spdy/hpack_decoder_test.cc ('k') | net/spdy/hpack_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698