| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_SPDY_HPACK_ENTRY_H_ | 5 #ifndef NET_SPDY_HPACK_ENTRY_H_ |
| 6 #define NET_SPDY_HPACK_ENTRY_H_ | 6 #define NET_SPDY_HPACK_ENTRY_H_ |
| 7 | 7 |
| 8 #include <cstddef> | 8 #include <cstddef> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 // The constant amount added to name().size() and value().size() to | 26 // The constant amount added to name().size() and value().size() to |
| 27 // get the size of an HpackEntry as defined in 3.3.1. | 27 // get the size of an HpackEntry as defined in 3.3.1. |
| 28 static const size_t kSizeOverhead; | 28 static const size_t kSizeOverhead; |
| 29 | 29 |
| 30 // Implements a total ordering of HpackEntry on name(), value(), then Index() | 30 // Implements a total ordering of HpackEntry on name(), value(), then Index() |
| 31 // ascending. Note that Index() may change over the lifetime of an HpackEntry, | 31 // ascending. Note that Index() may change over the lifetime of an HpackEntry, |
| 32 // but the relative Index() order of two entries will not. This comparator is | 32 // but the relative Index() order of two entries will not. This comparator is |
| 33 // composed with the 'lookup' HpackEntry constructor to allow for efficient | 33 // composed with the 'lookup' HpackEntry constructor to allow for efficient |
| 34 // lower-bounding of matching entries. | 34 // lower-bounding of matching entries. |
| 35 struct NET_EXPORT_PRIVATE Comparator { | 35 struct NET_EXPORT_PRIVATE Comparator { |
| 36 bool operator() (const HpackEntry* lhs, const HpackEntry* rhs) const; | 36 bool operator()(const HpackEntry* lhs, const HpackEntry* rhs) const; |
| 37 }; | 37 }; |
| 38 typedef std::set<HpackEntry*, Comparator> OrderedSet; | 38 typedef std::set<HpackEntry*, Comparator> OrderedSet; |
| 39 | 39 |
| 40 // Creates an entry. Preconditions: | 40 // Creates an entry. Preconditions: |
| 41 // - |is_static| captures whether this entry is a member of the static | 41 // - |is_static| captures whether this entry is a member of the static |
| 42 // or dynamic header table. | 42 // or dynamic header table. |
| 43 // - |insertion_index| is this entry's index in the total set of entries ever | 43 // - |insertion_index| is this entry's index in the total set of entries ever |
| 44 // inserted into the header table (including static entries). | 44 // inserted into the header table (including static entries). |
| 45 // - |total_table_insertions_or_current_size| references an externally- | 45 // - |total_table_insertions_or_current_size| references an externally- |
| 46 // updated count of either the total number of header insertions (if | 46 // updated count of either the total number of header insertions (if |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 size_t insertion_index_; | 100 size_t insertion_index_; |
| 101 | 101 |
| 102 // If |is_static_|, references the current size of the headers table. | 102 // If |is_static_|, references the current size of the headers table. |
| 103 // Else, references the total number of header insertions which have occurred. | 103 // Else, references the total number of header insertions which have occurred. |
| 104 const size_t* total_insertions_or_size_; | 104 const size_t* total_insertions_or_size_; |
| 105 }; | 105 }; |
| 106 | 106 |
| 107 } // namespace net | 107 } // namespace net |
| 108 | 108 |
| 109 #endif // NET_SPDY_HPACK_ENTRY_H_ | 109 #endif // NET_SPDY_HPACK_ENTRY_H_ |
| OLD | NEW |