Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(567)

Side by Side Diff: net/spdy/hpack/hpack_decoder3.cc

Issue 2665283003: Improve memory estimate of SpdySessionPool in net/ MemoryDumpProvider. (Closed)
Patch Set: rebased Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/spdy/hpack/hpack_decoder3.h ('k') | net/spdy/hpack/hpack_decoder_interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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_decoder3.h" 5 #include "net/spdy/hpack/hpack_decoder3.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/http2/decoder/decode_buffer.h" 8 #include "net/http2/decoder/decode_buffer.h"
9 #include "net/http2/decoder/decode_status.h" 9 #include "net/http2/decoder/decode_status.h"
10 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h"
10 11
11 using base::StringPiece; 12 using base::StringPiece;
12 13
13 namespace net { 14 namespace net {
14 namespace { 15 namespace {
15 const size_t kMaxDecodeBufferSizeBytes = 32 * 1024; // 32 KB 16 const size_t kMaxDecodeBufferSizeBytes = 32 * 1024; // 32 KB
16 } // namespace 17 } // namespace
17 18
18 HpackDecoder3::HpackDecoder3() 19 HpackDecoder3::HpackDecoder3()
19 : hpack_decoder_(&listener_adapter_, kMaxDecodeBufferSizeBytes), 20 : hpack_decoder_(&listener_adapter_, kMaxDecodeBufferSizeBytes),
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 } 101 }
101 } 102 }
102 103
103 void HpackDecoder3::set_max_decode_buffer_size_bytes( 104 void HpackDecoder3::set_max_decode_buffer_size_bytes(
104 size_t max_decode_buffer_size_bytes) { 105 size_t max_decode_buffer_size_bytes) {
105 DVLOG(2) << "HpackDecoder3::set_max_decode_buffer_size_bytes"; 106 DVLOG(2) << "HpackDecoder3::set_max_decode_buffer_size_bytes";
106 max_decode_buffer_size_bytes_ = max_decode_buffer_size_bytes; 107 max_decode_buffer_size_bytes_ = max_decode_buffer_size_bytes;
107 hpack_decoder_.set_max_string_size_bytes(max_decode_buffer_size_bytes); 108 hpack_decoder_.set_max_string_size_bytes(max_decode_buffer_size_bytes);
108 } 109 }
109 110
111 size_t HpackDecoder3::EstimateMemoryUsage() const {
112 return SpdyEstimateMemoryUsage(hpack_decoder_);
113 }
114
110 HpackDecoder3::ListenerAdapter::ListenerAdapter() : handler_(nullptr) {} 115 HpackDecoder3::ListenerAdapter::ListenerAdapter() : handler_(nullptr) {}
111 HpackDecoder3::ListenerAdapter::~ListenerAdapter() {} 116 HpackDecoder3::ListenerAdapter::~ListenerAdapter() {}
112 117
113 void HpackDecoder3::ListenerAdapter::set_handler( 118 void HpackDecoder3::ListenerAdapter::set_handler(
114 SpdyHeadersHandlerInterface* handler) { 119 SpdyHeadersHandlerInterface* handler) {
115 handler_ = handler; 120 handler_ = handler;
116 } 121 }
117 122
118 void HpackDecoder3::ListenerAdapter::SetHeaderTableDebugVisitor( 123 void HpackDecoder3::ListenerAdapter::SetHeaderTableDebugVisitor(
119 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) { 124 std::unique_ptr<HpackHeaderTable::DebugVisitorInterface> visitor) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 << ", insert_count=" << insert_count 186 << ", insert_count=" << insert_count
182 << ", time_added=" << time_added; 187 << ", time_added=" << time_added;
183 if (visitor_ != nullptr) { 188 if (visitor_ != nullptr) {
184 HpackEntry entry(sp.name, sp.value, /*is_static*/ false, insert_count); 189 HpackEntry entry(sp.name, sp.value, /*is_static*/ false, insert_count);
185 entry.set_time_added(time_added); 190 entry.set_time_added(time_added);
186 visitor_->OnUseEntry(entry); 191 visitor_->OnUseEntry(entry);
187 } 192 }
188 } 193 }
189 194
190 } // namespace net 195 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_decoder3.h ('k') | net/spdy/hpack/hpack_decoder_interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698