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_entry.h" | 5 #include "net/spdy/hpack/hpack_entry.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h" | 9 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h" |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 // static | 70 // static |
71 size_t HpackEntry::Size(StringPiece name, StringPiece value) { | 71 size_t HpackEntry::Size(StringPiece name, StringPiece value) { |
72 return name.size() + value.size() + kSizeOverhead; | 72 return name.size() + value.size() + kSizeOverhead; |
73 } | 73 } |
74 | 74 |
75 size_t HpackEntry::Size() const { | 75 size_t HpackEntry::Size() const { |
76 return Size(name(), value()); | 76 return Size(name(), value()); |
77 } | 77 } |
78 | 78 |
79 std::string HpackEntry::GetDebugString() const { | 79 std::string HpackEntry::GetDebugString() const { |
80 return "{ name: \"" + name_ref_.as_string() + "\", value: \"" + | 80 return "{ name: \"" + std::string(name_ref_) + "\", value: \"" + |
81 value_ref_.as_string() + "\", index: " + | 81 std::string(value_ref_) + |
82 base::SizeTToString(insertion_index_) + | 82 "\", index: " + base::SizeTToString(insertion_index_) + |
83 (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")) + | 83 (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")) + |
84 " }"; | 84 " }"; |
85 } | 85 } |
86 | 86 |
87 size_t HpackEntry::EstimateMemoryUsage() const { | 87 size_t HpackEntry::EstimateMemoryUsage() const { |
88 return SpdyEstimateMemoryUsage(name_) + SpdyEstimateMemoryUsage(value_); | 88 return SpdyEstimateMemoryUsage(name_) + SpdyEstimateMemoryUsage(value_); |
89 } | 89 } |
90 | 90 |
91 } // namespace net | 91 } // namespace net |
OLD | NEW |