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

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

Issue 243643002: Refactor RST_STREAM status code handling. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Expanded FRAME_TOO_LARGE/FRAME_SIZE_ERROR comment. Created 6 years, 8 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_framer.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_frame_builder.h" 5 #include "net/spdy/spdy_frame_builder.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/spdy/spdy_framer.h" 10 #include "net/spdy/spdy_framer.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 152
153 bool SpdyFrameBuilder::RewriteLength(const SpdyFramer& framer) { 153 bool SpdyFrameBuilder::RewriteLength(const SpdyFramer& framer) {
154 return OverwriteLength(framer, 154 return OverwriteLength(framer,
155 length_ - framer.GetControlFrameHeaderSize()); 155 length_ - framer.GetControlFrameHeaderSize());
156 } 156 }
157 157
158 bool SpdyFrameBuilder::OverwriteLength(const SpdyFramer& framer, 158 bool SpdyFrameBuilder::OverwriteLength(const SpdyFramer& framer,
159 size_t length) { 159 size_t length) {
160 if (framer.protocol_version() < 4) { 160 if (framer.protocol_version() < 4) {
161 DCHECK_GT(framer.GetFrameMaximumSize() - framer.GetFrameMinimumSize(), 161 DCHECK_GE(framer.GetFrameMaximumSize() - framer.GetFrameMinimumSize(),
162 length); 162 length);
163 } else { 163 } else {
164 DCHECK_GE(framer.GetFrameMaximumSize(), length); 164 DCHECK_GE(framer.GetFrameMaximumSize(), length);
165 } 165 }
166 bool success = false; 166 bool success = false;
167 const size_t old_length = length_; 167 const size_t old_length = length_;
168 168
169 if (framer.protocol_version() < 4) { 169 if (framer.protocol_version() < 4) {
170 FlagsAndLength flags_length = CreateFlagsAndLength( 170 FlagsAndLength flags_length = CreateFlagsAndLength(
171 0, // We're not writing over the flags value anyway. 171 0, // We're not writing over the flags value anyway.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 if (length_ + length > capacity_) { 205 if (length_ + length > capacity_) {
206 DCHECK(false); 206 DCHECK(false);
207 return false; 207 return false;
208 } 208 }
209 209
210 return true; 210 return true;
211 } 211 }
212 212
213 } // namespace net 213 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698