OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef NET_SPDY_HPACK_HPACK_STATIC_TABLE_H_ | |
6 #define NET_SPDY_HPACK_HPACK_STATIC_TABLE_H_ | |
7 | |
8 #include <stddef.h> | |
9 | |
10 #include "net/base/net_export.h" | |
11 #include "net/spdy/hpack/hpack_header_table.h" | |
12 | |
13 namespace net { | |
14 | |
15 struct HpackStaticEntry; | |
16 | |
17 // HpackStaticTable provides |static_entries_| and |static_index_| for HPACK | |
18 // encoding and decoding contexts. Once initialized, an instance is read only | |
19 // and may be accessed only through its const interface. Such an instance may | |
20 // be shared accross multiple HPACK contexts. | |
21 class NET_EXPORT_PRIVATE HpackStaticTable { | |
22 public: | |
23 HpackStaticTable(); | |
24 ~HpackStaticTable(); | |
25 | |
26 // Prepares HpackStaticTable by filling up static_entries_ and static_index_ | |
27 // from an array of struct HpackStaticEntry. Must be called exactly once. | |
28 void Initialize(const HpackStaticEntry* static_entry_table, | |
29 size_t static_entry_count); | |
30 | |
31 // Returns whether Initialize() has been called. | |
32 bool IsInitialized() const; | |
33 | |
34 // Accessors. | |
35 const HpackHeaderTable::EntryTable& GetStaticEntries() const { | |
36 return static_entries_; | |
37 } | |
38 const HpackHeaderTable::UnorderedEntrySet& GetStaticIndex() const { | |
39 return static_index_; | |
40 } | |
41 const HpackHeaderTable::NameToEntryMap& GetStaticNameIndex() const { | |
42 return static_name_index_; | |
43 } | |
44 | |
45 // Returns the estimate of dynamically allocated memory in bytes. | |
46 size_t EstimateMemoryUsage() const; | |
47 | |
48 private: | |
49 HpackHeaderTable::EntryTable static_entries_; | |
50 HpackHeaderTable::UnorderedEntrySet static_index_; | |
51 HpackHeaderTable::NameToEntryMap static_name_index_; | |
52 }; | |
53 | |
54 } // namespace net | |
55 | |
56 #endif // NET_SPDY_HPACK_HPACK_STATIC_TABLE_H_ | |
OLD | NEW |