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

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

Issue 2758163003: Use string(StringPiece) instead of StringPiece::as_string(). (Closed)
Patch Set: Add StringPiece unittests. Created 3 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_test.cc ('k') | no next file » | 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_header_block.h" 5 #include "net/spdy/spdy_header_block.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <utility> 10 #include <utility>
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 lookup_result_->second = 211 lookup_result_->second =
212 HeaderValue(storage_, key_, storage_->Write(value)); 212 HeaderValue(storage_, key_, storage_->Write(value));
213 } 213 }
214 return *this; 214 return *this;
215 } 215 }
216 216
217 string SpdyHeaderBlock::ValueProxy::as_string() const { 217 string SpdyHeaderBlock::ValueProxy::as_string() const {
218 if (lookup_result_ == block_->end()) { 218 if (lookup_result_ == block_->end()) {
219 return ""; 219 return "";
220 } else { 220 } else {
221 return lookup_result_->second.value().as_string(); 221 return std::string(lookup_result_->second.value());
222 } 222 }
223 } 223 }
224 224
225 SpdyHeaderBlock::SpdyHeaderBlock() : block_(kInitialMapBuckets) {} 225 SpdyHeaderBlock::SpdyHeaderBlock() : block_(kInitialMapBuckets) {}
226 226
227 SpdyHeaderBlock::SpdyHeaderBlock(SpdyHeaderBlock&& other) = default; 227 SpdyHeaderBlock::SpdyHeaderBlock(SpdyHeaderBlock&& other) = default;
228 228
229 SpdyHeaderBlock::~SpdyHeaderBlock() {} 229 SpdyHeaderBlock::~SpdyHeaderBlock() {}
230 230
231 SpdyHeaderBlock& SpdyHeaderBlock::operator=(SpdyHeaderBlock&& other) { 231 SpdyHeaderBlock& SpdyHeaderBlock::operator=(SpdyHeaderBlock&& other) {
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
397 for (++it; it != fragments.end(); ++it) { 397 for (++it; it != fragments.end(); ++it) {
398 memcpy(dst, separator.data(), separator.size()); 398 memcpy(dst, separator.data(), separator.size());
399 dst += separator.size(); 399 dst += separator.size();
400 memcpy(dst, it->data(), it->size()); 400 memcpy(dst, it->data(), it->size());
401 dst += it->size(); 401 dst += it->size();
402 } 402 }
403 return dst - original_dst; 403 return dst - original_dst;
404 } 404 }
405 405
406 } // namespace net 406 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_framer_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698