| 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 #include "net/spdy/hpack/hpack_static_table.h" | 5 #include "net/spdy/hpack/hpack_static_table.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/spdy/hpack/hpack_constants.h" | 8 #include "net/spdy/hpack/hpack_constants.h" |
| 9 #include "net/spdy/hpack/hpack_entry.h" | 9 #include "net/spdy/hpack/hpack_entry.h" |
| 10 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h" |
| 10 | 11 |
| 11 namespace net { | 12 namespace net { |
| 12 | 13 |
| 13 HpackStaticTable::HpackStaticTable() {} | 14 HpackStaticTable::HpackStaticTable() {} |
| 14 | 15 |
| 15 HpackStaticTable::~HpackStaticTable() {} | 16 HpackStaticTable::~HpackStaticTable() {} |
| 16 | 17 |
| 17 void HpackStaticTable::Initialize(const HpackStaticEntry* static_entry_table, | 18 void HpackStaticTable::Initialize(const HpackStaticEntry* static_entry_table, |
| 18 size_t static_entry_count) { | 19 size_t static_entry_count) { |
| 19 CHECK(!IsInitialized()); | 20 CHECK(!IsInitialized()); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 32 static_name_index_.insert(make_pair(entry->name(), entry)); | 33 static_name_index_.insert(make_pair(entry->name(), entry)); |
| 33 | 34 |
| 34 ++total_insertions; | 35 ++total_insertions; |
| 35 } | 36 } |
| 36 } | 37 } |
| 37 | 38 |
| 38 bool HpackStaticTable::IsInitialized() const { | 39 bool HpackStaticTable::IsInitialized() const { |
| 39 return !static_entries_.empty(); | 40 return !static_entries_.empty(); |
| 40 } | 41 } |
| 41 | 42 |
| 43 size_t HpackStaticTable::EstimateMemoryUsage() const { |
| 44 return SpdyEstimateMemoryUsage(static_entries_) + |
| 45 SpdyEstimateMemoryUsage(static_index_) + |
| 46 SpdyEstimateMemoryUsage(static_name_index_); |
| 47 } |
| 48 |
| 42 } // namespace net | 49 } // namespace net |
| OLD | NEW |