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

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

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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
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 #include "net/spdy/spdy_headers_block_parser.h" 5 #include "net/spdy/spdy_headers_block_parser.h"
6 6
7 #include "base/sys_byteorder.h" 7 #include "base/sys_byteorder.h"
8 8
9 namespace net { 9 namespace net {
10 10
11 const size_t SpdyHeadersBlockParser::kMaximumFieldLength = 16 * 1024; 11 const size_t SpdyHeadersBlockParser::kMaximumFieldLength = 16 * 1024;
12 12
13 SpdyHeadersBlockParser::SpdyHeadersBlockParser( 13 SpdyHeadersBlockParser::SpdyHeadersBlockParser(
14 SpdyMajorVersion spdy_version, 14 SpdyMajorVersion spdy_version,
15 SpdyHeadersHandlerInterface* handler) : 15 SpdyHeadersHandlerInterface* handler)
16 state_(READING_HEADER_BLOCK_LEN), 16 : state_(READING_HEADER_BLOCK_LEN),
17 length_field_size_(LengthFieldSizeForVersion(spdy_version)), 17 length_field_size_(LengthFieldSizeForVersion(spdy_version)),
18 max_headers_in_block_(MaxNumberOfHeadersForVersion(spdy_version)), 18 max_headers_in_block_(MaxNumberOfHeadersForVersion(spdy_version)),
19 total_bytes_received_(0), 19 total_bytes_received_(0),
20 remaining_key_value_pairs_for_frame_(0), 20 remaining_key_value_pairs_for_frame_(0),
21 handler_(handler), 21 handler_(handler),
22 error_(OK) { 22 error_(OK),
23 spdy_version_(spdy_version) {
23 // The handler that we set must not be NULL. 24 // The handler that we set must not be NULL.
24 DCHECK(handler_ != NULL); 25 DCHECK(handler_ != NULL);
25 } 26 }
26 27
27 SpdyHeadersBlockParser::~SpdyHeadersBlockParser() {} 28 SpdyHeadersBlockParser::~SpdyHeadersBlockParser() {}
28 29
29 bool SpdyHeadersBlockParser::HandleControlFrameHeadersData( 30 bool SpdyHeadersBlockParser::HandleControlFrameHeadersData(
30 SpdyStreamId stream_id, 31 SpdyStreamId stream_id,
31 const char* headers_data, 32 const char* headers_data,
32 size_t headers_data_length) { 33 size_t headers_data_length) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // Account for the length of the header block field. 170 // Account for the length of the header block field.
170 size_t max_bytes_for_headers = 171 size_t max_bytes_for_headers =
171 kMaximumFieldLength - LengthFieldSizeForVersion(spdy_version); 172 kMaximumFieldLength - LengthFieldSizeForVersion(spdy_version);
172 173
173 // A minimal size header is twice the length field size (and has a 174 // A minimal size header is twice the length field size (and has a
174 // zero-lengthed key and a zero-lengthed value). 175 // zero-lengthed key and a zero-lengthed value).
175 return max_bytes_for_headers / (2 * LengthFieldSizeForVersion(spdy_version)); 176 return max_bytes_for_headers / (2 * LengthFieldSizeForVersion(spdy_version));
176 } 177 }
177 178
178 } // namespace net 179 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698