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

Side by Side Diff: net/spdy/http2_frame_decoder_adapter.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_static_table.cc ('k') | net/spdy/http2_priority_dependencies.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/http2_frame_decoder_adapter.h" 5 #include "net/spdy/http2_frame_decoder_adapter.h"
6 6
7 // Logging policy: If an error in the input is detected, VLOG(n) is used so that 7 // Logging policy: If an error in the input is detected, VLOG(n) is used so that
8 // the option exists to debug the situation. Otherwise, this code mostly uses 8 // the option exists to debug the situation. Otherwise, this code mostly uses
9 // DVLOG so that the logging does not slow down production code when things are 9 // DVLOG so that the logging does not slow down production code when things are
10 // working OK. 10 // working OK.
(...skipping 10 matching lines...) Expand all
21 #include "base/strings/string_piece.h" 21 #include "base/strings/string_piece.h"
22 #include "base/sys_byteorder.h" 22 #include "base/sys_byteorder.h"
23 #include "net/http2/decoder/decode_buffer.h" 23 #include "net/http2/decoder/decode_buffer.h"
24 #include "net/http2/decoder/decode_status.h" 24 #include "net/http2/decoder/decode_status.h"
25 #include "net/http2/decoder/http2_frame_decoder.h" 25 #include "net/http2/decoder/http2_frame_decoder.h"
26 #include "net/http2/decoder/http2_frame_decoder_listener.h" 26 #include "net/http2/decoder/http2_frame_decoder_listener.h"
27 #include "net/http2/http2_constants.h" 27 #include "net/http2/http2_constants.h"
28 #include "net/http2/http2_structures.h" 28 #include "net/http2/http2_structures.h"
29 #include "net/spdy/hpack/hpack_decoder_interface.h" 29 #include "net/spdy/hpack/hpack_decoder_interface.h"
30 #include "net/spdy/hpack/hpack_header_table.h" 30 #include "net/spdy/hpack/hpack_header_table.h"
31 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h"
31 #include "net/spdy/spdy_alt_svc_wire_format.h" 32 #include "net/spdy/spdy_alt_svc_wire_format.h"
32 #include "net/spdy/spdy_bug_tracker.h" 33 #include "net/spdy/spdy_bug_tracker.h"
33 #include "net/spdy/spdy_frame_builder.h" 34 #include "net/spdy/spdy_frame_builder.h"
34 #include "net/spdy/spdy_header_block.h" 35 #include "net/spdy/spdy_header_block.h"
35 #include "net/spdy/spdy_headers_handler_interface.h" 36 #include "net/spdy/spdy_headers_handler_interface.h"
36 #include "net/spdy/spdy_protocol.h" 37 #include "net/spdy/spdy_protocol.h"
37 38
38 using std::string; 39 using std::string;
39 40
40 namespace net { 41 namespace net {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 SpdyState state() const override { return spdy_state_; } 137 SpdyState state() const override { return spdy_state_; }
137 138
138 SpdyFramerError spdy_framer_error() const override { 139 SpdyFramerError spdy_framer_error() const override {
139 return spdy_framer_error_; 140 return spdy_framer_error_;
140 } 141 }
141 142
142 bool probable_http_response() const override { 143 bool probable_http_response() const override {
143 return latched_probable_http_response_; 144 return latched_probable_http_response_;
144 } 145 }
145 146
147 size_t EstimateMemoryUsage() const override {
148 // Skip |frame_decoder_|, |frame_header_| and |hpack_first_frame_header_| as
149 // they don't allocate.
150 return SpdyEstimateMemoryUsage(alt_svc_origin_) +
151 SpdyEstimateMemoryUsage(alt_svc_value_);
152 }
146 // =========================================================================== 153 // ===========================================================================
147 // Implementations of the methods declared by Http2FrameDecoderListener. 154 // Implementations of the methods declared by Http2FrameDecoderListener.
148 155
149 // Called once the common frame header has been decoded for any frame. 156 // Called once the common frame header has been decoded for any frame.
150 // This function is largely based on SpdyFramer::ValidateFrameHeader 157 // This function is largely based on SpdyFramer::ValidateFrameHeader
151 // and some parts of SpdyFramer::ProcessCommonHeader. 158 // and some parts of SpdyFramer::ProcessCommonHeader.
152 bool OnFrameHeader(const Http2FrameHeader& header) override { 159 bool OnFrameHeader(const Http2FrameHeader& header) override {
153 DVLOG(1) << "OnFrameHeader: " << header; 160 DVLOG(1) << "OnFrameHeader: " << header;
154 decoded_frame_header_ = true; 161 decoded_frame_header_ = true;
155 if (!latched_probable_http_response_) { 162 if (!latched_probable_http_response_) {
(...skipping 799 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 962
956 } // namespace 963 } // namespace
957 964
958 std::unique_ptr<SpdyFramerDecoderAdapter> CreateHttp2FrameDecoderAdapter( 965 std::unique_ptr<SpdyFramerDecoderAdapter> CreateHttp2FrameDecoderAdapter(
959 SpdyFramer* outer_framer) { 966 SpdyFramer* outer_framer) {
960 return std::unique_ptr<SpdyFramerDecoderAdapter>( 967 return std::unique_ptr<SpdyFramerDecoderAdapter>(
961 new Http2DecoderAdapter(outer_framer)); 968 new Http2DecoderAdapter(outer_framer));
962 } 969 }
963 970
964 } // namespace net 971 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/hpack/hpack_static_table.cc ('k') | net/spdy/http2_priority_dependencies.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698