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

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

Issue 1146533003: Add SpdyFramer methods for SETTINGS_HEADER_TABLE_SIZE. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove const qualifier from size_t return type. Created 5 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
« no previous file with comments | « net/spdy/spdy_framer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_framer.h" 5 #include "net/spdy/spdy_framer.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/third_party/valgrind/memcheck.h" 9 #include "base/third_party/valgrind/memcheck.h"
10 #include "net/spdy/spdy_frame_builder.h" 10 #include "net/spdy/spdy_frame_builder.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 SpdyFramer::SpdyFramer(SpdyMajorVersion version) 154 SpdyFramer::SpdyFramer(SpdyMajorVersion version)
155 : current_frame_buffer_(new char[kControlFrameBufferSize]), 155 : current_frame_buffer_(new char[kControlFrameBufferSize]),
156 expect_continuation_(0), 156 expect_continuation_(0),
157 visitor_(NULL), 157 visitor_(NULL),
158 debug_visitor_(NULL), 158 debug_visitor_(NULL),
159 display_protocol_("SPDY"), 159 display_protocol_("SPDY"),
160 protocol_version_(version), 160 protocol_version_(version),
161 enable_compression_(true), 161 enable_compression_(true),
162 syn_frame_processed_(false), 162 syn_frame_processed_(false),
163 probable_http_response_(false), 163 probable_http_response_(false),
164 end_stream_when_done_(false) { 164 end_stream_when_done_(false),
165 header_table_size_bound_(4096) {
165 DCHECK_GE(protocol_version_, SPDY_MIN_VERSION); 166 DCHECK_GE(protocol_version_, SPDY_MIN_VERSION);
166 DCHECK_LE(protocol_version_, SPDY_MAX_VERSION); 167 DCHECK_LE(protocol_version_, SPDY_MAX_VERSION);
167 DCHECK_LE(kMaxControlFrameSize, 168 DCHECK_LE(kMaxControlFrameSize,
168 SpdyConstants::GetFrameMaximumSize(protocol_version_) + 169 SpdyConstants::GetFrameMaximumSize(protocol_version_) +
169 SpdyConstants::GetControlFrameHeaderSize(protocol_version_)); 170 SpdyConstants::GetControlFrameHeaderSize(protocol_version_));
170 Reset(); 171 Reset();
171 } 172 }
172 173
173 SpdyFramer::~SpdyFramer() { 174 SpdyFramer::~SpdyFramer() {
174 if (header_compressor_.get()) { 175 if (header_compressor_.get()) {
(...skipping 3019 matching lines...) Expand 10 before | Expand all | Expand 10 after
3194 len -= bytes_to_deliver; 3195 len -= bytes_to_deliver;
3195 if (!read_successfully) { 3196 if (!read_successfully) {
3196 // Assume that the problem was the header block was too large for the 3197 // Assume that the problem was the header block was too large for the
3197 // visitor. 3198 // visitor.
3198 set_error(SPDY_CONTROL_PAYLOAD_TOO_LARGE); 3199 set_error(SPDY_CONTROL_PAYLOAD_TOO_LARGE);
3199 } 3200 }
3200 } 3201 }
3201 return read_successfully; 3202 return read_successfully;
3202 } 3203 }
3203 3204
3205 void SpdyFramer::UpdateHeaderTableSizeSetting(uint32 value) {
3206 header_table_size_bound_ = value;
3207 GetHpackEncoder()->ApplyHeaderTableSizeSetting(value);
3208 GetHpackDecoder()->ApplyHeaderTableSizeSetting(value);
3209 }
3210
3211 // Return size bound of the header compression table.
3212 size_t SpdyFramer::header_table_size_bound() const {
3213 return header_table_size_bound_;
3214 }
3215
3204 void SpdyFramer::SerializeNameValueBlockWithoutCompression( 3216 void SpdyFramer::SerializeNameValueBlockWithoutCompression(
3205 SpdyFrameBuilder* builder, 3217 SpdyFrameBuilder* builder,
3206 const SpdyNameValueBlock& name_value_block) const { 3218 const SpdyNameValueBlock& name_value_block) const {
3207 // Serialize number of headers. 3219 // Serialize number of headers.
3208 if (protocol_version() <= SPDY2) { 3220 if (protocol_version() <= SPDY2) {
3209 builder->WriteUInt16(static_cast<uint16>(name_value_block.size())); 3221 builder->WriteUInt16(static_cast<uint16>(name_value_block.size()));
3210 } else { 3222 } else {
3211 builder->WriteUInt32(name_value_block.size()); 3223 builder->WriteUInt32(name_value_block.size());
3212 } 3224 }
3213 3225
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
3279 #else 3291 #else
3280 WriteHeaderBlockToZ(&frame.name_value_block(), compressor); 3292 WriteHeaderBlockToZ(&frame.name_value_block(), compressor);
3281 #endif // defined(USE_SYSTEM_ZLIB) 3293 #endif // defined(USE_SYSTEM_ZLIB)
3282 3294
3283 int compressed_size = compressed_max_size - compressor->avail_out; 3295 int compressed_size = compressed_max_size - compressor->avail_out;
3284 builder->Seek(compressed_size); 3296 builder->Seek(compressed_size);
3285 builder->RewriteLength(*this); 3297 builder->RewriteLength(*this);
3286 } 3298 }
3287 3299
3288 } // namespace net 3300 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698