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

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

Issue 987823003: Code cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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') | net/spdy/spdy_framer_test.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 (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 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 } 146 }
147 147
148 bool SpdyFramerVisitorInterface::OnRstStreamFrameData( 148 bool SpdyFramerVisitorInterface::OnRstStreamFrameData(
149 const char* rst_stream_data, 149 const char* rst_stream_data,
150 size_t len) { 150 size_t len) {
151 return true; 151 return true;
152 } 152 }
153 153
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 enable_compression_(true), 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 syn_frame_processed_(false), 162 syn_frame_processed_(false),
162 probable_http_response_(false), 163 probable_http_response_(false),
163 expect_continuation_(0),
164 end_stream_when_done_(false) { 164 end_stream_when_done_(false) {
165 DCHECK_GE(protocol_version_, SPDY_MIN_VERSION); 165 DCHECK_GE(protocol_version_, SPDY_MIN_VERSION);
166 DCHECK_LE(protocol_version_, SPDY_MAX_VERSION); 166 DCHECK_LE(protocol_version_, SPDY_MAX_VERSION);
167 DCHECK_LE(kMaxControlFrameSize, 167 DCHECK_LE(kMaxControlFrameSize,
168 SpdyConstants::GetFrameMaximumSize(protocol_version_) + 168 SpdyConstants::GetFrameMaximumSize(protocol_version_) +
169 SpdyConstants::GetControlFrameHeaderSize(protocol_version_)); 169 SpdyConstants::GetControlFrameHeaderSize(protocol_version_));
170 Reset(); 170 Reset();
171 } 171 }
172 172
173 SpdyFramer::~SpdyFramer() { 173 SpdyFramer::~SpdyFramer() {
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 1415
1416 SpdyPriority priority = 0; 1416 SpdyPriority priority = 0;
1417 successful_read = reader.ReadUInt8(&priority); 1417 successful_read = reader.ReadUInt8(&priority);
1418 DCHECK(successful_read); 1418 DCHECK(successful_read);
1419 if (protocol_version() <= SPDY2) { 1419 if (protocol_version() <= SPDY2) {
1420 priority = priority >> 6; 1420 priority = priority >> 6;
1421 } else { 1421 } else {
1422 priority = priority >> 5; 1422 priority = priority >> 5;
1423 } 1423 }
1424 1424
1425 // Seek past unused byte; used to be credential slot in SPDY 3. 1425 // Seek past unused byte; used to be credential slot in SPDY 3.
1426 reader.Seek(1); 1426 reader.Seek(1);
1427 1427
1428 DCHECK(reader.IsDoneReading()); 1428 DCHECK(reader.IsDoneReading());
1429 if (debug_visitor_) { 1429 if (debug_visitor_) {
1430 debug_visitor_->OnReceiveCompressedFrame( 1430 debug_visitor_->OnReceiveCompressedFrame(
1431 current_frame_stream_id_, 1431 current_frame_stream_id_,
1432 current_frame_type_, 1432 current_frame_type_,
1433 current_frame_length_); 1433 current_frame_length_);
1434 } 1434 }
1435 visitor_->OnSynStream( 1435 visitor_->OnSynStream(
1436 current_frame_stream_id_, 1436 current_frame_stream_id_,
(...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after
3277 #else 3277 #else
3278 WriteHeaderBlockToZ(&frame.name_value_block(), compressor); 3278 WriteHeaderBlockToZ(&frame.name_value_block(), compressor);
3279 #endif // defined(USE_SYSTEM_ZLIB) 3279 #endif // defined(USE_SYSTEM_ZLIB)
3280 3280
3281 int compressed_size = compressed_max_size - compressor->avail_out; 3281 int compressed_size = compressed_max_size - compressor->avail_out;
3282 builder->Seek(compressed_size); 3282 builder->Seek(compressed_size);
3283 builder->RewriteLength(*this); 3283 builder->RewriteLength(*this);
3284 } 3284 }
3285 3285
3286 } // namespace net 3286 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer.h ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698