| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 522 bool MetricsLog::HasEnvironment() const { | 522 bool MetricsLog::HasEnvironment() const { |
| 523 return uma_proto()->system_profile().has_uma_enabled_date(); | 523 return uma_proto()->system_profile().has_uma_enabled_date(); |
| 524 } | 524 } |
| 525 | 525 |
| 526 bool MetricsLog::HasStabilityMetrics() const { | 526 bool MetricsLog::HasStabilityMetrics() const { |
| 527 return uma_proto()->system_profile().stability().has_launch_count(); | 527 return uma_proto()->system_profile().stability().has_launch_count(); |
| 528 } | 528 } |
| 529 | 529 |
| 530 void MetricsLog::WritePluginStabilityElements(PrefService* pref) { | 530 void MetricsLog::WritePluginStabilityElements(PrefService* pref) { |
| 531 // Now log plugin stability info. | 531 // Now log plugin stability info. |
| 532 const ListValue* plugin_stats_list = pref->GetList( | 532 const base::ListValue* plugin_stats_list = pref->GetList( |
| 533 prefs::kStabilityPluginStats); | 533 prefs::kStabilityPluginStats); |
| 534 if (!plugin_stats_list) | 534 if (!plugin_stats_list) |
| 535 return; | 535 return; |
| 536 | 536 |
| 537 #if defined(ENABLE_PLUGINS) | 537 #if defined(ENABLE_PLUGINS) |
| 538 SystemProfileProto::Stability* stability = | 538 SystemProfileProto::Stability* stability = |
| 539 uma_proto()->mutable_system_profile()->mutable_stability(); | 539 uma_proto()->mutable_system_profile()->mutable_stability(); |
| 540 for (ListValue::const_iterator iter = plugin_stats_list->begin(); | 540 for (base::ListValue::const_iterator iter = plugin_stats_list->begin(); |
| 541 iter != plugin_stats_list->end(); ++iter) { | 541 iter != plugin_stats_list->end(); ++iter) { |
| 542 if (!(*iter)->IsType(Value::TYPE_DICTIONARY)) { | 542 if (!(*iter)->IsType(base::Value::TYPE_DICTIONARY)) { |
| 543 NOTREACHED(); | 543 NOTREACHED(); |
| 544 continue; | 544 continue; |
| 545 } | 545 } |
| 546 DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*iter); | 546 base::DictionaryValue* plugin_dict = |
| 547 static_cast<base::DictionaryValue*>(*iter); |
| 547 | 548 |
| 548 // Note that this search is potentially a quadratic operation, but given the | 549 // Note that this search is potentially a quadratic operation, but given the |
| 549 // low number of plugins installed on a "reasonable" setup, this should be | 550 // low number of plugins installed on a "reasonable" setup, this should be |
| 550 // fine. | 551 // fine. |
| 551 // TODO(isherman): Verify that this does not show up as a hotspot in | 552 // TODO(isherman): Verify that this does not show up as a hotspot in |
| 552 // profiler runs. | 553 // profiler runs. |
| 553 const SystemProfileProto::Plugin* system_profile_plugin = NULL; | 554 const SystemProfileProto::Plugin* system_profile_plugin = NULL; |
| 554 std::string plugin_name; | 555 std::string plugin_name; |
| 555 plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name); | 556 plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name); |
| 556 const SystemProfileProto& system_profile = uma_proto()->system_profile(); | 557 const SystemProfileProto& system_profile = uma_proto()->system_profile(); |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 | 1005 |
| 1005 // We invalidate the user count if it changed while the log was open. | 1006 // We invalidate the user count if it changed while the log was open. |
| 1006 if (system_profile->has_multi_profile_user_count() && | 1007 if (system_profile->has_multi_profile_user_count() && |
| 1007 user_count != system_profile->multi_profile_user_count()) | 1008 user_count != system_profile->multi_profile_user_count()) |
| 1008 user_count = 0; | 1009 user_count = 0; |
| 1009 | 1010 |
| 1010 system_profile->set_multi_profile_user_count(user_count); | 1011 system_profile->set_multi_profile_user_count(user_count); |
| 1011 } | 1012 } |
| 1012 } | 1013 } |
| 1013 #endif | 1014 #endif |
| OLD | NEW |