Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / net / spdy / hpack / hpack_static_table.cc
blob8ee1d0bdd9c79fe8dff672beb06769d6b9a64d7e
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
3 // found in the LICENSE file.
5 #include "net/spdy/hpack/hpack_static_table.h"
7 #include "base/logging.h"
8 #include "net/spdy/hpack/hpack_constants.h"
9 #include "net/spdy/hpack/hpack_entry.h"
11 namespace net {
13 HpackStaticTable::HpackStaticTable() {}
15 HpackStaticTable::~HpackStaticTable() {}
17 void HpackStaticTable::Initialize(const HpackStaticEntry* static_entry_table,
18 size_t static_entry_count) {
19 CHECK(!IsInitialized());
21 int total_insertions = 0;
22 for (const HpackStaticEntry* it = static_entry_table;
23 it != static_entry_table + static_entry_count; ++it) {
24 static_entries_.push_back(HpackEntry(StringPiece(it->name, it->name_len),
25 StringPiece(it->value, it->value_len),
26 true, // is_static
27 total_insertions));
28 CHECK(static_index_.insert(&static_entries_.back()).second);
30 ++total_insertions;
34 bool HpackStaticTable::IsInitialized() const {
35 return !static_entries_.empty();
38 } // namespace net