| 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_HPACK_ENTRY_H_ | 5 #ifndef NET_SPDY_HPACK_HPACK_ENTRY_H_ |
| 6 #define NET_SPDY_HPACK_HPACK_ENTRY_H_ | 6 #define NET_SPDY_HPACK_HPACK_ENTRY_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 // Returns the size of an entry as defined in 5.1. | 70 // Returns the size of an entry as defined in 5.1. |
| 71 static size_t Size(base::StringPiece name, base::StringPiece value); | 71 static size_t Size(base::StringPiece name, base::StringPiece value); |
| 72 size_t Size() const; | 72 size_t Size() const; |
| 73 | 73 |
| 74 std::string GetDebugString() const; | 74 std::string GetDebugString() const; |
| 75 | 75 |
| 76 int64_t time_added() const { return time_added_; } | 76 int64_t time_added() const { return time_added_; } |
| 77 void set_time_added(int64_t now) { time_added_ = now; } | 77 void set_time_added(int64_t now) { time_added_ = now; } |
| 78 | 78 |
| 79 // Returns the estimate of dynamically allocated memory in bytes. |
| 80 size_t EstimateMemoryUsage() const; |
| 81 |
| 79 private: | 82 private: |
| 80 enum EntryType { | 83 enum EntryType { |
| 81 LOOKUP, | 84 LOOKUP, |
| 82 DYNAMIC, | 85 DYNAMIC, |
| 83 STATIC, | 86 STATIC, |
| 84 }; | 87 }; |
| 85 | 88 |
| 86 // These members are not used for LOOKUP entries. | 89 // These members are not used for LOOKUP entries. |
| 87 std::string name_; | 90 std::string name_; |
| 88 std::string value_; | 91 std::string value_; |
| 89 | 92 |
| 90 // These members are always valid. For DYNAMIC and STATIC entries, they | 93 // These members are always valid. For DYNAMIC and STATIC entries, they |
| 91 // always point to |name_| and |value_|. | 94 // always point to |name_| and |value_|. |
| 92 base::StringPiece name_ref_; | 95 base::StringPiece name_ref_; |
| 93 base::StringPiece value_ref_; | 96 base::StringPiece value_ref_; |
| 94 | 97 |
| 95 // The entry's index in the total set of entries ever inserted into the header | 98 // The entry's index in the total set of entries ever inserted into the header |
| 96 // table. | 99 // table. |
| 97 size_t insertion_index_; | 100 size_t insertion_index_; |
| 98 | 101 |
| 99 EntryType type_; | 102 EntryType type_; |
| 100 | 103 |
| 101 // For HpackHeaderTable::DebugVisitorInterface | 104 // For HpackHeaderTable::DebugVisitorInterface |
| 102 int64_t time_added_; | 105 int64_t time_added_; |
| 103 }; | 106 }; |
| 104 | 107 |
| 105 } // namespace net | 108 } // namespace net |
| 106 | 109 |
| 107 #endif // NET_SPDY_HPACK_HPACK_ENTRY_H_ | 110 #endif // NET_SPDY_HPACK_HPACK_ENTRY_H_ |
| OLD | NEW |