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 //------------------------------------------------------------------------------ | 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 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 #include "chrome/browser/search_engines/template_url_service.h" | 170 #include "chrome/browser/search_engines/template_url_service.h" |
171 #include "chrome/browser/ui/browser_list.h" | 171 #include "chrome/browser/ui/browser_list.h" |
172 #include "chrome/common/child_process_logging.h" | 172 #include "chrome/common/child_process_logging.h" |
173 #include "chrome/common/chrome_notification_types.h" | 173 #include "chrome/common/chrome_notification_types.h" |
174 #include "chrome/common/chrome_switches.h" | 174 #include "chrome/common/chrome_switches.h" |
175 #include "chrome/common/guid.h" | 175 #include "chrome/common/guid.h" |
176 #include "chrome/common/metrics/metrics_log_manager.h" | 176 #include "chrome/common/metrics/metrics_log_manager.h" |
177 #include "chrome/common/pref_names.h" | 177 #include "chrome/common/pref_names.h" |
178 #include "chrome/common/render_messages.h" | 178 #include "chrome/common/render_messages.h" |
179 #include "content/browser/load_notification_details.h" | 179 #include "content/browser/load_notification_details.h" |
| 180 #include "content/public/browser/child_process_data.h" |
180 #include "content/public/browser/notification_service.h" | 181 #include "content/public/browser/notification_service.h" |
181 #include "content/public/browser/plugin_service.h" | 182 #include "content/public/browser/plugin_service.h" |
182 #include "content/public/browser/render_process_host.h" | 183 #include "content/public/browser/render_process_host.h" |
183 #include "content/public/common/url_fetcher.h" | 184 #include "content/public/common/url_fetcher.h" |
184 #include "webkit/plugins/webplugininfo.h" | 185 #include "webkit/plugins/webplugininfo.h" |
185 | 186 |
186 // TODO(port): port browser_distribution.h. | 187 // TODO(port): port browser_distribution.h. |
187 #if !defined(OS_POSIX) | 188 #if !defined(OS_POSIX) |
188 #include "chrome/installer/util/browser_distribution.h" | 189 #include "chrome/installer/util/browser_distribution.h" |
189 #endif | 190 #endif |
190 | 191 |
191 #if defined(OS_CHROMEOS) | 192 #if defined(OS_CHROMEOS) |
192 #include "chrome/browser/chromeos/cros/cros_library.h" | 193 #include "chrome/browser/chromeos/cros/cros_library.h" |
193 #include "chrome/browser/chromeos/external_metrics.h" | 194 #include "chrome/browser/chromeos/external_metrics.h" |
194 #include "chrome/browser/chromeos/system/statistics_provider.h" | 195 #include "chrome/browser/chromeos/system/statistics_provider.h" |
195 #endif | 196 #endif |
196 | 197 |
197 using base::Time; | 198 using base::Time; |
198 using content::BrowserThread; | 199 using content::BrowserThread; |
| 200 using content::ChildProcessData; |
199 using content::PluginService; | 201 using content::PluginService; |
200 | 202 |
201 // Check to see that we're being called on only one thread. | 203 // Check to see that we're being called on only one thread. |
202 static bool IsSingleThreaded(); | 204 static bool IsSingleThreaded(); |
203 | 205 |
204 static const char kMetricsType[] = "application/vnd.mozilla.metrics.bz2"; | 206 static const char kMetricsType[] = "application/vnd.mozilla.metrics.bz2"; |
205 | 207 |
206 // The delay, in seconds, after starting recording before doing expensive | 208 // The delay, in seconds, after starting recording before doing expensive |
207 // initialization work. | 209 // initialization work. |
208 static const int kInitializationDelaySeconds = 30; | 210 static const int kInitializationDelaySeconds = 30; |
(...skipping 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 // Wake up metrics logs sending if necessary now that new | 1330 // Wake up metrics logs sending if necessary now that new |
1329 // log data is available. | 1331 // log data is available. |
1330 HandleIdleSinceLastTransmission(false); | 1332 HandleIdleSinceLastTransmission(false); |
1331 } | 1333 } |
1332 #endif // OS_CHROMEOS | 1334 #endif // OS_CHROMEOS |
1333 | 1335 |
1334 void MetricsService::LogChildProcessChange( | 1336 void MetricsService::LogChildProcessChange( |
1335 int type, | 1337 int type, |
1336 const content::NotificationSource& source, | 1338 const content::NotificationSource& source, |
1337 const content::NotificationDetails& details) { | 1339 const content::NotificationDetails& details) { |
1338 content::Details<content::ChildProcessData> child_details(details); | 1340 content::Details<ChildProcessData> child_details(details); |
1339 const string16& child_name = child_details->name; | 1341 const string16& child_name = child_details->name; |
1340 | 1342 |
1341 if (child_process_stats_buffer_.find(child_name) == | 1343 if (child_process_stats_buffer_.find(child_name) == |
1342 child_process_stats_buffer_.end()) { | 1344 child_process_stats_buffer_.end()) { |
1343 child_process_stats_buffer_[child_name] = | 1345 child_process_stats_buffer_[child_name] = |
1344 ChildProcessStats(child_details->type); | 1346 ChildProcessStats(child_details->type); |
1345 } | 1347 } |
1346 | 1348 |
1347 ChildProcessStats& stats = child_process_stats_buffer_[child_name]; | 1349 ChildProcessStats& stats = child_process_stats_buffer_[child_name]; |
1348 switch (type) { | 1350 switch (type) { |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1548 if (local_state) { | 1550 if (local_state) { |
1549 const PrefService::Preference* uma_pref = | 1551 const PrefService::Preference* uma_pref = |
1550 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1552 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1551 if (uma_pref) { | 1553 if (uma_pref) { |
1552 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1554 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1553 DCHECK(success); | 1555 DCHECK(success); |
1554 } | 1556 } |
1555 } | 1557 } |
1556 return result; | 1558 return result; |
1557 } | 1559 } |
OLD | NEW |