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 #include "chrome/browser/metrics/metrics_log.h" | 5 #include "chrome/browser/metrics/metrics_log.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 | 333 |
334 OPEN_ELEMENT_FOR_SCOPE("profile"); | 334 OPEN_ELEMENT_FOR_SCOPE("profile"); |
335 WriteCommonEventAttributes(); | 335 WriteCommonEventAttributes(); |
336 | 336 |
337 WriteInstallElement(); | 337 WriteInstallElement(); |
338 | 338 |
339 { | 339 { |
340 OPEN_ELEMENT_FOR_SCOPE("stability"); // Minimal set of stability elements. | 340 OPEN_ELEMENT_FOR_SCOPE("stability"); // Minimal set of stability elements. |
341 WriteRequiredStabilityAttributes(pref); | 341 WriteRequiredStabilityAttributes(pref); |
342 WriteRealtimeStabilityAttributes(pref); | 342 WriteRealtimeStabilityAttributes(pref); |
343 | 343 #if defined(ENABLE_PLUGINS) |
344 WritePluginStabilityElements(plugin_list, pref); | 344 WritePluginStabilityElements(plugin_list, pref); |
345 #endif | |
345 } | 346 } |
346 } | 347 } |
347 | 348 |
348 PrefService* MetricsLog::GetPrefService() { | 349 PrefService* MetricsLog::GetPrefService() { |
349 return g_browser_process->local_state(); | 350 return g_browser_process->local_state(); |
350 } | 351 } |
351 | 352 |
352 gfx::Size MetricsLog::GetScreenSize() const { | 353 gfx::Size MetricsLog::GetScreenSize() const { |
353 return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().GetSizeInPixel(); | 354 return gfx::Screen::GetNativeScreen()->GetPrimaryDisplay().GetSizeInPixel(); |
354 } | 355 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
413 SystemProfileProto::Stability* stability = | 414 SystemProfileProto::Stability* stability = |
414 uma_proto()->mutable_system_profile()->mutable_stability(); | 415 uma_proto()->mutable_system_profile()->mutable_stability(); |
415 stability->set_incomplete_shutdown_count(incomplete_shutdown_count); | 416 stability->set_incomplete_shutdown_count(incomplete_shutdown_count); |
416 stability->set_breakpad_registration_success_count( | 417 stability->set_breakpad_registration_success_count( |
417 breakpad_registration_success_count); | 418 breakpad_registration_success_count); |
418 stability->set_breakpad_registration_failure_count( | 419 stability->set_breakpad_registration_failure_count( |
419 breakpad_registration_failure_count); | 420 breakpad_registration_failure_count); |
420 stability->set_debugger_present_count(debugger_present_count); | 421 stability->set_debugger_present_count(debugger_present_count); |
421 stability->set_debugger_not_present_count(debugger_not_present_count); | 422 stability->set_debugger_not_present_count(debugger_not_present_count); |
422 | 423 |
424 #if defined(ENABLE_PLUGINS) | |
423 WritePluginStabilityElements(plugin_list, pref); | 425 WritePluginStabilityElements(plugin_list, pref); |
426 #endif | |
424 } | 427 } |
425 | 428 |
426 void MetricsLog::WritePluginStabilityElements( | 429 void MetricsLog::WritePluginStabilityElements( |
427 const std::vector<webkit::WebPluginInfo>& plugin_list, | 430 const std::vector<webkit::WebPluginInfo>& plugin_list, |
428 PrefService* pref) { | 431 PrefService* pref) { |
429 // Now log plugin stability info. | 432 // Now log plugin stability info. |
430 const ListValue* plugin_stats_list = pref->GetList( | 433 const ListValue* plugin_stats_list = pref->GetList( |
431 prefs::kStabilityPluginStats); | 434 prefs::kStabilityPluginStats); |
432 if (!plugin_stats_list) | 435 if (!plugin_stats_list) |
433 return; | 436 return; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 const DictionaryValue* profile_metrics) { | 657 const DictionaryValue* profile_metrics) { |
655 DCHECK(!locked()); | 658 DCHECK(!locked()); |
656 | 659 |
657 PrefService* pref = GetPrefService(); | 660 PrefService* pref = GetPrefService(); |
658 | 661 |
659 OPEN_ELEMENT_FOR_SCOPE("profile"); | 662 OPEN_ELEMENT_FOR_SCOPE("profile"); |
660 WriteCommonEventAttributes(); | 663 WriteCommonEventAttributes(); |
661 | 664 |
662 WriteInstallElement(); | 665 WriteInstallElement(); |
663 | 666 |
667 #if defined(ENABLE_PLUGINS) | |
664 // Write the XML version. | 668 // Write the XML version. |
665 // We'll write the protobuf version in RecordEnvironmentProto(). | 669 // We'll write the protobuf version in RecordEnvironmentProto(). |
666 bool write_as_xml = true; | 670 bool write_as_xml = true; |
667 WritePluginList(plugin_list, write_as_xml); | 671 WritePluginList(plugin_list, write_as_xml); |
Ilya Sherman
2012/12/19 22:45:57
I'm not sure that it's safe to skip writing the pl
nilesh
2012/12/19 23:18:29
Done.
However, there is a codepath which allows f
Ilya Sherman
2012/12/19 23:45:45
Yeah, I'm not sure how paranoid to be; but since I
| |
672 #endif | |
668 | 673 |
669 WriteStabilityElement(plugin_list, pref); | 674 WriteStabilityElement(plugin_list, pref); |
670 | 675 |
671 { | 676 { |
672 // Write the XML version. | 677 // Write the XML version. |
673 // We'll write the protobuf version in RecordEnvironmentProto(). | 678 // We'll write the protobuf version in RecordEnvironmentProto(). |
674 OPEN_ELEMENT_FOR_SCOPE("cpu"); | 679 OPEN_ELEMENT_FOR_SCOPE("cpu"); |
675 WriteAttribute("arch", base::SysInfo::OperatingSystemArchitecture()); | 680 WriteAttribute("arch", base::SysInfo::OperatingSystemArchitecture()); |
676 } | 681 } |
677 | 682 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
805 gpu_performance->set_overall_score(gpu_info.performance_stats.overall); | 810 gpu_performance->set_overall_score(gpu_info.performance_stats.overall); |
806 | 811 |
807 const gfx::Size display_size = GetScreenSize(); | 812 const gfx::Size display_size = GetScreenSize(); |
808 hardware->set_primary_screen_width(display_size.width()); | 813 hardware->set_primary_screen_width(display_size.width()); |
809 hardware->set_primary_screen_height(display_size.height()); | 814 hardware->set_primary_screen_height(display_size.height()); |
810 hardware->set_primary_screen_scale_factor(GetScreenDeviceScaleFactor()); | 815 hardware->set_primary_screen_scale_factor(GetScreenDeviceScaleFactor()); |
811 hardware->set_screen_count(GetScreenCount()); | 816 hardware->set_screen_count(GetScreenCount()); |
812 | 817 |
813 WriteGoogleUpdateProto(google_update_metrics); | 818 WriteGoogleUpdateProto(google_update_metrics); |
814 | 819 |
820 #if defined(ENABLE_PLUGINS) | |
815 bool write_as_xml = false; | 821 bool write_as_xml = false; |
816 WritePluginList(plugin_list, write_as_xml); | 822 WritePluginList(plugin_list, write_as_xml); |
823 #endif | |
817 | 824 |
818 std::vector<ActiveGroupId> field_trial_ids; | 825 std::vector<ActiveGroupId> field_trial_ids; |
819 GetFieldTrialIds(&field_trial_ids); | 826 GetFieldTrialIds(&field_trial_ids); |
820 WriteFieldTrials(field_trial_ids, system_profile); | 827 WriteFieldTrials(field_trial_ids, system_profile); |
821 } | 828 } |
822 | 829 |
823 void MetricsLog::RecordProfilerData( | 830 void MetricsLog::RecordProfilerData( |
824 const tracked_objects::ProcessDataSnapshot& process_data, | 831 const tracked_objects::ProcessDataSnapshot& process_data, |
825 content::ProcessType process_type) { | 832 content::ProcessType process_type) { |
826 DCHECK(!locked()); | 833 DCHECK(!locked()); |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1025 ProductDataToProto(google_update_metrics.google_update_data, | 1032 ProductDataToProto(google_update_metrics.google_update_data, |
1026 google_update->mutable_google_update_status()); | 1033 google_update->mutable_google_update_status()); |
1027 } | 1034 } |
1028 | 1035 |
1029 if (!google_update_metrics.product_data.version.empty()) { | 1036 if (!google_update_metrics.product_data.version.empty()) { |
1030 ProductDataToProto(google_update_metrics.product_data, | 1037 ProductDataToProto(google_update_metrics.product_data, |
1031 google_update->mutable_client_status()); | 1038 google_update->mutable_client_status()); |
1032 } | 1039 } |
1033 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) | 1040 #endif // defined(GOOGLE_CHROME_BUILD) && defined(OS_WIN) |
1034 } | 1041 } |
OLD | NEW |