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 //------------------------------------------------------------------------------ | 5 //------------------------------------------------------------------------------ |
6 // Description of the life cycle of a instance of MetricsService. | 6 // Description of the life cycle of a instance of MetricsService. |
7 // | 7 // |
8 // OVERVIEW | 8 // OVERVIEW |
9 // | 9 // |
10 // A MetricsService instance is typically created at application startup. It | 10 // A MetricsService instance is typically created at application startup. It |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 #include "base/threading/platform_thread.h" | 167 #include "base/threading/platform_thread.h" |
168 #include "base/threading/thread.h" | 168 #include "base/threading/thread.h" |
169 #include "base/utf_string_conversions.h" | 169 #include "base/utf_string_conversions.h" |
170 #include "base/values.h" | 170 #include "base/values.h" |
171 #include "chrome/browser/bookmarks/bookmark_model.h" | 171 #include "chrome/browser/bookmarks/bookmark_model.h" |
172 #include "chrome/browser/browser_process.h" | 172 #include "chrome/browser/browser_process.h" |
173 #include "chrome/browser/memory_details.h" | 173 #include "chrome/browser/memory_details.h" |
174 #include "chrome/browser/metrics/histogram_synchronizer.h" | 174 #include "chrome/browser/metrics/histogram_synchronizer.h" |
175 #include "chrome/browser/metrics/metrics_log.h" | 175 #include "chrome/browser/metrics/metrics_log.h" |
176 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" | 176 #include "chrome/browser/metrics/metrics_reporting_scheduler.h" |
177 #include "chrome/browser/net/network_stats.h" | |
177 #include "chrome/browser/prefs/pref_service.h" | 178 #include "chrome/browser/prefs/pref_service.h" |
178 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 179 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
179 #include "chrome/browser/profiles/profile.h" | 180 #include "chrome/browser/profiles/profile.h" |
180 #include "chrome/browser/search_engines/template_url_model.h" | 181 #include "chrome/browser/search_engines/template_url_model.h" |
181 #include "chrome/browser/ui/browser_list.h" | 182 #include "chrome/browser/ui/browser_list.h" |
182 #include "chrome/common/child_process_logging.h" | 183 #include "chrome/common/child_process_logging.h" |
183 #include "chrome/common/chrome_switches.h" | 184 #include "chrome/common/chrome_switches.h" |
184 #include "chrome/common/guid.h" | 185 #include "chrome/common/guid.h" |
185 #include "chrome/common/pref_names.h" | 186 #include "chrome/common/pref_names.h" |
186 #include "chrome/common/render_messages.h" | 187 #include "chrome/common/render_messages.h" |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
687 // private methods | 688 // private methods |
688 //------------------------------------------------------------------------------ | 689 //------------------------------------------------------------------------------ |
689 | 690 |
690 | 691 |
691 //------------------------------------------------------------------------------ | 692 //------------------------------------------------------------------------------ |
692 // Initialization methods | 693 // Initialization methods |
693 | 694 |
694 void MetricsService::InitializeMetricsState() { | 695 void MetricsService::InitializeMetricsState() { |
695 #if defined(OS_POSIX) | 696 #if defined(OS_POSIX) |
696 server_url_ = L"https://clients4.google.com/firefox/metrics/collect"; | 697 server_url_ = L"https://clients4.google.com/firefox/metrics/collect"; |
698 // TODO(rtenneti): Return the network stats server name. | |
699 network_stats_server_ = ""; | |
697 #else | 700 #else |
698 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); | 701 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); |
699 server_url_ = dist->GetStatsServerURL(); | 702 server_url_ = dist->GetStatsServerURL(); |
703 network_stats_server_ = dist->GetNetworkStatsServer(); | |
700 #endif | 704 #endif |
701 | 705 |
702 PrefService* pref = g_browser_process->local_state(); | 706 PrefService* pref = g_browser_process->local_state(); |
703 DCHECK(pref); | 707 DCHECK(pref); |
704 | 708 |
705 if ((pref->GetInt64(prefs::kStabilityStatsBuildTime) | 709 if ((pref->GetInt64(prefs::kStabilityStatsBuildTime) |
706 != MetricsLog::GetBuildTime()) || | 710 != MetricsLog::GetBuildTime()) || |
707 (pref->GetString(prefs::kStabilityStatsVersion) | 711 (pref->GetString(prefs::kStabilityStatsVersion) |
708 != MetricsLog::GetVersionString())) { | 712 != MetricsLog::GetVersionString())) { |
709 // This is a new version, so we don't want to confuse the stats about the | 713 // This is a new version, so we don't want to confuse the stats about the |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1020 // TODO(jar): If compression failed, we should have created a tiny log and | 1024 // TODO(jar): If compression failed, we should have created a tiny log and |
1021 // compressed that, so that we can signal that we're losing logs. | 1025 // compressed that, so that we can signal that we're losing logs. |
1022 return; | 1026 return; |
1023 } | 1027 } |
1024 | 1028 |
1025 DCHECK(!waiting_for_asynchronus_reporting_step_); | 1029 DCHECK(!waiting_for_asynchronus_reporting_step_); |
1026 | 1030 |
1027 waiting_for_asynchronus_reporting_step_ = true; | 1031 waiting_for_asynchronus_reporting_step_ = true; |
1028 current_fetch_->Start(); | 1032 current_fetch_->Start(); |
1029 | 1033 |
1034 chrome_browser_net::CollectNetworkStats(network_stats_server_); | |
Mike Belshe
2011/05/27 21:27:00
How often do you want to run this test? I'm not s
ramant (doing other things)
2011/05/31 21:25:36
Made changes per jar and your talks. CollectStats
| |
1035 | |
1030 HandleIdleSinceLastTransmission(true); | 1036 HandleIdleSinceLastTransmission(true); |
1031 } | 1037 } |
1032 | 1038 |
1033 | |
1034 void MetricsService::MakePendingLog() { | 1039 void MetricsService::MakePendingLog() { |
1035 if (pending_log()) | 1040 if (pending_log()) |
1036 return; | 1041 return; |
1037 | 1042 |
1038 switch (state_) { | 1043 switch (state_) { |
1039 case INITIALIZED: | 1044 case INITIALIZED: |
1040 case INIT_TASK_SCHEDULED: // We should be further along by now. | 1045 case INIT_TASK_SCHEDULED: // We should be further along by now. |
1041 DCHECK(false); | 1046 DCHECK(false); |
1042 return; | 1047 return; |
1043 | 1048 |
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1690 thread_id = base::PlatformThread::CurrentId(); | 1695 thread_id = base::PlatformThread::CurrentId(); |
1691 return base::PlatformThread::CurrentId() == thread_id; | 1696 return base::PlatformThread::CurrentId() == thread_id; |
1692 } | 1697 } |
1693 | 1698 |
1694 #if defined(OS_CHROMEOS) | 1699 #if defined(OS_CHROMEOS) |
1695 void MetricsService::StartExternalMetrics() { | 1700 void MetricsService::StartExternalMetrics() { |
1696 external_metrics_ = new chromeos::ExternalMetrics; | 1701 external_metrics_ = new chromeos::ExternalMetrics; |
1697 external_metrics_->Start(); | 1702 external_metrics_->Start(); |
1698 } | 1703 } |
1699 #endif | 1704 #endif |
OLD | NEW |