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

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

Issue 910393003: Rename WriteString to WriteStringPiece16 in SpdyFrameBuilder (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_frame_builder.h ('k') | 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 // actual frame length. 123 // actual frame length.
124 success &= WriteUInt24(capacity_ - offset_ - framer.GetPrefixLength(type)); 124 success &= WriteUInt24(capacity_ - offset_ - framer.GetPrefixLength(type));
125 success &= WriteUInt8( 125 success &= WriteUInt8(
126 SpdyConstants::SerializeFrameType(version_, type)); 126 SpdyConstants::SerializeFrameType(version_, type));
127 success &= WriteUInt8(flags); 127 success &= WriteUInt8(flags);
128 success &= WriteUInt32(stream_id); 128 success &= WriteUInt32(stream_id);
129 DCHECK_EQ(framer.GetDataFrameMinimumSize(), length_); 129 DCHECK_EQ(framer.GetDataFrameMinimumSize(), length_);
130 return success; 130 return success;
131 } 131 }
132 132
133 bool SpdyFrameBuilder::WriteString(const std::string& value) { 133 bool SpdyFrameBuilder::WriteStringPiece16(const base::StringPiece& value) {
134 if (value.size() > 0xffff) { 134 if (value.size() > 0xffff) {
135 DCHECK(false) << "Tried to write string with length > 16bit."; 135 DCHECK(false) << "Tried to write string with length > 16bit.";
136 return false; 136 return false;
137 } 137 }
138 138
139 if (!WriteUInt16(static_cast<uint16>(value.size()))) 139 if (!WriteUInt16(static_cast<uint16>(value.size())))
140 return false; 140 return false;
141 141
142 return WriteBytes(value.data(), static_cast<uint16>(value.size())); 142 return WriteBytes(value.data(), static_cast<uint16>(value.size()));
143 } 143 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 216
217 if (offset_ + length_ + length > capacity_) { 217 if (offset_ + length_ + length > capacity_) {
218 DCHECK(false); 218 DCHECK(false);
219 return false; 219 return false;
220 } 220 }
221 221
222 return true; 222 return true;
223 } 223 }
224 224
225 } // namespace net 225 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_frame_builder.h ('k') | net/spdy/spdy_framer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698