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

Unified Diff: net/spdy/hpack_header_table.h

Issue 290003006: Land recent SPDY changes (through 67282679) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase on nullptr => NULL 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/hpack_entry_test.cc ('k') | net/spdy/hpack_header_table.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/hpack_header_table.h
diff --git a/net/spdy/hpack_header_table.h b/net/spdy/hpack_header_table.h
index d9eac73c8f1f4ede707b05e792ffc9ecb319484d..5f70b5bab646a03b5a39abdb601f9a4721ed0a96 100644
--- a/net/spdy/hpack_header_table.h
+++ b/net/spdy/hpack_header_table.h
@@ -36,6 +36,21 @@ class NET_EXPORT_PRIVATE HpackHeaderTable {
// extended to map to list iterators.
typedef std::deque<HpackEntry> EntryTable;
+ // Implements a total ordering of HpackEntry on name(), value(), then index
+ // ascending. Note that index may change over the lifetime of an HpackEntry,
+ // but the relative index order of two entries will not. This comparator is
+ // 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;
+
HpackHeaderTable();
~HpackHeaderTable();
@@ -48,7 +63,7 @@ class NET_EXPORT_PRIVATE HpackHeaderTable {
size_t size() const { return size_; }
size_t max_size() const { return max_size_; }
- const HpackEntry::OrderedSet& reference_set() {
+ const OrderedEntrySet& reference_set() {
return reference_set_;
}
@@ -62,6 +77,9 @@ class NET_EXPORT_PRIVATE HpackHeaderTable {
HpackEntry* GetByNameAndValue(base::StringPiece name,
base::StringPiece value);
+ // Returns the index of an entry within this header table.
+ size_t IndexOf(const HpackEntry* entry) const;
+
// Sets the maximum size of the header table, evicting entries if
// necessary as described in 3.3.2.
void SetMaxSize(size_t max_size);
@@ -109,9 +127,9 @@ class NET_EXPORT_PRIVATE HpackHeaderTable {
EntryTable static_entries_;
// Full table index, over |dynamic_entries_| and |static_entries_|.
- HpackEntry::OrderedSet index_;
+ OrderedEntrySet index_;
// The reference set is strictly a subset of |dynamic_entries_|.
- HpackEntry::OrderedSet reference_set_;
+ OrderedEntrySet reference_set_;
// Last acknowledged value for SETTINGS_HEADER_TABLE_SIZE.
size_t settings_size_bound_;
@@ -122,13 +140,9 @@ class NET_EXPORT_PRIVATE HpackHeaderTable {
size_t max_size_;
// Total number of table insertions which have occurred. Referenced by
- // dynamic HpackEntry instances for determination of table index.
+ // IndexOf() for determination of an HpackEntry's table index.
size_t total_insertions_;
- // Current number of dynamic entries. Referenced by static HpackEntry
- // instances for determination of table index.
- size_t dynamic_entries_count_;
-
DISALLOW_COPY_AND_ASSIGN(HpackHeaderTable);
};
« no previous file with comments | « net/spdy/hpack_entry_test.cc ('k') | net/spdy/hpack_header_table.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698