| 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 "base/trace_event/memory_usage_estimator.h" |
| 9 | 10 |
| 10 namespace net { | 11 namespace net { |
| 11 | 12 |
| 12 using base::StringPiece; | 13 using base::StringPiece; |
| 13 | 14 |
| 14 const size_t HpackEntry::kSizeOverhead = 32; | 15 const size_t HpackEntry::kSizeOverhead = 32; |
| 15 | 16 |
| 16 HpackEntry::HpackEntry(StringPiece name, | 17 HpackEntry::HpackEntry(StringPiece name, |
| 17 StringPiece value, | 18 StringPiece value, |
| 18 bool is_static, | 19 bool is_static, |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 } | 70 } |
| 70 | 71 |
| 71 std::string HpackEntry::GetDebugString() const { | 72 std::string HpackEntry::GetDebugString() const { |
| 72 return "{ name: \"" + name_ref_.as_string() + "\", value: \"" + | 73 return "{ name: \"" + name_ref_.as_string() + "\", value: \"" + |
| 73 value_ref_.as_string() + "\", index: " + | 74 value_ref_.as_string() + "\", index: " + |
| 74 base::SizeTToString(insertion_index_) + | 75 base::SizeTToString(insertion_index_) + |
| 75 (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")) + | 76 (IsStatic() ? " static" : (IsLookup() ? " lookup" : " dynamic")) + |
| 76 " }"; | 77 " }"; |
| 77 } | 78 } |
| 78 | 79 |
| 80 size_t HpackEntry::EstimateMemoryUsage() const { |
| 81 return base::trace_event::EstimateMemoryUsage(name_) + |
| 82 base::trace_event::EstimateMemoryUsage(value_); |
| 83 } |
| 84 |
| 79 } // namespace net | 85 } // namespace net |
| OLD | NEW |