Revert "Fix broken channel icon in chrome://help on CrOS" and try again
[chromium-blink-merge.git] / net / spdy / hpack / hpack_entry.cc
blobc4c51ba94d9a1fd8ba0473443d8a4b36cd76b6da
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_entry.h"
7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "net/spdy/hpack/hpack_string_util.h"
11 namespace net {
13 using base::StringPiece;
15 const size_t HpackEntry::kSizeOverhead = 32;
17 HpackEntry::HpackEntry(StringPiece name,
18 StringPiece value,
19 bool is_static,
20 size_t insertion_index)
21 : name_(name.data(), name.size()),
22 value_(value.data(), value.size()),
23 insertion_index_(insertion_index),
24 type_(is_static ? STATIC : DYNAMIC) {}
26 HpackEntry::HpackEntry(StringPiece name, StringPiece value)
27 : name_(name.data(), name.size()),
28 value_(value.data(), value.size()),
29 insertion_index_(0),
30 type_(LOOKUP) {}
32 HpackEntry::HpackEntry() : insertion_index_(0), type_(LOOKUP) {}
34 HpackEntry::~HpackEntry() {}
36 // static
37 size_t HpackEntry::Size(StringPiece name, StringPiece value) {
38 return name.size() + value.size() + kSizeOverhead;
40 size_t HpackEntry::Size() const {
41 return Size(name(), value());
44 std::string HpackEntry::GetDebugString() const {
45 return "{ name: \"" + name_ + "\", value: \"" + value_ + "\", " +
46 (IsStatic() ? "static" : "dynamic") + " }";
49 } // namespace net