[Resources] Update the Google logo assets to the proper representations
[chromium-blink-merge.git] / net / spdy / hpack_entry.cc
blobf56f181deb7533e807db33955951c2715dd452b8
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_entry.h"
7 #include "base/logging.h"
8 #include "base/strings/string_number_conversions.h"
9 #include "net/spdy/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 state_(0),
25 type_(is_static ? STATIC : DYNAMIC) {
28 HpackEntry::HpackEntry(StringPiece name, StringPiece value)
29 : name_(name.data(), name.size()),
30 value_(value.data(), value.size()),
31 insertion_index_(0),
32 state_(0),
33 type_(LOOKUP) {
36 HpackEntry::HpackEntry()
37 : insertion_index_(0),
38 state_(0),
39 type_(LOOKUP) {
42 HpackEntry::~HpackEntry() {}
44 // static
45 size_t HpackEntry::Size(StringPiece name, StringPiece value) {
46 return name.size() + value.size() + kSizeOverhead;
48 size_t HpackEntry::Size() const {
49 return Size(name(), value());
52 std::string HpackEntry::GetDebugString() const {
53 return "{ name: \"" + name_ +
54 "\", value: \"" + value_ +
55 "\", " + (IsStatic() ? "static" : "dynamic") +
56 ", state: " + base::IntToString(state_) + " }";
59 } // namespace net