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

Side by Side Diff: net/spdy/spdy_headers_block_parser.h

Issue 288313006: Adds reporting of total header block bytes to SpdyHeadersBlockParser. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | net/spdy/spdy_headers_block_parser.cc » ('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 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 #ifndef NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ 5 #ifndef NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_
6 #define NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ 6 #define NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 13 matching lines...) Expand all
24 // the block. 24 // the block.
25 virtual void OnHeaderBlock(SpdyStreamId stream_id, 25 virtual void OnHeaderBlock(SpdyStreamId stream_id,
26 uint32_t num_of_headers) = 0; 26 uint32_t num_of_headers) = 0;
27 27
28 // A callback method which notifies on a SPDY header key value pair. 28 // A callback method which notifies on a SPDY header key value pair.
29 virtual void OnHeader(SpdyStreamId stream_id, 29 virtual void OnHeader(SpdyStreamId stream_id,
30 base::StringPiece key, 30 base::StringPiece key,
31 base::StringPiece value) = 0; 31 base::StringPiece value) = 0;
32 32
33 // A callback method which notifies when the parser finishes handling a SPDY 33 // A callback method which notifies when the parser finishes handling a SPDY
34 // headers block. 34 // headers block. Also notifies on the total number of bytes in this block.
35 virtual void OnHeaderBlockEnd(SpdyStreamId stream_id) = 0; 35 virtual void OnHeaderBlockEnd(SpdyStreamId stream_id,
36 size_t header_bytes_parsed) = 0;
36 }; 37 };
37 38
38 namespace test { 39 namespace test {
39 40
40 class SpdyHeadersBlockParserPeer; 41 class SpdyHeadersBlockParserPeer;
41 42
42 } // namespace test 43 } // namespace test
43 44
44 // This class handles SPDY headers block bytes and parses out key-value pairs 45 // This class handles SPDY headers block bytes and parses out key-value pairs
45 // as they arrive. This class is not thread-safe, and assumes that all headers 46 // as they arrive. This class is not thread-safe, and assumes that all headers
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 FINISHED_HEADER 110 FINISHED_HEADER
110 }; 111 };
111 ParserState state_; 112 ParserState state_;
112 113
113 // Size in bytes of a length field in the spdy header. 114 // Size in bytes of a length field in the spdy header.
114 const size_t length_field_size_; 115 const size_t length_field_size_;
115 116
116 // The maximal number of headers in a SPDY headers block. 117 // The maximal number of headers in a SPDY headers block.
117 const size_t max_headers_in_block_; 118 const size_t max_headers_in_block_;
118 119
120 // A running total of the bytes parsed since the last call to Reset().
121 size_t total_bytes_received_;
122
119 // Number of key-value pairs until we complete handling the current 123 // Number of key-value pairs until we complete handling the current
120 // headers block. 124 // headers block.
121 uint32_t remaining_key_value_pairs_for_frame_; 125 uint32_t remaining_key_value_pairs_for_frame_;
122 126
123 // The length of the next header field to be read (either key or value). 127 // The length of the next header field to be read (either key or value).
124 uint32_t next_field_length_; 128 uint32_t next_field_length_;
125 129
126 // Handles key-value pairs as we parse them. 130 // Handles key-value pairs as we parse them.
127 SpdyHeadersHandlerInterface* handler_; 131 SpdyHeadersHandlerInterface* handler_;
128 132
129 // Holds unprocessed buffer remainders between calls to 133 // Holds unprocessed buffer remainders between calls to
130 // |HandleControlFrameHeadersData|. 134 // |HandleControlFrameHeadersData|.
131 SpdyPinnableBufferPiece headers_block_prefix_; 135 SpdyPinnableBufferPiece headers_block_prefix_;
132 136
133 // Holds the key of a partially processed header between calls to 137 // Holds the key of a partially processed header between calls to
134 // |HandleControlFrameHeadersData|. 138 // |HandleControlFrameHeadersData|.
135 SpdyPinnableBufferPiece key_; 139 SpdyPinnableBufferPiece key_;
136 140
137 // The current header block stream identifier. 141 // The current header block stream identifier.
138 SpdyStreamId stream_id_; 142 SpdyStreamId stream_id_;
139 143
140 ParserError error_; 144 ParserError error_;
141 }; 145 };
142 146
143 } // namespace net 147 } // namespace net
144 148
145 #endif // NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_ 149 #endif // NET_SPDY_SPDY_HEADERS_BLOCK_PARSER_H_
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_headers_block_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698