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

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

Issue 1407203002: Removing un-necessary conversion from std::string to base::string16. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/plugin_metrics_provider.cc
diff --git a/chrome/browser/metrics/plugin_metrics_provider.cc b/chrome/browser/metrics/plugin_metrics_provider.cc
index acc5fa2de5c4ee86d252bded3f7764afbccfc910..4d8f18359894886e29a5d9f29d84ff52763bf2e5 100644
--- a/chrome/browser/metrics/plugin_metrics_provider.cc
+++ b/chrome/browser/metrics/plugin_metrics_provider.cc
@@ -217,21 +217,19 @@ void PluginMetricsProvider::RecordCurrentState() {
base::DictionaryValue* plugin_dict =
static_cast<base::DictionaryValue*>(*value_iter);
- std::string plugin_name;
+ base::string16 plugin_name;
plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name);
if (plugin_name.empty()) {
NOTREACHED();
continue;
}
- // TODO(viettrungluu): remove conversions
- base::string16 name16 = base::UTF8ToUTF16(plugin_name);
- if (child_process_stats_buffer_.find(name16) ==
+ if (child_process_stats_buffer_.find(plugin_name) ==
child_process_stats_buffer_.end()) {
continue;
}
- ChildProcessStats stats = child_process_stats_buffer_[name16];
+ ChildProcessStats stats = child_process_stats_buffer_[plugin_name];
if (stats.process_launches) {
int launches = 0;
plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches);
@@ -259,13 +257,12 @@ void PluginMetricsProvider::RecordCurrentState() {
loading_errors);
}
- child_process_stats_buffer_.erase(name16);
+ child_process_stats_buffer_.erase(plugin_name);
}
// Now go through and add dictionaries for plugins that didn't already have
// reports in Local State.
- for (std::map<base::string16, ChildProcessStats>::iterator cache_iter =
- child_process_stats_buffer_.begin();
+ for (auto cache_iter = child_process_stats_buffer_.begin();
cache_iter != child_process_stats_buffer_.end(); ++cache_iter) {
ChildProcessStats stats = cache_iter->second;
@@ -273,12 +270,9 @@ void PluginMetricsProvider::RecordCurrentState() {
if (!IsPluginProcess(stats.process_type))
continue;
- // TODO(viettrungluu): remove conversion
- std::string plugin_name = base::UTF16ToUTF8(cache_iter->first);
-
base::DictionaryValue* plugin_dict = new base::DictionaryValue;
- plugin_dict->SetString(prefs::kStabilityPluginName, plugin_name);
+ plugin_dict->SetString(prefs::kStabilityPluginName, cache_iter->first);
plugin_dict->SetInteger(prefs::kStabilityPluginLaunches,
stats.process_launches);
plugin_dict->SetInteger(prefs::kStabilityPluginCrashes,
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698