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

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

Issue 2570513003: This change removes HpackEncoder::EncodeHeaderSetWithoutCompression() and the corresponding progres… (Closed)
Patch Set: Created 4 years 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 | « no previous file | net/spdy/hpack/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_HPACK_ENCODER_H_ 5 #ifndef NET_SPDY_HPACK_HPACK_ENCODER_H_
6 #define NET_SPDY_HPACK_HPACK_ENCODER_H_ 6 #define NET_SPDY_HPACK_HPACK_ENCODER_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <functional> 10 #include <functional>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 ~HpackEncoder(); 53 ~HpackEncoder();
54 54
55 // Encodes a sequence of Representations into the given string. 55 // Encodes a sequence of Representations into the given string.
56 void EncodeHeaderSet(const Representations& representations, 56 void EncodeHeaderSet(const Representations& representations,
57 std::string* output); 57 std::string* output);
58 58
59 // Encodes the given header set into the given string. Returns 59 // Encodes the given header set into the given string. Returns
60 // whether or not the encoding was successful. 60 // whether or not the encoding was successful.
61 bool EncodeHeaderSet(const SpdyHeaderBlock& header_set, std::string* output); 61 bool EncodeHeaderSet(const SpdyHeaderBlock& header_set, std::string* output);
62 62
63 // Encodes the given header set into the given string. Only non-indexed
64 // literal representations are emitted, bypassing the header table. Huffman
65 // coding is also not used. Returns whether the encoding was successful.
66 bool EncodeHeaderSetWithoutCompression(const SpdyHeaderBlock& header_set,
67 std::string* output);
68
69 class NET_EXPORT_PRIVATE ProgressiveEncoder { 63 class NET_EXPORT_PRIVATE ProgressiveEncoder {
70 public: 64 public:
71 virtual ~ProgressiveEncoder() {} 65 virtual ~ProgressiveEncoder() {}
72 66
73 // Returns true iff more remains to encode. 67 // Returns true iff more remains to encode.
74 virtual bool HasNext() const = 0; 68 virtual bool HasNext() const = 0;
75 69
76 // Encodes up to max_encoded_bytes of the current header block into the 70 // Encodes up to max_encoded_bytes of the current header block into the
77 // given output string. 71 // given output string.
78 virtual void Next(size_t max_encoded_bytes, std::string* output) = 0; 72 virtual void Next(size_t max_encoded_bytes, std::string* output) = 0;
79 }; 73 };
80 74
81 // Returns a ProgressiveEncoder which must be outlived by both the given 75 // Returns a ProgressiveEncoder which must be outlived by both the given
82 // SpdyHeaderBlock and this object. 76 // SpdyHeaderBlock and this object.
83 std::unique_ptr<ProgressiveEncoder> EncodeHeaderSet( 77 std::unique_ptr<ProgressiveEncoder> EncodeHeaderSet(
84 const SpdyHeaderBlock& header_set, 78 const SpdyHeaderBlock& header_set);
85 bool use_compression);
86 79
87 // Called upon a change to SETTINGS_HEADER_TABLE_SIZE. Specifically, this 80 // Called upon a change to SETTINGS_HEADER_TABLE_SIZE. Specifically, this
88 // is to be called after receiving (and sending an acknowledgement for) a 81 // is to be called after receiving (and sending an acknowledgement for) a
89 // SETTINGS_HEADER_TABLE_SIZE update from the remote decoding endpoint. 82 // SETTINGS_HEADER_TABLE_SIZE update from the remote decoding endpoint.
90 void ApplyHeaderTableSizeSetting(size_t size_setting); 83 void ApplyHeaderTableSizeSetting(size_t size_setting);
91 84
92 size_t CurrentHeaderTableSizeSetting() const { 85 size_t CurrentHeaderTableSizeSetting() const {
93 return header_table_.settings_size_bound(); 86 return header_table_.settings_size_bound();
94 } 87 }
95 88
96 // This HpackEncoder will use |policy| to determine whether to insert header 89 // This HpackEncoder will use |policy| to determine whether to insert header
97 // name-value pairs into the dynamic table. 90 // name-value pairs into the dynamic table.
98 void SetIndexingPolicy(IndexingPolicy policy) { should_index_ = policy; } 91 void SetIndexingPolicy(IndexingPolicy policy) { should_index_ = policy; }
99 92
100 // |listener| will be invoked for each header name-value pair processed by 93 // |listener| will be invoked for each header name-value pair processed by
101 // this encoder. 94 // this encoder.
102 void SetHeaderListener(HeaderListener listener) { listener_ = listener; } 95 void SetHeaderListener(HeaderListener listener) { listener_ = listener; }
103 96
104 void SetHeaderTableDebugVisitor( 97 void SetHeaderTableDebugVisitor(
105 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) { 98 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) {
106 header_table_.set_debug_visitor(std::move(visitor)); 99 header_table_.set_debug_visitor(std::move(visitor));
107 } 100 }
108 101
102 void DisableCompression() { enable_compression_ = false; }
103
109 private: 104 private:
110 friend class test::HpackEncoderPeer; 105 friend class test::HpackEncoderPeer;
111 106
112 class RepresentationIterator; 107 class RepresentationIterator;
113 class Encoderator; 108 class Encoderator;
114 109
115 // Encodes a sequence of header name-value pairs as a single header block. 110 // Encodes a sequence of header name-value pairs as a single header block.
116 void EncodeRepresentations(RepresentationIterator* iter, std::string* output); 111 void EncodeRepresentations(RepresentationIterator* iter, std::string* output);
117 112
118 // Emits a static/dynamic indexed representation (Section 7.1). 113 // Emits a static/dynamic indexed representation (Section 7.1).
(...skipping 23 matching lines...) Expand all
142 static void GatherRepresentation(const Representation& header_field, 137 static void GatherRepresentation(const Representation& header_field,
143 Representations* out); 138 Representations* out);
144 139
145 HpackHeaderTable header_table_; 140 HpackHeaderTable header_table_;
146 HpackOutputStream output_stream_; 141 HpackOutputStream output_stream_;
147 142
148 const HpackHuffmanTable& huffman_table_; 143 const HpackHuffmanTable& huffman_table_;
149 size_t min_table_size_setting_received_; 144 size_t min_table_size_setting_received_;
150 HeaderListener listener_; 145 HeaderListener listener_;
151 IndexingPolicy should_index_; 146 IndexingPolicy should_index_;
152 bool allow_huffman_compression_; 147 bool enable_compression_;
153 bool should_emit_table_size_; 148 bool should_emit_table_size_;
154 149
155 DISALLOW_COPY_AND_ASSIGN(HpackEncoder); 150 DISALLOW_COPY_AND_ASSIGN(HpackEncoder);
156 }; 151 };
157 152
158 } // namespace net 153 } // namespace net
159 154
160 #endif // NET_SPDY_HPACK_HPACK_ENCODER_H_ 155 #endif // NET_SPDY_HPACK_HPACK_ENCODER_H_
OLDNEW
« no previous file with comments | « no previous file | net/spdy/hpack/hpack_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698