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

Side by Side Diff: net/spdy/core/hpack/hpack_static_table.cc

Issue 2895993003: Misc cleanup in net/spdy/core. (Closed)
Patch Set: Rebase. Created 3 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 unified diff | Download patch
OLDNEW
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/core/hpack/hpack_static_table.h" 5 #include "net/spdy/core/hpack/hpack_static_table.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/spdy/core/hpack/hpack_constants.h" 8 #include "net/spdy/core/hpack/hpack_constants.h"
9 #include "net/spdy/core/hpack/hpack_entry.h" 9 #include "net/spdy/core/hpack/hpack_entry.h"
10 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h" 10 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h"
(...skipping 13 matching lines...) Expand all
24 for (const HpackStaticEntry* it = static_entry_table; 24 for (const HpackStaticEntry* it = static_entry_table;
25 it != static_entry_table + static_entry_count; ++it) { 25 it != static_entry_table + static_entry_count; ++it) {
26 static_entries_.push_back( 26 static_entries_.push_back(
27 HpackEntry(SpdyStringPiece(it->name, it->name_len), 27 HpackEntry(SpdyStringPiece(it->name, it->name_len),
28 SpdyStringPiece(it->value, it->value_len), 28 SpdyStringPiece(it->value, it->value_len),
29 true, // is_static 29 true, // is_static
30 total_insertions)); 30 total_insertions));
31 HpackEntry* entry = &static_entries_.back(); 31 HpackEntry* entry = &static_entries_.back();
32 CHECK(static_index_.insert(entry).second); 32 CHECK(static_index_.insert(entry).second);
33 // Multiple static entries may have the same name, so inserts may fail. 33 // Multiple static entries may have the same name, so inserts may fail.
34 static_name_index_.insert(make_pair(entry->name(), entry)); 34 static_name_index_.insert(std::make_pair(entry->name(), entry));
35 35
36 ++total_insertions; 36 ++total_insertions;
37 } 37 }
38 } 38 }
39 39
40 bool HpackStaticTable::IsInitialized() const { 40 bool HpackStaticTable::IsInitialized() const {
41 return !static_entries_.empty(); 41 return !static_entries_.empty();
42 } 42 }
43 43
44 size_t HpackStaticTable::EstimateMemoryUsage() const { 44 size_t HpackStaticTable::EstimateMemoryUsage() const {
45 return SpdyEstimateMemoryUsage(static_entries_) + 45 return SpdyEstimateMemoryUsage(static_entries_) +
46 SpdyEstimateMemoryUsage(static_index_) + 46 SpdyEstimateMemoryUsage(static_index_) +
47 SpdyEstimateMemoryUsage(static_name_index_); 47 SpdyEstimateMemoryUsage(static_name_index_);
48 } 48 }
49 49
50 } // namespace net 50 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698