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

Unified Diff: net/spdy/hpack_huffman_table.cc

Issue 246073007: SPDY & HPACK: Land recent internal changes (through 65328503) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on upstream change: Expanded FRAME_TOO_LARGE/FRAME_SIZE_ERROR comment. Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/hpack_huffman_table.h ('k') | net/spdy/hpack_huffman_table_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack_huffman_table.cc
diff --git a/net/spdy/hpack_huffman_table.cc b/net/spdy/hpack_huffman_table.cc
index 02910ebf9bac85fdb79a8f5fc4cc75189425f4c4..9e8f6a1f7830f020d203add1d7b6e10f968bde60 100644
--- a/net/spdy/hpack_huffman_table.cc
+++ b/net/spdy/hpack_huffman_table.cc
@@ -248,6 +248,20 @@ void HpackHuffmanTable::EncodeString(StringPiece in,
}
}
+size_t HpackHuffmanTable::EncodedSize(StringPiece in) const {
+ size_t bit_count = 0;
+ for (size_t i = 0; i != in.size(); i++) {
+ uint16 symbol_id = static_cast<uint8>(in[i]);
+ CHECK_GT(code_by_id_.size(), symbol_id);
+
+ bit_count += length_by_id_[symbol_id];
+ }
+ if (bit_count % 8 != 0) {
+ bit_count += 8 - bit_count % 8;
+ }
+ return bit_count / 8;
+}
+
bool HpackHuffmanTable::DecodeString(HpackInputStream* in,
size_t out_capacity,
string* out) const {
« no previous file with comments | « net/spdy/hpack_huffman_table.h ('k') | net/spdy/hpack_huffman_table_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698