Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/callback_old.h" | 7 #include "base/callback_old.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 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 532 &CollectNetworkStats, network_stats_server, io_thread)); | 532 &CollectNetworkStats, network_stats_server, io_thread)); |
| 533 return; | 533 return; |
| 534 } | 534 } |
| 535 | 535 |
| 536 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 536 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 537 | 537 |
| 538 // Check that there is a network connection. We get called only if UMA upload | 538 // Check that there is a network connection. We get called only if UMA upload |
| 539 // to the server has succeeded. | 539 // to the server has succeeded. |
| 540 DCHECK(!net::NetworkChangeNotifier::IsOffline()); | 540 DCHECK(!net::NetworkChangeNotifier::IsOffline()); |
| 541 | 541 |
| 542 static scoped_refptr<base::FieldTrial> trial = NULL; | 542 CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::FieldTrial>, trial, (NULL)); |
|
Mark Mentovai
2011/11/16 22:54:24
You can use () instead of (NULL) here.
Nico
2011/11/16 22:59:20
Done.
| |
| 543 static bool collect_stats = false; | 543 static bool collect_stats = false; |
| 544 | 544 |
| 545 if (!trial.get()) { | 545 if (!trial.get()) { |
| 546 // Set up a field trial to collect network stats for UDP and TCP. | 546 // Set up a field trial to collect network stats for UDP and TCP. |
| 547 base::FieldTrial::Probability kDivisor = 1000; | 547 base::FieldTrial::Probability kDivisor = 1000; |
| 548 | 548 |
| 549 // Enable the connectivity testing for 0.5% of the users. | 549 // Enable the connectivity testing for 0.5% of the users. |
| 550 base::FieldTrial::Probability kProbabilityPerGroup = 5; | 550 base::FieldTrial::Probability kProbabilityPerGroup = 5; |
| 551 | 551 |
| 552 // After October 30, 2011 builds, it will always be in default group | 552 // After October 30, 2011 builds, it will always be in default group |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 596 TCPStatsClient* small_tcp_client = new TCPStatsClient(); | 596 TCPStatsClient* small_tcp_client = new TCPStatsClient(); |
| 597 small_tcp_client->Start( | 597 small_tcp_client->Start( |
| 598 host_resolver, tcp_server_address, kSmallTestBytesToSend, NULL); | 598 host_resolver, tcp_server_address, kSmallTestBytesToSend, NULL); |
| 599 | 599 |
| 600 TCPStatsClient* large_tcp_client = new TCPStatsClient(); | 600 TCPStatsClient* large_tcp_client = new TCPStatsClient(); |
| 601 large_tcp_client->Start( | 601 large_tcp_client->Start( |
| 602 host_resolver, tcp_server_address, kLargeTestBytesToSend, NULL); | 602 host_resolver, tcp_server_address, kLargeTestBytesToSend, NULL); |
| 603 } | 603 } |
| 604 | 604 |
| 605 } // namespace chrome_browser_net | 605 } // namespace chrome_browser_net |
| OLD | NEW |