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

Side by Side Diff: url/scheme_host_port.h

Issue 2561363002: Add std::string constructors for Origin/SchemeHostPort to reduce copies (Closed)
Patch Set: fix content_unittests Created 4 years 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 | « url/origin_unittest.cc ('k') | url/scheme_host_port.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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #ifndef URL_SCHEME_HOST_PORT_H_ 5 #ifndef URL_SCHEME_HOST_PORT_H_
6 #define URL_SCHEME_HOST_PORT_H_ 6 #define URL_SCHEME_HOST_PORT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 uint16_t port); 89 uint16_t port);
90 90
91 // Metadata influencing whether or not the constructor should sanity check 91 // Metadata influencing whether or not the constructor should sanity check
92 // host canonicalization. 92 // host canonicalization.
93 enum ConstructPolicy { CHECK_CANONICALIZATION, ALREADY_CANONICALIZED }; 93 enum ConstructPolicy { CHECK_CANONICALIZATION, ALREADY_CANONICALIZED };
94 94
95 // Creates a (scheme, host, port) tuple without performing sanity checking 95 // Creates a (scheme, host, port) tuple without performing sanity checking
96 // that the host and port are canonicalized. This should only be used when 96 // that the host and port are canonicalized. This should only be used when
97 // converting between already normalized types, and should NOT be used for 97 // converting between already normalized types, and should NOT be used for
98 // IPC. 98 // IPC.
99 SchemeHostPort(base::StringPiece scheme, 99 SchemeHostPort(std::string scheme,
100 base::StringPiece host, 100 std::string host,
101 uint16_t port, 101 uint16_t port,
102 ConstructPolicy policy); 102 ConstructPolicy policy);
103 103
104 // Creates a (scheme, host, port) tuple from |url|, as described at 104 // Creates a (scheme, host, port) tuple from |url|, as described at
105 // https://tools.ietf.org/html/rfc6454#section-4 105 // https://tools.ietf.org/html/rfc6454#section-4
106 // 106 //
107 // If |url| is invalid or non-standard, the result will be an invalid 107 // If |url| is invalid or non-standard, the result will be an invalid
108 // SchemeHostPort object. 108 // SchemeHostPort object.
109 explicit SchemeHostPort(const GURL& url); 109 explicit SchemeHostPort(const GURL& url);
110 110
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 std::string SerializeInternal(url::Parsed* parsed) const; 146 std::string SerializeInternal(url::Parsed* parsed) const;
147 147
148 std::string scheme_; 148 std::string scheme_;
149 std::string host_; 149 std::string host_;
150 uint16_t port_; 150 uint16_t port_;
151 }; 151 };
152 152
153 } // namespace url 153 } // namespace url
154 154
155 #endif // URL_SCHEME_HOST_PORT_H_ 155 #endif // URL_SCHEME_HOST_PORT_H_
OLDNEW
« no previous file with comments | « url/origin_unittest.cc ('k') | url/scheme_host_port.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698