1 // Copyright 2014 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "chrome/browser/metrics/network_stats_uploader.h" 6 7 #include "chrome/browser/browser_process.h" 8 #include "chrome/browser/metrics/time_ticks_experiment_win.h" 9 #include "chrome/browser/net/network_stats.h" 10 #include "chrome/common/net/test_server_locations.h" 11 12 #if !defined(OS_POSIX) 13 #include "chrome/installer/util/browser_distribution.h" 14 #endif 15 NetworkStatsUploader()16NetworkStatsUploader::NetworkStatsUploader() { 17 #if defined(OS_POSIX) 18 network_stats_server_ = chrome_common_net::kEchoTestServerLocation; 19 #else 20 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 21 network_stats_server_ = dist->GetNetworkStatsServer(); 22 #endif 23 } 24 ~NetworkStatsUploader()25NetworkStatsUploader::~NetworkStatsUploader() { 26 } 27 CollectAndReportNetworkStats()28void NetworkStatsUploader::CollectAndReportNetworkStats() { 29 IOThread* io_thread = g_browser_process->io_thread(); 30 if (!io_thread) 31 return; 32 33 chrome_browser_net::CollectNetworkStats(network_stats_server_, io_thread); 34 #if defined(OS_WIN) 35 chrome::CollectTimeTicksStats(); 36 #endif 37 } 38