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

Unified Diff: net/spdy/hpack/hpack_input_stream.h

Issue 1568423002: Implement better HPACK Huffman code decoder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Do not use binary literals. Created 4 years, 11 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/hpack_huffman_table_test.cc ('k') | net/spdy/hpack/hpack_input_stream.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack/hpack_input_stream.h
diff --git a/net/spdy/hpack/hpack_input_stream.h b/net/spdy/hpack/hpack_input_stream.h
index e7787f7c8d8041913e58f2920e19c9e304167695..ab716d0eff41f46602dc5d082d80cd95c028dbd1 100644
--- a/net/spdy/hpack/hpack_input_stream.h
+++ b/net/spdy/hpack/hpack_input_stream.h
@@ -9,6 +9,7 @@
#include <stdint.h>
#include <string>
+#include <utility>
#include "base/macros.h"
#include "base/strings/string_piece.h"
@@ -21,6 +22,8 @@
namespace net {
+typedef std::pair<size_t, uint32_t> InitialPeekResult;
+
// An HpackInputStream handles all the low-level details of decoding
// header fields.
class NET_EXPORT_PRIVATE HpackInputStream {
@@ -42,16 +45,26 @@ class NET_EXPORT_PRIVATE HpackInputStream {
bool DecodeNextUint32(uint32_t* I);
bool DecodeNextIdentityString(base::StringPiece* str);
- bool DecodeNextHuffmanString(const HpackHuffmanTable& table,
- std::string* str);
+ bool DecodeNextHuffmanString(std::string* str);
// Stores input bits into the most-significant, unfilled bits of |out|.
// |peeked_count| is the number of filled bits in |out| which have been
// previously peeked. PeekBits() will fill some number of remaining bits,
// returning the new total number via |peeked_count|. Returns true if one
- // or more additional bits could be peeked, and false otherwise.
+ // or more additional bits were added to |out|, and false otherwise.
bool PeekBits(size_t* peeked_count, uint32_t* out) const;
+ // Similar to PeekBits, but intended to be used when starting to decode a
+ // Huffman encoded string. Returns a pair containing the peeked_count and
+ // out values as described for PeekBits, with the bits from the first N bytes
+ // of buffer_, where N == min(4, buffer_.size()), starting with the high
+ // order bits.
+ // Should only be called when first peeking at bits from the input stream as
+ // it does not take peeked_count as an input, so doesn't know how many bits
+ // have already been returned by previous calls to InitializePeekBits and
+ // PeekBits.
+ InitialPeekResult InitializePeekBits();
+
// Consumes |count| bits of input. Generally paired with PeekBits().
void ConsumeBits(size_t count);
« no previous file with comments | « net/spdy/hpack/hpack_huffman_table_test.cc ('k') | net/spdy/hpack/hpack_input_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698