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

Side by Side Diff: net/spdy/spdy_framer.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, 10 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.cc ('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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after
1190 const SpdyMajorVersion spdy_version, 1190 const SpdyMajorVersion spdy_version,
1191 const SpdyHeaderBlock* headers) { 1191 const SpdyHeaderBlock* headers) {
1192 if (spdy_version < SPDY3) { 1192 if (spdy_version < SPDY3) {
1193 frame->WriteUInt16(static_cast<uint16>(headers->size())); 1193 frame->WriteUInt16(static_cast<uint16>(headers->size()));
1194 } else { 1194 } else {
1195 frame->WriteUInt32(headers->size()); 1195 frame->WriteUInt32(headers->size());
1196 } 1196 }
1197 SpdyHeaderBlock::const_iterator it; 1197 SpdyHeaderBlock::const_iterator it;
1198 for (it = headers->begin(); it != headers->end(); ++it) { 1198 for (it = headers->begin(); it != headers->end(); ++it) {
1199 if (spdy_version < SPDY3) { 1199 if (spdy_version < SPDY3) {
1200 frame->WriteString(it->first); 1200 frame->WriteStringPiece16(it->first);
1201 frame->WriteString(it->second); 1201 frame->WriteStringPiece16(it->second);
1202 } else { 1202 } else {
1203 frame->WriteStringPiece32(it->first); 1203 frame->WriteStringPiece32(it->first);
1204 frame->WriteStringPiece32(it->second); 1204 frame->WriteStringPiece32(it->second);
1205 } 1205 }
1206 } 1206 }
1207 } 1207 }
1208 1208
1209 // TODO(phajdan.jr): Clean up after we no longer need 1209 // TODO(phajdan.jr): Clean up after we no longer need
1210 // to workaround http://crbug.com/139744. 1210 // to workaround http://crbug.com/139744.
1211 #if !defined(USE_SYSTEM_ZLIB) 1211 #if !defined(USE_SYSTEM_ZLIB)
(...skipping 1995 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 builder->WriteUInt16(static_cast<uint16>(name_value_block.size())); 3207 builder->WriteUInt16(static_cast<uint16>(name_value_block.size()));
3208 } else { 3208 } else {
3209 builder->WriteUInt32(name_value_block.size()); 3209 builder->WriteUInt32(name_value_block.size());
3210 } 3210 }
3211 3211
3212 // Serialize each header. 3212 // Serialize each header.
3213 for (SpdyHeaderBlock::const_iterator it = name_value_block.begin(); 3213 for (SpdyHeaderBlock::const_iterator it = name_value_block.begin();
3214 it != name_value_block.end(); 3214 it != name_value_block.end();
3215 ++it) { 3215 ++it) {
3216 if (protocol_version() <= SPDY2) { 3216 if (protocol_version() <= SPDY2) {
3217 builder->WriteString(it->first); 3217 builder->WriteStringPiece16(it->first);
3218 builder->WriteString(it->second); 3218 builder->WriteStringPiece16(it->second);
3219 } else { 3219 } else {
3220 builder->WriteStringPiece32(it->first); 3220 builder->WriteStringPiece32(it->first);
3221 builder->WriteStringPiece32(it->second); 3221 builder->WriteStringPiece32(it->second);
3222 } 3222 }
3223 } 3223 }
3224 } 3224 }
3225 3225
3226 void SpdyFramer::SerializeNameValueBlock( 3226 void SpdyFramer::SerializeNameValueBlock(
3227 SpdyFrameBuilder* builder, 3227 SpdyFrameBuilder* builder,
3228 const SpdyFrameWithNameValueBlockIR& frame) { 3228 const SpdyFrameWithNameValueBlockIR& frame) {
(...skipping 48 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_frame_builder.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698