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

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

Issue 202063002: Added OverwriteFlags method to SpdyFrameBuilder. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_frame_builder.h ('k') | net/spdy/spdy_frame_builder_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_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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 sizeof(flags_length) - 1); 175 sizeof(flags_length) - 1);
176 } else { 176 } else {
177 length_ = 0; 177 length_ = 0;
178 success = WriteUInt16(length); 178 success = WriteUInt16(length);
179 } 179 }
180 180
181 length_ = old_length; 181 length_ = old_length;
182 return success; 182 return success;
183 } 183 }
184 184
185 bool SpdyFrameBuilder::OverwriteFlags(const SpdyFramer& framer,
186 uint8 flags) {
187 DCHECK_LE(SPDY4, framer.protocol_version());
188 bool success = false;
189 const size_t old_length = length_;
190 // Flags are the fourth octet in the frame prefix.
191 length_ = 3;
192 success = WriteUInt8(flags);
193 length_ = old_length;
194 return success;
195 }
196
185 bool SpdyFrameBuilder::CanWrite(size_t length) const { 197 bool SpdyFrameBuilder::CanWrite(size_t length) const {
186 if (length > kLengthMask) { 198 if (length > kLengthMask) {
187 DCHECK(false); 199 DCHECK(false);
188 return false; 200 return false;
189 } 201 }
190 202
191 if (length_ + length > capacity_) { 203 if (length_ + length > capacity_) {
192 DCHECK(false); 204 DCHECK(false);
193 return false; 205 return false;
194 } 206 }
195 207
196 return true; 208 return true;
197 } 209 }
198 210
199 } // namespace net 211 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_frame_builder.h ('k') | net/spdy/spdy_frame_builder_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698