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

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

Issue 9147026: API for connection type (Ethernet/WIFI/WWAN ...) in NetworkChangeNotifier. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 11 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 (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 515 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 FROM_HERE, 526 FROM_HERE,
527 base::Bind( 527 base::Bind(
528 &CollectNetworkStats, network_stats_server, io_thread)); 528 &CollectNetworkStats, network_stats_server, io_thread));
529 return; 529 return;
530 } 530 }
531 531
532 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 532 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
533 533
534 // Check that there is a network connection. We get called only if UMA upload 534 // Check that there is a network connection. We get called only if UMA upload
535 // to the server has succeeded. 535 // to the server has succeeded.
536 DCHECK(!net::NetworkChangeNotifier::IsOffline()); 536 DCHECK(net::NetworkChangeNotifier::GetConnectionState() !=
537 net::NetworkChangeNotifier::NONE);
537 538
538 CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::FieldTrial>, trial, ()); 539 CR_DEFINE_STATIC_LOCAL(scoped_refptr<base::FieldTrial>, trial, ());
539 static bool collect_stats = false; 540 static bool collect_stats = false;
540 541
541 if (!trial.get()) { 542 if (!trial.get()) {
542 // Set up a field trial to collect network stats for UDP and TCP. 543 // Set up a field trial to collect network stats for UDP and TCP.
543 const base::FieldTrial::Probability kDivisor = 1000; 544 const base::FieldTrial::Probability kDivisor = 1000;
544 545
545 // Enable the connectivity testing for 0.5% of the users. 546 // Enable the connectivity testing for 0.5% of the users.
546 base::FieldTrial::Probability probability_per_group = 5; 547 base::FieldTrial::Probability probability_per_group = 5;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
599 host_resolver, tcp_server_address, kSmallTestBytesToSend, 600 host_resolver, tcp_server_address, kSmallTestBytesToSend,
600 net::CompletionCallback()); 601 net::CompletionCallback());
601 602
602 TCPStatsClient* large_tcp_client = new TCPStatsClient(); 603 TCPStatsClient* large_tcp_client = new TCPStatsClient();
603 large_tcp_client->Start( 604 large_tcp_client->Start(
604 host_resolver, tcp_server_address, kLargeTestBytesToSend, 605 host_resolver, tcp_server_address, kLargeTestBytesToSend,
605 net::CompletionCallback()); 606 net::CompletionCallback());
606 } 607 }
607 608
608 } // namespace chrome_browser_net 609 } // namespace chrome_browser_net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698