Index: net/spdy/hpack_header_table.h |
diff --git a/net/spdy/hpack_header_table.h b/net/spdy/hpack_header_table.h |
index 2370ba557cd2a54f38ee817dab088782c020a213..def42afcc3445ab20ebbd8b99e1aeb05dfe4cdaa 100644 |
--- a/net/spdy/hpack_header_table.h |
+++ b/net/spdy/hpack_header_table.h |
@@ -19,6 +19,8 @@ |
namespace net { |
+using base::StringPiece; |
+ |
namespace test { |
class HpackHeaderTablePeer; |
} // namespace test |
@@ -31,7 +33,7 @@ class NET_EXPORT_PRIVATE HpackHeaderTable { |
// HpackHeaderTable takes advantage of the deque property that references |
// remain valid, so long as insertions & deletions are at the head & tail. |
// If this changes (eg we start to drop entries from the middle of the table), |
- // this needs to be a std::list, in which case |index_| can be trivially |
+ // this needs to be a std::list, in which case |*_index_| can be trivially |
// extended to map to list iterators. |
typedef std::deque<HpackEntry> EntryTable; |
@@ -41,12 +43,7 @@ class NET_EXPORT_PRIVATE HpackHeaderTable { |
// composed with the 'lookup' HpackEntry constructor to allow for efficient |
// lower-bounding of matching entries. |
struct NET_EXPORT_PRIVATE EntryComparator { |
- explicit EntryComparator(HpackHeaderTable* table) : table_(table) {} |
- |
bool operator() (const HpackEntry* lhs, const HpackEntry* rhs) const; |
- |
- private: |
- HpackHeaderTable* table_; |
}; |
typedef std::set<HpackEntry*, EntryComparator> OrderedEntrySet; |
@@ -63,14 +60,13 @@ class NET_EXPORT_PRIVATE HpackHeaderTable { |
size_t max_size() const { return max_size_; } |
// Returns the entry matching the index, or NULL. |
- HpackEntry* GetByIndex(size_t index); |
+ const HpackEntry* GetByIndex(size_t index); |
// Returns the lowest-value entry having |name|, or NULL. |
- HpackEntry* GetByName(base::StringPiece name); |
+ const HpackEntry* GetByName(StringPiece name); |
// Returns the lowest-index matching entry, or NULL. |
- HpackEntry* GetByNameAndValue(base::StringPiece name, |
- base::StringPiece value); |
+ const HpackEntry* GetByNameAndValue(StringPiece name, StringPiece value); |
// Returns the index of an entry within this header table. |
size_t IndexOf(const HpackEntry* entry) const; |
@@ -86,7 +82,8 @@ class NET_EXPORT_PRIVATE HpackHeaderTable { |
// Determine the set of entries which would be evicted by the insertion |
// of |name| & |value| into the table, as per section 3.3.3. No eviction |
// actually occurs. The set is returned via range [begin_out, end_out). |
- void EvictionSet(base::StringPiece name, base::StringPiece value, |
+ void EvictionSet(StringPiece name, |
+ StringPiece value, |
EntryTable::iterator* begin_out, |
EntryTable::iterator* end_out); |
@@ -94,14 +91,13 @@ class NET_EXPORT_PRIVATE HpackHeaderTable { |
// and |value| must not be owned by an entry which could be evicted. The |
// added HpackEntry is returned, or NULL is returned if all entries were |
// evicted and the empty table is of insufficent size for the representation. |
- HpackEntry* TryAddEntry(base::StringPiece name, base::StringPiece value); |
+ const HpackEntry* TryAddEntry(StringPiece name, StringPiece value); |
void DebugLogTableState() const; |
private: |
// Returns number of evictions required to enter |name| & |value|. |
- size_t EvictionCountForEntry(base::StringPiece name, |
- base::StringPiece value) const; |
+ size_t EvictionCountForEntry(StringPiece name, StringPiece value) const; |
// Returns number of evictions required to reclaim |reclaim_size| table size. |
size_t EvictionCountToReclaim(size_t reclaim_size) const; |
@@ -109,11 +105,13 @@ class NET_EXPORT_PRIVATE HpackHeaderTable { |
// Evicts |count| oldest entries from the table. |
void Evict(size_t count); |
+ // |static_entries_| and |static_index_| are owned by HpackStaticTable |
+ // singleton. |
+ const EntryTable& static_entries_; |
EntryTable dynamic_entries_; |
- EntryTable static_entries_; |
- // Full table index, over |dynamic_entries_| and |static_entries_|. |
- OrderedEntrySet index_; |
+ const OrderedEntrySet& static_index_; |
+ OrderedEntrySet dynamic_index_; |
// Last acknowledged value for SETTINGS_HEADER_TABLE_SIZE. |
size_t settings_size_bound_; |