| Index: net/spdy/hpack_entry.h
|
| diff --git a/net/spdy/hpack_entry.h b/net/spdy/hpack_entry.h
|
| index 0f0bf0ce184b25321de131b936a9a87d47f2ebc2..53d7e28614d599fbb3487597efdafa7222c4d29d 100644
|
| --- a/net/spdy/hpack_entry.h
|
| +++ b/net/spdy/hpack_entry.h
|
| @@ -27,40 +27,24 @@ class NET_EXPORT_PRIVATE HpackEntry {
|
| // get the size of an HpackEntry as defined in 3.3.1.
|
| static const size_t kSizeOverhead;
|
|
|
| - // 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 Comparator {
|
| - bool operator() (const HpackEntry* lhs, const HpackEntry* rhs) const;
|
| - };
|
| - typedef std::set<HpackEntry*, Comparator> OrderedSet;
|
| -
|
| // Creates an entry. Preconditions:
|
| // - |is_static| captures whether this entry is a member of the static
|
| // or dynamic header table.
|
| // - |insertion_index| is this entry's index in the total set of entries ever
|
| // inserted into the header table (including static entries).
|
| - // - |total_table_insertions_or_current_size| references an externally-
|
| - // updated count of either the total number of header insertions (if
|
| - // !|is_static|), or the current size of the header table (if |is_static|).
|
| //
|
| - // The combination of |is_static|, |insertion_index|, and
|
| - // |total_table_insertions_or_current_size| allows an HpackEntry to determine
|
| - // its current table index in O(1) time.
|
| + // The combination of |is_static| and |insertion_index| allows an
|
| + // HpackEntryTable to determine the index of an HpackEntry in O(1) time.
|
| HpackEntry(base::StringPiece name,
|
| base::StringPiece value,
|
| bool is_static,
|
| - size_t insertion_index,
|
| - const size_t* total_table_insertions_or_current_size);
|
| + size_t insertion_index);
|
|
|
| // Create a 'lookup' entry (only) suitable for querying a HpackEntrySet. The
|
| - // instance Index() always returns 0, and will lower-bound all entries
|
| - // matching |name| & |value| in an OrderedSet.
|
| + // instance InsertionIndex() always returns 0 and IsLookup() returns true.
|
| HpackEntry(base::StringPiece name, base::StringPiece value);
|
|
|
| - // Creates an entry with empty name a value. Only defined so that
|
| + // Creates an entry with empty name and value. Only defined so that
|
| // entries can be stored in STL containers.
|
| HpackEntry();
|
|
|
| @@ -71,15 +55,18 @@ class NET_EXPORT_PRIVATE HpackEntry {
|
|
|
| // Returns whether this entry is a member of the static (as opposed to
|
| // dynamic) table.
|
| - bool IsStatic() const { return is_static_; }
|
| + bool IsStatic() const { return type_ == STATIC; }
|
| +
|
| + // Returns whether this entry is a lookup-only entry.
|
| + bool IsLookup() const { return type_ == LOOKUP; }
|
|
|
| // Returns and sets the state of the entry, or zero if never set.
|
| // The semantics of |state| are specific to the encoder or decoder.
|
| uint8 state() const { return state_; }
|
| void set_state(uint8 state) { state_ = state; }
|
|
|
| - // Returns the entry's current index in the header table.
|
| - size_t Index() const;
|
| + // Used to compute the entry's index in the header table.
|
| + size_t InsertionIndex() const { return insertion_index_; }
|
|
|
| // Returns the size of an entry as defined in 3.3.1.
|
| static size_t Size(base::StringPiece name, base::StringPiece value);
|
| @@ -88,20 +75,22 @@ class NET_EXPORT_PRIVATE HpackEntry {
|
| std::string GetDebugString() const;
|
|
|
| private:
|
| + enum EntryType {
|
| + LOOKUP,
|
| + DYNAMIC,
|
| + STATIC,
|
| + };
|
| +
|
| // TODO(jgraettinger): Reduce copies, possibly via SpdyPinnableBufferPiece.
|
| std::string name_;
|
| std::string value_;
|
|
|
| - bool is_static_;
|
| - uint8 state_;
|
| -
|
| // The entry's index in the total set of entries ever inserted into the header
|
| // table.
|
| size_t insertion_index_;
|
|
|
| - // If |is_static_|, references the current size of the headers table.
|
| - // Else, references the total number of header insertions which have occurred.
|
| - const size_t* total_insertions_or_size_;
|
| + uint8 state_;
|
| + EntryType type_;
|
| };
|
|
|
| } // namespace net
|
|
|