Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 797 FROM_HERE, | 797 FROM_HERE, |
| 798 base::Bind( | 798 base::Bind( |
| 799 &CollectNetworkStats, network_stats_server, io_thread)); | 799 &CollectNetworkStats, network_stats_server, io_thread)); |
| 800 return; | 800 return; |
| 801 } | 801 } |
| 802 | 802 |
| 803 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 803 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 804 | 804 |
| 805 // Check that there is a network connection. We get called only if UMA upload | 805 // Check that there is a network connection. We get called only if UMA upload |
| 806 // to the server has succeeded. | 806 // to the server has succeeded. |
| 807 DCHECK(!net::NetworkChangeNotifier::IsOffline()); | 807 DCHECK(net::NetworkChangeNotifier::GetConnectionType() != |
|
wtc
2012/05/11 01:35:05
Nit: use DCHECK_NE
| |
| 808 net::NetworkChangeNotifier::CONNECTION_NONE); | |
| 808 | 809 |
| 809 CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::FieldTrial>, trial, ()); | 810 CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::FieldTrial>, trial, ()); |
| 810 static bool collect_stats = false; | 811 static bool collect_stats = false; |
| 811 static NetworkStats::HistogramPortSelector histogram_port; | 812 static NetworkStats::HistogramPortSelector histogram_port; |
| 812 | 813 |
| 813 if (!trial.get()) { | 814 if (!trial.get()) { |
| 814 // Set up a field trial to collect network stats for UDP and TCP. | 815 // Set up a field trial to collect network stats for UDP and TCP. |
| 815 const base::FieldTrial::Probability kDivisor = 1000; | 816 const base::FieldTrial::Probability kDivisor = 1000; |
| 816 | 817 |
| 817 // Enable the connectivity testing for 0.5% of the users in stable channel. | 818 // Enable the connectivity testing for 0.5% of the users in stable channel. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 927 UDPStatsClient* packet_loss_udp_stats = new UDPStatsClient(); | 928 UDPStatsClient* packet_loss_udp_stats = new UDPStatsClient(); |
| 928 packet_loss_udp_stats->Start( | 929 packet_loss_udp_stats->Start( |
| 929 host_resolver, server_address, histogram_port, has_proxy_server, | 930 host_resolver, server_address, histogram_port, has_proxy_server, |
| 930 kLargeTestBytesToSend, kMaximumPackets, net::CompletionCallback()); | 931 kLargeTestBytesToSend, kMaximumPackets, net::CompletionCallback()); |
| 931 } | 932 } |
| 932 break; | 933 break; |
| 933 } | 934 } |
| 934 } | 935 } |
| 935 | 936 |
| 936 } // namespace chrome_browser_net | 937 } // namespace chrome_browser_net |
| OLD | NEW |