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

Side by Side Diff: chrome/browser/net/network_stats.cc

Issue 332313003: Add Finch experiment for selectively bypassing proxies. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: bengr's nit Created 6 years, 5 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
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/net/network_stats.h" 5 #include "chrome/browser/net/network_stats.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/metrics/field_trial.h" 10 #include "base/metrics/field_trial.h"
11 #include "base/metrics/histogram.h" 11 #include "base/metrics/histogram.h"
12 #include "base/rand_util.h" 12 #include "base/rand_util.h"
13 #include "base/strings/stringprintf.h" 13 #include "base/strings/stringprintf.h"
14 #include "base/time/time.h" 14 #include "base/time/time.h"
15 #include "chrome/common/chrome_version_info.h" 15 #include "chrome/common/chrome_version_info.h"
16 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
17 #include "net/base/load_flags.h"
17 #include "net/base/net_errors.h" 18 #include "net/base/net_errors.h"
18 #include "net/base/network_change_notifier.h" 19 #include "net/base/network_change_notifier.h"
19 #include "net/base/test_completion_callback.h" 20 #include "net/base/test_completion_callback.h"
20 #include "net/dns/single_request_host_resolver.h" 21 #include "net/dns/single_request_host_resolver.h"
21 #include "net/proxy/proxy_service.h" 22 #include "net/proxy/proxy_service.h"
22 #include "net/socket/client_socket_factory.h" 23 #include "net/socket/client_socket_factory.h"
23 #include "net/udp/datagram_client_socket.h" 24 #include "net/udp/datagram_client_socket.h"
24 #include "url/gurl.h" 25 #include "url/gurl.h"
25 26
26 using content::BrowserThread; 27 using content::BrowserThread;
(...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 814
814 void ProxyDetector::StartResolveProxy() { 815 void ProxyDetector::StartResolveProxy() {
815 std::string url = 816 std::string url =
816 base::StringPrintf("https://%s", server_address_.ToString().c_str()); 817 base::StringPrintf("https://%s", server_address_.ToString().c_str());
817 GURL gurl(url); 818 GURL gurl(url);
818 819
819 has_pending_proxy_resolution_ = true; 820 has_pending_proxy_resolution_ = true;
820 DCHECK(proxy_service_); 821 DCHECK(proxy_service_);
821 int rv = proxy_service_->ResolveProxy( 822 int rv = proxy_service_->ResolveProxy(
822 gurl, 823 gurl,
824 net::LOAD_NORMAL,
823 &proxy_info_, 825 &proxy_info_,
824 base::Bind(&ProxyDetector::OnResolveProxyComplete, 826 base::Bind(&ProxyDetector::OnResolveProxyComplete,
825 base::Unretained(this)), 827 base::Unretained(this)),
826 NULL, 828 NULL,
829 NULL,
827 net::BoundNetLog()); 830 net::BoundNetLog());
828 if (rv != net::ERR_IO_PENDING) 831 if (rv != net::ERR_IO_PENDING)
829 OnResolveProxyComplete(rv); 832 OnResolveProxyComplete(rv);
830 } 833 }
831 834
832 void ProxyDetector::OnResolveProxyComplete(int result) { 835 void ProxyDetector::OnResolveProxyComplete(int result) {
833 has_pending_proxy_resolution_ = false; 836 has_pending_proxy_resolution_ = false;
834 bool has_proxy_server = 837 bool has_proxy_server =
835 (result == net::OK && proxy_info_.proxy_server().is_valid() && 838 (result == net::OK && proxy_info_.proxy_server().is_valid() &&
836 !proxy_info_.proxy_server().is_direct()); 839 !proxy_info_.proxy_server().is_direct());
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 udp_stats_client->Start(host_resolver, 950 udp_stats_client->Start(host_resolver,
948 server_address, 951 server_address,
949 histogram_port, 952 histogram_port,
950 has_proxy_server, 953 has_proxy_server,
951 kProbePacketBytes[probe_choice], 954 kProbePacketBytes[probe_choice],
952 bytes_for_packet_size_test, 955 bytes_for_packet_size_test,
953 net::CompletionCallback()); 956 net::CompletionCallback());
954 } 957 }
955 958
956 } // namespace chrome_browser_net 959 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698