diff options
author | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-03 21:49:53 +0000 |
---|---|---|
committer | dsh@google.com <dsh@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-03 21:49:53 +0000 |
commit | 3a79b3cc8393d54d72c8c7e14615fe64d86fd039 (patch) | |
tree | 2730ef27672c8f9c9e1b6ef3f443434ac98bfd4f /chrome/browser/metrics/metrics_service.cc | |
parent | 1c9e90e17741f9c34f4cbe7f3e68a8300ed24e08 (diff) | |
download | chromium_src-3a79b3cc8393d54d72c8c7e14615fe64d86fd039.zip chromium_src-3a79b3cc8393d54d72c8c7e14615fe64d86fd039.tar.gz chromium_src-3a79b3cc8393d54d72c8c7e14615fe64d86fd039.tar.bz2 |
Port DictionaryValue to use string16 instead of wstring.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=10818
Review URL: http://codereview.chromium.org/31014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10833 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics/metrics_service.cc')
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index e081bd9..8c12373 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -1675,38 +1675,46 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { } DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*value_iter); - std::wstring plugin_name; - plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name); + string16 plugin_name; + plugin_dict->GetString(WideToUTF16Hack(prefs::kStabilityPluginName), + &plugin_name); if (plugin_name.empty()) { NOTREACHED(); continue; } - if (child_process_stats_buffer_.find(plugin_name) == + if (child_process_stats_buffer_.find(UTF16ToWideHack(plugin_name)) == child_process_stats_buffer_.end()) continue; - ChildProcessStats stats = child_process_stats_buffer_[plugin_name]; + ChildProcessStats stats = + child_process_stats_buffer_[UTF16ToWideHack(plugin_name)]; if (stats.process_launches) { int launches = 0; - plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches); + plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginLaunches), + &launches); launches += stats.process_launches; - plugin_dict->SetInteger(prefs::kStabilityPluginLaunches, launches); + plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginLaunches), + launches); } if (stats.process_crashes) { int crashes = 0; - plugin_dict->GetInteger(prefs::kStabilityPluginCrashes, &crashes); + plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginCrashes), + &crashes); crashes += stats.process_crashes; - plugin_dict->SetInteger(prefs::kStabilityPluginCrashes, crashes); + plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginCrashes), + crashes); } if (stats.instances) { int instances = 0; - plugin_dict->GetInteger(prefs::kStabilityPluginInstances, &instances); + plugin_dict->GetInteger(WideToUTF16Hack(prefs::kStabilityPluginInstances), + &instances); instances += stats.instances; - plugin_dict->SetInteger(prefs::kStabilityPluginInstances, instances); + plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginInstances), + instances); } - child_process_stats_buffer_.erase(plugin_name); + child_process_stats_buffer_.erase(UTF16ToWideHack(plugin_name)); } // Now go through and add dictionaries for plugins that didn't already have @@ -1718,12 +1726,13 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { ChildProcessStats stats = cache_iter->second; DictionaryValue* plugin_dict = new DictionaryValue; - plugin_dict->SetString(prefs::kStabilityPluginName, plugin_name); - plugin_dict->SetInteger(prefs::kStabilityPluginLaunches, + plugin_dict->SetString(WideToUTF16Hack(prefs::kStabilityPluginName), + WideToUTF16Hack(plugin_name)); + plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginLaunches), stats.process_launches); - plugin_dict->SetInteger(prefs::kStabilityPluginCrashes, + plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginCrashes), stats.process_crashes); - plugin_dict->SetInteger(prefs::kStabilityPluginInstances, + plugin_dict->SetInteger(WideToUTF16Hack(prefs::kStabilityPluginInstances), stats.instances); plugins->Append(plugin_dict); } @@ -1835,7 +1844,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(pref_key.c_str(), value); + prof_prefs->SetInteger(WideToUTF16Hack(pref_key), value); } static bool IsSingleThreaded() { |