summaryrefslogtreecommitdiffstats
path: root/chrome/browser/metrics
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r--chrome/browser/metrics/metrics_log.cc25
-rw-r--r--chrome/browser/metrics/metrics_service.cc37
2 files changed, 26 insertions, 36 deletions
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc
index 57da551..a504b11 100644
--- a/chrome/browser/metrics/metrics_log.cc
+++ b/chrome/browser/metrics/metrics_log.cc
@@ -383,24 +383,24 @@ void MetricsLog::WritePluginStabilityElements(PrefService* pref) {
}
DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*iter);
- string16 plugin_name;
- plugin_dict->GetString(WideToUTF16Hack(prefs::kStabilityPluginName), &plugin_name);
+ std::wstring plugin_name;
+ plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name);
OPEN_ELEMENT_FOR_SCOPE("pluginstability");
// Use "filename" instead of "name", otherwise we need to update the
// UMA servers.
- WriteAttribute("filename", CreateBase64Hash(UTF16ToUTF8(plugin_name)));
+ WriteAttribute("filename", CreateBase64Hash(WideToUTF8(plugin_name)));
int launches = 0;
- plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginLaunches), &launches);
+ plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches);
WriteIntAttribute("launchcount", launches);
int instances = 0;
- plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginInstances), &instances);
+ plugin_dict->GetInteger(prefs::kStabilityPluginInstances, &instances);
WriteIntAttribute("instancecount", instances);
int crashes = 0;
- plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginCrashes), &crashes);
+ plugin_dict->GetInteger(prefs::kStabilityPluginCrashes, &crashes);
WriteIntAttribute("crashcount", crashes);
}
@@ -568,11 +568,10 @@ void MetricsLog::WriteAllProfilesMetrics(
const std::wstring profile_prefix(prefs::kProfilePrefix);
for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys();
i != all_profiles_metrics.end_keys(); ++i) {
- const string16 key_name16 = *i;
- const std::wstring& key_name = UTF16ToWideHack(key_name16);
+ const std::wstring& key_name = *i;
if (key_name.compare(0, profile_prefix.size(), profile_prefix) == 0) {
DictionaryValue* profile;
- if (all_profiles_metrics.GetDictionary(key_name16, &profile))
+ if (all_profiles_metrics.GetDictionary(key_name, &profile))
WriteProfileMetrics(key_name.substr(profile_prefix.size()), *profile);
}
}
@@ -586,13 +585,13 @@ void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash,
i != profile_metrics.end_keys(); ++i) {
Value* value;
if (profile_metrics.Get(*i, &value)) {
- DCHECK(*i != LIT16("id"));
+ DCHECK(*i != L"id");
switch (value->GetType()) {
case Value::TYPE_STRING: {
std::string string_value;
if (value->GetAsString(&string_value)) {
OPEN_ELEMENT_FOR_SCOPE("profileparam");
- WriteAttribute("name", UTF16ToUTF8(*i));
+ WriteAttribute("name", WideToUTF8(*i));
WriteAttribute("value", string_value);
}
break;
@@ -602,7 +601,7 @@ void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash,
bool bool_value;
if (value->GetAsBoolean(&bool_value)) {
OPEN_ELEMENT_FOR_SCOPE("profileparam");
- WriteAttribute("name", UTF16ToUTF8(*i));
+ WriteAttribute("name", WideToUTF8(*i));
WriteIntAttribute("value", bool_value ? 1 : 0);
}
break;
@@ -612,7 +611,7 @@ void MetricsLog::WriteProfileMetrics(const std::wstring& profileidhash,
int int_value;
if (value->GetAsInteger(&int_value)) {
OPEN_ELEMENT_FOR_SCOPE("profileparam");
- WriteAttribute("name", UTF16ToUTF8(*i));
+ WriteAttribute("name", WideToUTF8(*i));
WriteIntAttribute("value", int_value);
}
break;
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index db92b9c..e081bd9 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -1675,15 +1675,13 @@ void MetricsService::RecordPluginChanges(PrefService* pref) {
}
DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*value_iter);
- string16 plugin_name16;
- plugin_dict->GetString(WideToUTF16Hack(prefs::kStabilityPluginName),
- &plugin_name16);
- if (plugin_name16.empty()) {
+ std::wstring plugin_name;
+ plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name);
+ if (plugin_name.empty()) {
NOTREACHED();
continue;
}
- std::wstring plugin_name = UTF16ToWideHack(plugin_name16);
if (child_process_stats_buffer_.find(plugin_name) ==
child_process_stats_buffer_.end())
continue;
@@ -1691,27 +1689,21 @@ void MetricsService::RecordPluginChanges(PrefService* pref) {
ChildProcessStats stats = child_process_stats_buffer_[plugin_name];
if (stats.process_launches) {
int launches = 0;
- plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginLaunches),
- &launches);
+ plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches);
launches += stats.process_launches;
- plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginLaunches),
- launches);
+ plugin_dict->SetInteger(prefs::kStabilityPluginLaunches, launches);
}
if (stats.process_crashes) {
int crashes = 0;
- plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginCrashes),
- &crashes);
+ plugin_dict->GetInteger(prefs::kStabilityPluginCrashes, &crashes);
crashes += stats.process_crashes;
- plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginCrashes),
- crashes);
+ plugin_dict->SetInteger(prefs::kStabilityPluginCrashes, crashes);
}
if (stats.instances) {
int instances = 0;
- plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginInstances),
- &instances);
+ plugin_dict->GetInteger(prefs::kStabilityPluginInstances, &instances);
instances += stats.instances;
- plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginInstances),
- instances);
+ plugin_dict->SetInteger(prefs::kStabilityPluginInstances, instances);
}
child_process_stats_buffer_.erase(plugin_name);
@@ -1726,13 +1718,12 @@ void MetricsService::RecordPluginChanges(PrefService* pref) {
ChildProcessStats stats = cache_iter->second;
DictionaryValue* plugin_dict = new DictionaryValue;
- plugin_dict->SetString(WideToUTF16Hack(prefs::kStabilityPluginName),
- WideToUTF16Hack(plugin_name));
- plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginLaunches),
+ plugin_dict->SetString(prefs::kStabilityPluginName, plugin_name);
+ plugin_dict->SetInteger(prefs::kStabilityPluginLaunches,
stats.process_launches);
- plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginCrashes),
+ plugin_dict->SetInteger(prefs::kStabilityPluginCrashes,
stats.process_crashes);
- plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginInstances),
+ plugin_dict->SetInteger(prefs::kStabilityPluginInstances,
stats.instances);
plugins->Append(plugin_dict);
}
@@ -1844,7 +1835,7 @@ void MetricsService::AddProfileMetric(Profile* profile,
DCHECK(prof_prefs);
const std::wstring pref_key = std::wstring(prefs::kProfilePrefix) + id_hash +
L"." + key;
- prof_prefs->SetInteger(WideToUTF16Hack(pref_key), value);
+ prof_prefs->SetInteger(pref_key.c_str(), value);
}
static bool IsSingleThreaded() {