| Index: net/http/http_stream_factory_impl.cc
|
| diff --git a/net/http/http_stream_factory_impl.cc b/net/http/http_stream_factory_impl.cc
|
| index 577a990853ae6ac0e4d83987152c46b7873ee019..38d942e7a161fb8effa7c3fad2ceb4e99da3effd 100644
|
| --- a/net/http/http_stream_factory_impl.cc
|
| +++ b/net/http/http_stream_factory_impl.cc
|
| @@ -5,6 +5,7 @@
|
| #include "net/http/http_stream_factory_impl.h"
|
|
|
| #include <string>
|
| +#include <tuple>
|
|
|
| #include "base/logging.h"
|
| #include "base/memory/ptr_util.h"
|
| @@ -243,8 +244,26 @@ void HttpStreamFactoryImpl::OnJobControllerComplete(JobController* controller) {
|
| NOTREACHED();
|
| }
|
|
|
| +HttpStreamFactoryImpl::PreconnectingProxyServer::PreconnectingProxyServer(
|
| + ProxyServer proxy_server,
|
| + PrivacyMode privacy_mode)
|
| + : proxy_server(proxy_server), privacy_mode(privacy_mode) {}
|
| +
|
| +bool HttpStreamFactoryImpl::PreconnectingProxyServer::operator<(
|
| + const PreconnectingProxyServer& other) const {
|
| + return std::tie(proxy_server, privacy_mode) <
|
| + std::tie(other.proxy_server, other.privacy_mode);
|
| +}
|
| +
|
| +bool HttpStreamFactoryImpl::PreconnectingProxyServer::operator==(
|
| + const PreconnectingProxyServer& other) const {
|
| + return proxy_server == other.proxy_server &&
|
| + privacy_mode == other.privacy_mode;
|
| +}
|
| +
|
| bool HttpStreamFactoryImpl::OnInitConnection(const JobController& controller,
|
| - const ProxyInfo& proxy_info) {
|
| + const ProxyInfo& proxy_info,
|
| + PrivacyMode privacy_mode) {
|
| if (!controller.is_preconnect()) {
|
| // Connection initialization can be skipped only for the preconnect jobs.
|
| return false;
|
| @@ -255,8 +274,11 @@ bool HttpStreamFactoryImpl::OnInitConnection(const JobController& controller,
|
| return false;
|
| }
|
|
|
| + PreconnectingProxyServer preconnecting_proxy_server(proxy_info.proxy_server(),
|
| + privacy_mode);
|
| +
|
| if (base::ContainsKey(preconnecting_proxy_servers_,
|
| - proxy_info.proxy_server())) {
|
| + preconnecting_proxy_server)) {
|
| UMA_HISTOGRAM_EXACT_LINEAR("Net.PreconnectSkippedToProxyServers", 1, 2);
|
| // Skip preconnect to the proxy server since we are already preconnecting
|
| // (probably via some other job).
|
| @@ -272,16 +294,18 @@ bool HttpStreamFactoryImpl::OnInitConnection(const JobController& controller,
|
| preconnecting_proxy_servers_.erase(preconnecting_proxy_servers_.begin());
|
| }
|
|
|
| - preconnecting_proxy_servers_.insert(proxy_info.proxy_server());
|
| + preconnecting_proxy_servers_.insert(preconnecting_proxy_server);
|
| DCHECK_GE(kMaxPreconnectingServerSize, preconnecting_proxy_servers_.size());
|
| // The first preconnect should be allowed.
|
| return false;
|
| }
|
|
|
| -void HttpStreamFactoryImpl::OnStreamReady(const ProxyInfo& proxy_info) {
|
| +void HttpStreamFactoryImpl::OnStreamReady(const ProxyInfo& proxy_info,
|
| + PrivacyMode privacy_mode) {
|
| if (proxy_info.is_empty())
|
| return;
|
| - preconnecting_proxy_servers_.erase(proxy_info.proxy_server());
|
| + preconnecting_proxy_servers_.erase(
|
| + PreconnectingProxyServer(proxy_info.proxy_server(), privacy_mode));
|
| }
|
|
|
| bool HttpStreamFactoryImpl::ProxyServerSupportsPriorities(
|
|
|