Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/proxy/proxy_server.h" | 5 #include "net/proxy/proxy_server.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "net/base/url_util.h" | 10 #include "net/base/url_util.h" |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 202 break; | 202 break; |
| 203 } | 203 } |
| 204 return -1; | 204 return -1; |
| 205 } | 205 } |
| 206 | 206 |
| 207 // static | 207 // static |
| 208 ProxyServer::Scheme ProxyServer::GetSchemeFromURI(const std::string& scheme) { | 208 ProxyServer::Scheme ProxyServer::GetSchemeFromURI(const std::string& scheme) { |
| 209 return GetSchemeFromURIInternal(scheme); | 209 return GetSchemeFromURIInternal(scheme); |
| 210 } | 210 } |
| 211 | 211 |
| 212 size_t ProxyServer::EstimateMemoryUsage() const { | |
| 213 return HostPortPair::EstimateMemoryUsage(host_port_pair_); | |
|
Bence
2017/02/02 14:15:19
1.It's just a string, how bad can it get? Few doz
xunjieli
2017/02/02 14:53:42
dskiba@ can correct me if I am wrong. My understan
Bence
2017/02/02 15:05:08
Ah okay, that makes perfect sense. Thank you for
| |
| 214 } | |
| 215 | |
| 212 // static | 216 // static |
| 213 ProxyServer ProxyServer::FromSchemeHostAndPort( | 217 ProxyServer ProxyServer::FromSchemeHostAndPort( |
| 214 Scheme scheme, | 218 Scheme scheme, |
| 215 std::string::const_iterator begin, | 219 std::string::const_iterator begin, |
| 216 std::string::const_iterator end) { | 220 std::string::const_iterator end) { |
| 217 | 221 |
| 218 // Trim leading/trailing space. | 222 // Trim leading/trailing space. |
| 219 HttpUtil::TrimLWS(&begin, &end); | 223 HttpUtil::TrimLWS(&begin, &end); |
| 220 | 224 |
| 221 if (scheme == SCHEME_DIRECT && begin != end) | 225 if (scheme == SCHEME_DIRECT && begin != end) |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 235 if (port == -1) | 239 if (port == -1) |
| 236 port = GetDefaultPortForScheme(scheme); | 240 port = GetDefaultPortForScheme(scheme); |
| 237 | 241 |
| 238 host_port_pair = HostPortPair(host, static_cast<uint16_t>(port)); | 242 host_port_pair = HostPortPair(host, static_cast<uint16_t>(port)); |
| 239 } | 243 } |
| 240 | 244 |
| 241 return ProxyServer(scheme, host_port_pair); | 245 return ProxyServer(scheme, host_port_pair); |
| 242 } | 246 } |
| 243 | 247 |
| 244 } // namespace net | 248 } // namespace net |
| OLD | NEW |