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

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

Issue 265763011: Land recent SPDY changes (through 66310528) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/hpack_huffman_table_test.cc ('k') | net/spdy/hpack_input_stream.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_INPUT_STREAM_H_ 5 #ifndef NET_SPDY_HPACK_INPUT_STREAM_H_
6 #define NET_SPDY_HPACK_INPUT_STREAM_H_ 6 #define NET_SPDY_HPACK_INPUT_STREAM_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/strings/string_piece.h" 12 #include "base/strings/string_piece.h"
13 #include "net/base/net_export.h" 13 #include "net/base/net_export.h"
14 #include "net/spdy/hpack_constants.h" 14 #include "net/spdy/hpack_constants.h"
15 #include "net/spdy/hpack_huffman_table.h" 15 #include "net/spdy/hpack_huffman_table.h"
16 16
17 // All section references below are to 17 // All section references below are to
18 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-06 18 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-07
19 19
20 namespace net { 20 namespace net {
21 21
22 // An HpackInputStream handles all the low-level details of decoding 22 // An HpackInputStream handles all the low-level details of decoding
23 // header fields. 23 // header fields.
24 class NET_EXPORT_PRIVATE HpackInputStream { 24 class NET_EXPORT_PRIVATE HpackInputStream {
25 public: 25 public:
26 // |max_string_literal_size| is the largest that any one string 26 // |max_string_literal_size| is the largest that any one string
27 // literal (header name or header value) can be. 27 // literal (header name or header value) can be.
28 HpackInputStream(uint32 max_string_literal_size, base::StringPiece buffer); 28 HpackInputStream(uint32 max_string_literal_size, base::StringPiece buffer);
29 ~HpackInputStream(); 29 ~HpackInputStream();
30 30
31 // Returns whether or not there is more data to process. 31 // Returns whether or not there is more data to process.
32 bool HasMoreData() const; 32 bool HasMoreData() const;
33 33
34 // If the next octet has the top |size| bits equal to |bits|, 34 // If the next bits of input match |prefix|, consumes them and returns true.
35 // consumes it and returns true. Otherwise, consumes nothing and 35 // Otherwise, consumes nothing and returns false.
36 // returns false.
37 bool MatchPrefixAndConsume(HpackPrefix prefix); 36 bool MatchPrefixAndConsume(HpackPrefix prefix);
38 37
39 // The Decode* functions return true and fill in their arguments if 38 // The Decode* functions return true and fill in their arguments if
40 // decoding was successful, or false if an error was encountered. 39 // decoding was successful, or false if an error was encountered.
41 40
42 bool DecodeNextUint32(uint32* I); 41 bool DecodeNextUint32(uint32* I);
43 bool DecodeNextIdentityString(base::StringPiece* str); 42 bool DecodeNextIdentityString(base::StringPiece* str);
44 bool DecodeNextHuffmanString(const HpackHuffmanTable& table, 43 bool DecodeNextHuffmanString(const HpackHuffmanTable& table,
45 std::string* str); 44 std::string* str);
46 45
(...skipping 10 matching lines...) Expand all
57 // If not currently on a byte boundary, consumes and discards 56 // If not currently on a byte boundary, consumes and discards
58 // remaining bits in the current byte. 57 // remaining bits in the current byte.
59 void ConsumeByteRemainder(); 58 void ConsumeByteRemainder();
60 59
61 // Accessors for testing. 60 // Accessors for testing.
62 61
63 void SetBitOffsetForTest(size_t bit_offset) { 62 void SetBitOffsetForTest(size_t bit_offset) {
64 bit_offset_ = bit_offset; 63 bit_offset_ = bit_offset;
65 } 64 }
66 65
67 bool DecodeNextUint32ForTest(uint32* I) {
68 return DecodeNextUint32(I);
69 }
70
71 private: 66 private:
72 const uint32 max_string_literal_size_; 67 const uint32 max_string_literal_size_;
73 base::StringPiece buffer_; 68 base::StringPiece buffer_;
74 size_t bit_offset_; 69 size_t bit_offset_;
75 70
76 bool PeekNextOctet(uint8* next_octet); 71 bool PeekNextOctet(uint8* next_octet);
77 72
78 bool DecodeNextOctet(uint8* next_octet); 73 bool DecodeNextOctet(uint8* next_octet);
79 74
80 DISALLOW_COPY_AND_ASSIGN(HpackInputStream); 75 DISALLOW_COPY_AND_ASSIGN(HpackInputStream);
81 }; 76 };
82 77
83 } // namespace net 78 } // namespace net
84 79
85 #endif // NET_SPDY_HPACK_INPUT_STREAM_H_ 80 #endif // NET_SPDY_HPACK_INPUT_STREAM_H_
OLDNEW
« no previous file with comments | « net/spdy/hpack_huffman_table_test.cc ('k') | net/spdy/hpack_input_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698