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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 | 67 |
68 // static | 68 // static |
69 size_t HpackEntry::Size(SpdyStringPiece name, SpdyStringPiece value) { | 69 size_t HpackEntry::Size(SpdyStringPiece name, SpdyStringPiece value) { |
70 return name.size() + value.size() + kSizeOverhead; | 70 return name.size() + value.size() + kSizeOverhead; |
71 } | 71 } |
72 | 72 |
73 size_t HpackEntry::Size() const { | 73 size_t HpackEntry::Size() const { |
74 return Size(name(), value()); | 74 return Size(name(), value()); |
75 } | 75 } |
76 | 76 |
77 std::string HpackEntry::GetDebugString() const { | 77 SpdyString HpackEntry::GetDebugString() const { |
78 return "{ name: \"" + std::string(name_ref_) + "\", value: \"" + | 78 return "{ name: \"" + SpdyString(name_ref_) + "\", value: \"" + |
79 std::string(value_ref_) + | 79 SpdyString(value_ref_) + |
80 "\", index: " + base::SizeTToString(insertion_index_) + | 80 "\", index: " + base::SizeTToString(insertion_index_) + |
81 (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")) + | 81 (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")) + |
82 " }"; | 82 " }"; |
83 } | 83 } |
84 | 84 |
85 size_t HpackEntry::EstimateMemoryUsage() const { | 85 size_t HpackEntry::EstimateMemoryUsage() const { |
86 return SpdyEstimateMemoryUsage(name_) + SpdyEstimateMemoryUsage(value_); | 86 return SpdyEstimateMemoryUsage(name_) + SpdyEstimateMemoryUsage(value_); |
87 } | 87 } |
88 | 88 |
89 } // namespace net | 89 } // namespace net |
OLD | NEW |