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 is | 10 // A MetricsService instance is typically created at application startup. It is |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 #include "chrome/common/render_messages.h" | 201 #include "chrome/common/render_messages.h" |
202 #include "content/public/browser/child_process_data.h" | 202 #include "content/public/browser/child_process_data.h" |
203 #include "content/public/browser/histogram_fetcher.h" | 203 #include "content/public/browser/histogram_fetcher.h" |
204 #include "content/public/browser/load_notification_details.h" | 204 #include "content/public/browser/load_notification_details.h" |
205 #include "content/public/browser/notification_service.h" | 205 #include "content/public/browser/notification_service.h" |
206 #include "content/public/browser/plugin_service.h" | 206 #include "content/public/browser/plugin_service.h" |
207 #include "content/public/browser/render_process_host.h" | 207 #include "content/public/browser/render_process_host.h" |
208 #include "content/public/browser/user_metrics.h" | 208 #include "content/public/browser/user_metrics.h" |
209 #include "content/public/browser/web_contents.h" | 209 #include "content/public/browser/web_contents.h" |
210 #include "content/public/common/process_type.h" | 210 #include "content/public/common/process_type.h" |
| 211 #include "content/public/common/webplugininfo.h" |
211 #include "net/base/load_flags.h" | 212 #include "net/base/load_flags.h" |
212 #include "net/url_request/url_fetcher.h" | 213 #include "net/url_request/url_fetcher.h" |
213 #include "webkit/plugins/webplugininfo.h" | |
214 | 214 |
215 // TODO(port): port browser_distribution.h. | 215 // TODO(port): port browser_distribution.h. |
216 #if !defined(OS_POSIX) | 216 #if !defined(OS_POSIX) |
217 #include "chrome/installer/util/browser_distribution.h" | 217 #include "chrome/installer/util/browser_distribution.h" |
218 #endif | 218 #endif |
219 | 219 |
220 #if defined(OS_CHROMEOS) | 220 #if defined(OS_CHROMEOS) |
221 #include "chrome/browser/chromeos/external_metrics.h" | 221 #include "chrome/browser/chromeos/external_metrics.h" |
222 #include "chrome/browser/chromeos/system/statistics_provider.h" | 222 #include "chrome/browser/chromeos/system/statistics_provider.h" |
223 #endif | 223 #endif |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 const std::string& hardware_class) { | 902 const std::string& hardware_class) { |
903 DCHECK_EQ(INIT_TASK_SCHEDULED, state_); | 903 DCHECK_EQ(INIT_TASK_SCHEDULED, state_); |
904 hardware_class_ = hardware_class; | 904 hardware_class_ = hardware_class; |
905 | 905 |
906 #if defined(ENABLE_PLUGINS) | 906 #if defined(ENABLE_PLUGINS) |
907 // Start the next part of the init task: loading plugin information. | 907 // Start the next part of the init task: loading plugin information. |
908 PluginService::GetInstance()->GetPlugins( | 908 PluginService::GetInstance()->GetPlugins( |
909 base::Bind(&MetricsService::OnInitTaskGotPluginInfo, | 909 base::Bind(&MetricsService::OnInitTaskGotPluginInfo, |
910 self_ptr_factory_.GetWeakPtr())); | 910 self_ptr_factory_.GetWeakPtr())); |
911 #else | 911 #else |
912 std::vector<webkit::WebPluginInfo> plugin_list_empty; | 912 std::vector<content::WebPluginInfo> plugin_list_empty; |
913 OnInitTaskGotPluginInfo(plugin_list_empty); | 913 OnInitTaskGotPluginInfo(plugin_list_empty); |
914 #endif // defined(ENABLE_PLUGINS) | 914 #endif // defined(ENABLE_PLUGINS) |
915 } | 915 } |
916 | 916 |
917 void MetricsService::OnInitTaskGotPluginInfo( | 917 void MetricsService::OnInitTaskGotPluginInfo( |
918 const std::vector<webkit::WebPluginInfo>& plugins) { | 918 const std::vector<content::WebPluginInfo>& plugins) { |
919 DCHECK_EQ(INIT_TASK_SCHEDULED, state_); | 919 DCHECK_EQ(INIT_TASK_SCHEDULED, state_); |
920 plugins_ = plugins; | 920 plugins_ = plugins; |
921 | 921 |
922 // Schedules a task on a blocking pool thread to gather Google Update | 922 // Schedules a task on a blocking pool thread to gather Google Update |
923 // statistics (requires Registry reads). | 923 // statistics (requires Registry reads). |
924 BrowserThread::PostBlockingPoolTask( | 924 BrowserThread::PostBlockingPoolTask( |
925 FROM_HERE, | 925 FROM_HERE, |
926 base::Bind(&MetricsService::InitTaskGetGoogleUpdateData, | 926 base::Bind(&MetricsService::InitTaskGetGoogleUpdateData, |
927 self_ptr_factory_.GetWeakPtr(), | 927 self_ptr_factory_.GetWeakPtr(), |
928 base::MessageLoop::current()->message_loop_proxy())); | 928 base::MessageLoop::current()->message_loop_proxy())); |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1588 IncrementPrefValue(prefs::kStabilitySystemUncleanShutdownCount); | 1588 IncrementPrefValue(prefs::kStabilitySystemUncleanShutdownCount); |
1589 else | 1589 else |
1590 NOTREACHED() << "Unexpected Chrome OS crash type " << crash_type; | 1590 NOTREACHED() << "Unexpected Chrome OS crash type " << crash_type; |
1591 // Wake up metrics logs sending if necessary now that new | 1591 // Wake up metrics logs sending if necessary now that new |
1592 // log data is available. | 1592 // log data is available. |
1593 HandleIdleSinceLastTransmission(false); | 1593 HandleIdleSinceLastTransmission(false); |
1594 } | 1594 } |
1595 #endif // OS_CHROMEOS | 1595 #endif // OS_CHROMEOS |
1596 | 1596 |
1597 void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) { | 1597 void MetricsService::LogPluginLoadingError(const base::FilePath& plugin_path) { |
1598 webkit::WebPluginInfo plugin; | 1598 content::WebPluginInfo plugin; |
1599 bool success = | 1599 bool success = |
1600 content::PluginService::GetInstance()->GetPluginInfoByPath(plugin_path, | 1600 content::PluginService::GetInstance()->GetPluginInfoByPath(plugin_path, |
1601 &plugin); | 1601 &plugin); |
1602 DCHECK(success); | 1602 DCHECK(success); |
1603 ChildProcessStats& stats = child_process_stats_buffer_[plugin.name]; | 1603 ChildProcessStats& stats = child_process_stats_buffer_[plugin.name]; |
1604 // Initialize the type if this entry is new. | 1604 // Initialize the type if this entry is new. |
1605 if (stats.process_type == content::PROCESS_TYPE_UNKNOWN) { | 1605 if (stats.process_type == content::PROCESS_TYPE_UNKNOWN) { |
1606 // The plug-in process might not actually of type PLUGIN (which means | 1606 // The plug-in process might not actually of type PLUGIN (which means |
1607 // NPAPI), but we only care that it is *a* plug-in process. | 1607 // NPAPI), but we only care that it is *a* plug-in process. |
1608 stats.process_type = content::PROCESS_TYPE_PLUGIN; | 1608 stats.process_type = content::PROCESS_TYPE_PLUGIN; |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1754 if (local_state) { | 1754 if (local_state) { |
1755 const PrefService::Preference* uma_pref = | 1755 const PrefService::Preference* uma_pref = |
1756 local_state->FindPreference(prefs::kMetricsReportingEnabled); | 1756 local_state->FindPreference(prefs::kMetricsReportingEnabled); |
1757 if (uma_pref) { | 1757 if (uma_pref) { |
1758 bool success = uma_pref->GetValue()->GetAsBoolean(&result); | 1758 bool success = uma_pref->GetValue()->GetAsBoolean(&result); |
1759 DCHECK(success); | 1759 DCHECK(success); |
1760 } | 1760 } |
1761 } | 1761 } |
1762 return result; | 1762 return result; |
1763 } | 1763 } |
OLD | NEW |