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

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

Issue 138243003: Implement basic classes for HPACK (HTTP/2 compression) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: And removing tabs from net.gyp... Created 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 #ifndef NET_SPDY_HPACK_HEADER_TABLE_H_
2 #define NET_SPDY_HPACK_HEADER_TABLE_H_
3
4 #include <cstddef>
5 #include <deque>
6 #include <vector>
7
8 #include "base/basictypes.h"
9 #include "base/macros.h"
10 #include "net/spdy/hpack_entry.h"
11
12 namespace net {
13
14 // All section references below are to
15 // http://tools.ietf.org/html/draft-ietf-httpbis-header-compression-04
16 // .
17
18 // A data structure for both the header table (described in 3.1.2) and
19 // the reference set (3.1.3). This structure also keeps track of how
20 // many times a header has been 'touched', which is useful for both
21 // encoding and decoding.
22 class HpackHeaderTable {
23 public:
24 HpackHeaderTable();
25
26 ~HpackHeaderTable();
27
28 uint32 size() const { return size_; }
29 uint32 max_size() const { return max_size_; }
30
31 // Returns the total number of entries.
32 uint32 GetEntryCount() const;
33
34 // The given index must be >= 0 and < GetEntryCount().
35 const HpackEntry& GetEntry(uint32 index) const;
36
37 // The given index must be >= 0 and < GetEntryCount().
38 HpackEntry* GetMutableEntry(uint32 index);
39
40 // Sets the maximum size of the header table, evicting entries if
41 // necessary as described in 3.3.2.
42 void SetMaxSize(uint32 max_size);
43
44 // The given entry must not be one from the header table, since it
45 // may get evicted. Tries to add the given entry to the header
46 // table, evicting entries if necessary as described in 3.3.3. index
47 // will be filled in with the index of the added entry, or -1 if the
48 // entry could not be added. removed_referenced_indices will be
49 // filled in with the indices of any removed entries that were in
50 // the reference set.
51 void TryAddEntry(const HpackEntry& entry,
52 int32* index,
53 std::vector<uint32>* removed_referenced_indices);
54
55 private:
56 std::deque<HpackEntry> entries_;
57 uint32 size_;
58 uint32 max_size_;
59
60 DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable);
61 };
62
63 } // namespace net
64
65 #endif // NET_SPDY_HPACK_HEADER_TABLE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698