Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1644)

Unified Diff: chrome/browser/metrics/metrics_service.cc

Issue 31014: Port DictionaryValue to use string16 instead of wstring. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/metrics/metrics_log.cc ('k') | chrome/browser/page_state.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/metrics_service.cc
===================================================================
--- chrome/browser/metrics/metrics_service.cc (revision 10828)
+++ chrome/browser/metrics/metrics_service.cc (working copy)
@@ -1675,38 +1675,46 @@
}
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 @@
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 @@
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() {
« no previous file with comments | « chrome/browser/metrics/metrics_log.cc ('k') | chrome/browser/page_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698