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

Unified Diff: chrome/browser/net/network_stats.h

Issue 10206035: NetConnectivity - Collect stats for TCP/UDP network (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 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 | « no previous file | chrome/browser/net/network_stats.cc » ('j') | chrome/browser/net/network_stats.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/network_stats.h
===================================================================
--- chrome/browser/net/network_stats.h (revision 132599)
+++ chrome/browser/net/network_stats.h (working copy)
@@ -21,6 +21,7 @@
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
#include "net/base/test_data_stream.h"
+#include "net/proxy/proxy_info.h"
#include "net/socket/socket.h"
namespace chrome_browser_net {
@@ -100,6 +101,7 @@
bool Start(net::HostResolver* host_resolver,
const net::HostPortPair& server,
HistogramPortSelector histogram_port,
+ bool has_no_proxy_server,
uint32 bytes_to_send,
const net::CompletionCallback& callback);
@@ -114,6 +116,7 @@
// |finished_callback| is mainly useful for unittests.
void Initialize(uint32 bytes_to_send,
HistogramPortSelector histogram_port,
+ bool has_no_proxy_server,
const net::CompletionCallback& finished_callback);
// Called after host is resolved. UDPStatsClient and TCPStatsClient implement
@@ -213,21 +216,29 @@
// Returns the histogram names for collecting network connectivity stats.
// This is called by RecordHistograms. It sets the histogram names in
- // |rtt_histogram_name| and |status_histogram_name|.
+ // |rtt_histogram_name| and |status_histogram_name|. It always returns
+ // "NetConnectivity.<protocol>.Status.<port>.<load_size>" as histogram name
+ // for status histogram in |status_histogram_name|.
// If |result| equals to net::OK, it returns
// "NetConnectivity.<protocol>.Success.<port>.<load_size>.RTT" as histogram
- // name for RTT histogram and
- // "NetConnectivity.<protocol>.Status.<port>.<load_size>" as histogram name
- // for status histogram. |protocol| argument sets <protocol> in the histogram
- // name. It would be either TCP or UDP. <port> is the string representation of
- // |histogram_port|. |load_size| argument determines <load_size> in the
- // histogram name. It would be either 100B or 1K.
+ // name in |rtt_histogram_name|. If |has_no_proxy_server| is true, it returns
+ // "NetConnectivity.<protocol>.NoProxy.Success.<port>.<load_size>.RTT" as
+ // histogram name for RTT histogram in |rtt_no_proxy_histogram_name| and
+ // "NetConnectivity.<protocol>.NoProxy.Status.<port>.<load_size>" as histogram
+ // name for status histogram in |status_no_proxy_histogram_name|.
+ // |protocol| argument sets <protocol> in the histogram name. It would be
+ // either TCP or UDP. <port> is the string representation of |histogram_port|.
+ // |load_size| argument determines <load_size> in the histogram name. It would
+ // be either 100B or 1K.
static void GetHistogramNames(const ProtocolValue& protocol,
HistogramPortSelector histogram_port,
+ bool has_no_proxy_server,
uint32 load_size,
int result,
std::string* rtt_histogram_name,
- std::string* status_histogram_name);
+ std::string* rtt_no_proxy_histogram_name,
+ std::string* status_histogram_name,
+ std::string* status_no_proxy_histogram_name);
// The socket handle for this session.
scoped_ptr<net::Socket> socket_;
@@ -254,6 +265,9 @@
// connectivity.
HistogramPortSelector histogram_port_;
+ // |has_no_proxy_server_| specifies if there is a proxy server or not.
+ bool has_no_proxy_server_;
+
// HostResolver fills out the |addresses_| after host resolution is completed.
net::AddressList addresses_;
@@ -324,6 +338,40 @@
void OnConnectComplete(int result);
};
+class ProxyClient {
+ public:
+ // Constructs a ProxyClient object that resolves if access to
+ // network_stats_server goes through a proxy server or not.
+ ProxyClient(const std::string& network_stats_server,
+ NetworkStats::HistogramPortSelector histogram_port,
+ IOThread* io_thread);
+ virtual ~ProxyClient();
+
+ // This method uses system ProxyService to resolve the proxy for the given
+ // |network_stats_server| and |histogram_port|.
+ void ResolveProxy();
+
+ // Collects the network connectivity stats for UDP and TCP protocols.
+ void OnResolveProxyComplete(int result);
+
+ private:
+ // |network_stats_server_| specifies the TCP/UDP echo server name.
+ std::string network_stats_server_;
+
+ // |histogram_port_| specifies the port for which we are testing the network
+ // connectivity.
+ NetworkStats::HistogramPortSelector histogram_port_;
+
+ // |proxy_info_| holds proxy information returned by ResolveProxy.
+ net::ProxyInfo proxy_info_;
+
+ // The IOThread for accessing global HostResolver to resolve
+ // network_stats_server_ host and for accessing global system ProxyService.
+ // |io_thread_| is accessed on IO thread and it is safe to access it on IO
+ // thread.
+ IOThread* io_thread_;
+};
+
// This collects the network connectivity stats for UDP and TCP for small
// percentage of users who are participating in the experiment. All users must
// have enabled "UMA upload". This method gets called only if UMA upload to the
« no previous file with comments | « no previous file | chrome/browser/net/network_stats.cc » ('j') | chrome/browser/net/network_stats.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698