diff options
author | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 03:02:51 +0000 |
---|---|---|
committer | viettrungluu@chromium.org <viettrungluu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-11 03:02:51 +0000 |
commit | 57ecc4bf4069cb869e5fb0a7d922eec2384bac25 (patch) | |
tree | 1b4668fa59d6b6a072144b4ddab8d5f6faba3fa4 /chrome/browser/metrics | |
parent | 1af19cfd7b1ef9924516dbe811db495315feaefe (diff) | |
download | chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.zip chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.tar.gz chromium_src-57ecc4bf4069cb869e5fb0a7d922eec2384bac25.tar.bz2 |
Make prefs use std::string for keys rather than wstrings.
Much remains to be converted.
BUG=23581
TEST=builds and passes tests
Review URL: http://codereview.chromium.org/3076037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r-- | chrome/browser/metrics/metrics_log.cc | 6 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 23 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.h | 10 |
3 files changed, 21 insertions, 18 deletions
diff --git a/chrome/browser/metrics/metrics_log.cc b/chrome/browser/metrics/metrics_log.cc index fb7f8a2..4b0db68 100644 --- a/chrome/browser/metrics/metrics_log.cc +++ b/chrome/browser/metrics/metrics_log.cc @@ -158,13 +158,13 @@ void MetricsLog::WritePluginStabilityElements(PrefService* pref) { } DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*iter); - std::wstring plugin_name; + std::string 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(WideToUTF8(plugin_name))); + WriteAttribute("filename", CreateBase64Hash(plugin_name)); int launches = 0; plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches); @@ -352,7 +352,7 @@ void MetricsLog::RecordEnvironment( void MetricsLog::WriteAllProfilesMetrics( const DictionaryValue& all_profiles_metrics) { - const std::string profile_prefix(WideToUTF8(prefs::kProfilePrefix)); + const std::string profile_prefix(prefs::kProfilePrefix); for (DictionaryValue::key_iterator i = all_profiles_metrics.begin_keys(); i != all_profiles_metrics.end_keys(); ++i) { const std::string& key_name = *i; diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 1dcc6df..df65772 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -1716,14 +1716,14 @@ void MetricsService::LogLoadComplete(NotificationType type, load_details->load_time()); } -void MetricsService::IncrementPrefValue(const wchar_t* path) { +void MetricsService::IncrementPrefValue(const char* path) { PrefService* pref = g_browser_process->local_state(); DCHECK(pref); int value = pref->GetInteger(path); pref->SetInteger(path, value + 1); } -void MetricsService::IncrementLongPrefsValue(const wchar_t* path) { +void MetricsService::IncrementLongPrefsValue(const char* path) { PrefService* pref = g_browser_process->local_state(); DCHECK(pref); int64 value = pref->GetInt64(path); @@ -1800,8 +1800,8 @@ static void CountBookmarks(const BookmarkNode* node, } void MetricsService::LogBookmarks(const BookmarkNode* node, - const wchar_t* num_bookmarks_key, - const wchar_t* num_folders_key) { + const char* num_bookmarks_key, + const char* num_folders_key) { DCHECK(node); int num_bookmarks = 0; int num_folders = 0; @@ -1847,18 +1847,20 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { } DictionaryValue* plugin_dict = static_cast<DictionaryValue*>(*value_iter); - std::wstring plugin_name; + std::string plugin_name; plugin_dict->GetString(prefs::kStabilityPluginName, &plugin_name); if (plugin_name.empty()) { NOTREACHED(); continue; } - if (child_process_stats_buffer_.find(plugin_name) == + // TODO(viettrungluu): remove conversions + if (child_process_stats_buffer_.find(UTF8ToWide(plugin_name)) == child_process_stats_buffer_.end()) continue; - ChildProcessStats stats = child_process_stats_buffer_[plugin_name]; + ChildProcessStats stats = + child_process_stats_buffer_[UTF8ToWide(plugin_name)]; if (stats.process_launches) { int launches = 0; plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches); @@ -1878,7 +1880,7 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { plugin_dict->SetInteger(prefs::kStabilityPluginInstances, instances); } - child_process_stats_buffer_.erase(plugin_name); + child_process_stats_buffer_.erase(UTF8ToWide(plugin_name)); } // Now go through and add dictionaries for plugins that didn't already have @@ -1892,7 +1894,8 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { if (ChildProcessInfo::PLUGIN_PROCESS != stats.process_type) continue; - std::wstring plugin_name = cache_iter->first; + // TODO(viettrungluu): remove conversion + std::string plugin_name = WideToUTF8(cache_iter->first); DictionaryValue* plugin_dict = new DictionaryValue; @@ -1917,7 +1920,7 @@ bool MetricsService::CanLogNotification(NotificationType type, return !BrowserList::IsOffTheRecordSessionActive(); } -void MetricsService::RecordBooleanPrefValue(const wchar_t* path, bool value) { +void MetricsService::RecordBooleanPrefValue(const char* path, bool value) { DCHECK(IsSingleThreaded()); PrefService* pref = g_browser_process->local_state(); diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index 65f2af9..db402a5 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -334,11 +334,11 @@ class MetricsService : public NotificationObserver, const NotificationDetails& details); // Reads, increments and then sets the specified integer preference. - void IncrementPrefValue(const wchar_t* path); + void IncrementPrefValue(const char* path); // Reads, increments and then sets the specified long preference that is // stored as a string. - void IncrementLongPrefsValue(const wchar_t* path); + void IncrementLongPrefsValue(const char* path); // Records a renderer process crash. void LogRendererCrash(); @@ -353,8 +353,8 @@ class MetricsService : public NotificationObserver, // in node. The pref key for the number of bookmarks in num_bookmarks_key and // the pref key for number of folders in num_folders_key. void LogBookmarks(const BookmarkNode* node, - const wchar_t* num_bookmarks_key, - const wchar_t* num_folders_key); + const char* num_bookmarks_key, + const char* num_folders_key); // Sets preferences for the number of bookmarks in model. void LogBookmarks(BookmarkModel* model); @@ -392,7 +392,7 @@ class MetricsService : public NotificationObserver, const NotificationDetails& details); // Sets the value of the specified path in prefs and schedules a save. - void RecordBooleanPrefValue(const wchar_t* path, bool value); + void RecordBooleanPrefValue(const char* path, bool value); NotificationRegistrar registrar_; |