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

Unified Diff: net/spdy/spdy_alt_svc_wire_format.cc

Issue 2801603003: Add SpdyString alias for std::string in net/spdy. (Closed)
Patch Set: Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/spdy/spdy_alt_svc_wire_format.h ('k') | net/spdy/spdy_alt_svc_wire_format_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_alt_svc_wire_format.cc
diff --git a/net/spdy/spdy_alt_svc_wire_format.cc b/net/spdy/spdy_alt_svc_wire_format.cc
index d1205dd7e5df847500354c61fe64ce5fd8698d30..803fb7bc3d4ab08793d347e591a82e067b7909a7 100644
--- a/net/spdy/spdy_alt_svc_wire_format.cc
+++ b/net/spdy/spdy_alt_svc_wire_format.cc
@@ -7,7 +7,6 @@
#include <algorithm>
#include <cctype>
#include <limits>
-#include <string>
#include "base/logging.h"
#include "net/spdy/platform/api/spdy_string_utils.h"
@@ -39,8 +38,8 @@ bool ParsePositiveIntegerImpl(SpdyStringPiece::const_iterator c,
SpdyAltSvcWireFormat::AlternativeService::AlternativeService() {}
SpdyAltSvcWireFormat::AlternativeService::AlternativeService(
- const std::string& protocol_id,
- const std::string& host,
+ const SpdyString& protocol_id,
+ const SpdyString& host,
uint16_t port,
uint32_t max_age,
VersionVector version)
@@ -72,7 +71,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
// Parse protocol-id.
SpdyStringPiece::const_iterator percent_encoded_protocol_id_end =
std::find(c, value.end(), '=');
- std::string protocol_id;
+ SpdyString protocol_id;
if (percent_encoded_protocol_id_end == c ||
!PercentDecode(c, percent_encoded_protocol_id_end, &protocol_id)) {
return false;
@@ -103,7 +102,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
return false;
}
DCHECK_EQ('"', *c);
- std::string host;
+ SpdyString host;
uint16_t port;
if (!ParseAltAuthority(alt_authority_begin, c, &host, &port)) {
return false;
@@ -127,7 +126,7 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
if (c == parameters_end) {
break;
}
- std::string parameter_name;
+ SpdyString parameter_name;
for (; c != parameters_end && *c != '=' && *c != ' ' && *c != '\t'; ++c) {
parameter_name.push_back(tolower(*c));
}
@@ -188,13 +187,13 @@ bool SpdyAltSvcWireFormat::ParseHeaderFieldValue(
}
// static
-std::string SpdyAltSvcWireFormat::SerializeHeaderFieldValue(
+SpdyString SpdyAltSvcWireFormat::SerializeHeaderFieldValue(
const AlternativeServiceVector& altsvc_vector) {
if (altsvc_vector.empty()) {
- return std::string("clear");
+ return SpdyString("clear");
}
const char kNibbleToHex[] = "0123456789ABCDEF";
- std::string value;
+ SpdyString value;
for (const AlternativeService& altsvc : altsvc_vector) {
if (!value.empty()) {
value.push_back(',');
@@ -268,7 +267,7 @@ void SpdyAltSvcWireFormat::SkipWhiteSpace(SpdyStringPiece::const_iterator* c,
// static
bool SpdyAltSvcWireFormat::PercentDecode(SpdyStringPiece::const_iterator c,
SpdyStringPiece::const_iterator end,
- std::string* output) {
+ SpdyString* output) {
output->clear();
for (; c != end; ++c) {
if (*c != '%') {
@@ -296,7 +295,7 @@ bool SpdyAltSvcWireFormat::PercentDecode(SpdyStringPiece::const_iterator c,
bool SpdyAltSvcWireFormat::ParseAltAuthority(
SpdyStringPiece::const_iterator c,
SpdyStringPiece::const_iterator end,
- std::string* host,
+ SpdyString* host,
uint16_t* port) {
host->clear();
if (c == end) {
« no previous file with comments | « net/spdy/spdy_alt_svc_wire_format.h ('k') | net/spdy/spdy_alt_svc_wire_format_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698