diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-05 23:08:22 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-05 23:08:22 +0000 |
commit | 68b9e72b2edf989ca77ee942250f6eb9d5b8eeeb (patch) | |
tree | d793070580ff78169d5fe301fd2e68adfca56fca | |
parent | 605abf9ab6b8877c1d91500c1d525b0c37e712eb (diff) | |
download | chromium_src-68b9e72b2edf989ca77ee942250f6eb9d5b8eeeb.zip chromium_src-68b9e72b2edf989ca77ee942250f6eb9d5b8eeeb.tar.gz chromium_src-68b9e72b2edf989ca77ee942250f6eb9d5b8eeeb.tar.bz2 |
wstring: remove wstrings from ChildProcessInfo
Convert MetricsServices' child_process_stats_buffer_ while
I'm at it.
Review URL: http://codereview.chromium.org/7583016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@95680 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/automation/testing_automation_provider.cc | 2 | ||||
-rw-r--r-- | chrome/browser/importer/profile_import_process_host.cc | 3 | ||||
-rw-r--r-- | chrome/browser/memory_details.cc | 2 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.cc | 17 | ||||
-rw-r--r-- | chrome/browser/metrics/metrics_service.h | 2 | ||||
-rw-r--r-- | chrome/browser/nacl_host/nacl_process_host.cc | 2 | ||||
-rw-r--r-- | chrome/browser/task_manager/task_manager_resource_providers.cc | 7 | ||||
-rw-r--r-- | chrome/service/service_utility_process_host.cc | 3 | ||||
-rw-r--r-- | content/browser/plugin_process_host.cc | 4 | ||||
-rw-r--r-- | content/browser/ppapi_broker_process_host.cc | 4 | ||||
-rw-r--r-- | content/browser/ppapi_plugin_process_host.cc | 4 | ||||
-rw-r--r-- | content/browser/utility_process_host.cc | 3 | ||||
-rw-r--r-- | content/browser/worker_host/worker_process_host.cc | 2 | ||||
-rw-r--r-- | content/common/child_process_info.h | 12 |
14 files changed, 35 insertions, 32 deletions
diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index 4c3d9a9..274ba4d 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -2631,7 +2631,7 @@ class GetChildProcessHostInfoTask : public Task { } ChildProcessInfo* info = *iter; DictionaryValue* item = new DictionaryValue; - item->SetString("name", WideToUTF16Hack(info->name())); + item->SetString("name", info->name()); item->SetString("type", ChildProcessInfo::GetTypeNameInEnglish(info->type())); item->SetInteger("pid", base::GetProcId(info->handle())); diff --git a/chrome/browser/importer/profile_import_process_host.cc b/chrome/browser/importer/profile_import_process_host.cc index 82c7955..745b5f3 100644 --- a/chrome/browser/importer/profile_import_process_host.cc +++ b/chrome/browser/importer/profile_import_process_host.cc @@ -7,6 +7,7 @@ #include "base/command_line.h" #include "base/message_loop.h" #include "base/string_number_conversions.h" +#include "base/utf_string_conversions.h" #include "base/values.h" #include "chrome/browser/importer/firefox_importer_utils.h" #include "chrome/browser/importer/profile_import_process_client.h" @@ -79,7 +80,7 @@ FilePath ProfileImportProcessHost::GetProfileImportProcessCmd() { } bool ProfileImportProcessHost::StartProcess() { - set_name(L"profile import process"); + set_name(ASCIIToUTF16("profile import process")); if (!CreateChannel()) return false; diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index 60c6b47..85e7bbb 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -97,7 +97,7 @@ void MemoryDetails::CollectChildInfoOnIOThread() { info.type = iter->type(); info.renderer_type = iter->renderer_type(); - info.titles.push_back(WideToUTF16Hack(iter->name())); + info.titles.push_back(iter->name()); child_info.push_back(info); } diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index a1f4c1a..9106afa 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -1503,7 +1503,7 @@ void MetricsService::LogChildProcessChange( const NotificationSource& source, const NotificationDetails& details) { Details<ChildProcessInfo> child_details(details); - const std::wstring& child_name = child_details->name(); + const string16& child_name = child_details->name(); if (child_process_stats_buffer_.find(child_name) == child_process_stats_buffer_.end()) { @@ -1605,12 +1605,13 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { } // TODO(viettrungluu): remove conversions - if (child_process_stats_buffer_.find(UTF8ToWide(plugin_name)) == - child_process_stats_buffer_.end()) + string16 name16 = UTF8ToUTF16(plugin_name); + if (child_process_stats_buffer_.find(name16) == + child_process_stats_buffer_.end()) { continue; + } - ChildProcessStats stats = - child_process_stats_buffer_[UTF8ToWide(plugin_name)]; + ChildProcessStats stats = child_process_stats_buffer_[name16]; if (stats.process_launches) { int launches = 0; plugin_dict->GetInteger(prefs::kStabilityPluginLaunches, &launches); @@ -1630,12 +1631,12 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { plugin_dict->SetInteger(prefs::kStabilityPluginInstances, instances); } - child_process_stats_buffer_.erase(UTF8ToWide(plugin_name)); + child_process_stats_buffer_.erase(name16); } // Now go through and add dictionaries for plugins that didn't already have // reports in Local State. - for (std::map<std::wstring, ChildProcessStats>::iterator cache_iter = + for (std::map<string16, ChildProcessStats>::iterator cache_iter = child_process_stats_buffer_.begin(); cache_iter != child_process_stats_buffer_.end(); ++cache_iter) { ChildProcessStats stats = cache_iter->second; @@ -1645,7 +1646,7 @@ void MetricsService::RecordPluginChanges(PrefService* pref) { continue; // TODO(viettrungluu): remove conversion - std::string plugin_name = WideToUTF8(cache_iter->first); + std::string plugin_name = UTF16ToUTF8(cache_iter->first); DictionaryValue* plugin_dict = new DictionaryValue; diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h index 24e143b..8d38f99 100644 --- a/chrome/browser/metrics/metrics_service.h +++ b/chrome/browser/metrics/metrics_service.h @@ -402,7 +402,7 @@ class MetricsService : public NotificationObserver, // Buffer of child process notifications for quick access. See // ChildProcessStats documentation above for more details. struct ChildProcessStats; - std::map<std::wstring, ChildProcessStats> child_process_stats_buffer_; + std::map<string16, ChildProcessStats> child_process_stats_buffer_; ScopedRunnableMethodFactory<MetricsService> log_sender_factory_; ScopedRunnableMethodFactory<MetricsService> state_saver_factory_; diff --git a/chrome/browser/nacl_host/nacl_process_host.cc b/chrome/browser/nacl_host/nacl_process_host.cc index 5d474a3..2db830d2 100644 --- a/chrome/browser/nacl_host/nacl_process_host.cc +++ b/chrome/browser/nacl_host/nacl_process_host.cc @@ -56,7 +56,7 @@ NaClProcessHost::NaClProcessHost(const std::wstring& url) internal_(new NaClInternal()), running_on_wow64_(false), ALLOW_THIS_IN_INITIALIZER_LIST(callback_factory_(this)) { - set_name(url); + set_name(WideToUTF16Hack(url)); #if defined(OS_WIN) running_on_wow64_ = (base::win::OSInfo::GetInstance()->wow64_status() == base::win::OSInfo::WOW64_ENABLED); diff --git a/chrome/browser/task_manager/task_manager_resource_providers.cc b/chrome/browser/task_manager/task_manager_resource_providers.cc index d95bebd..969add8 100644 --- a/chrome/browser/task_manager/task_manager_resource_providers.cc +++ b/chrome/browser/task_manager/task_manager_resource_providers.cc @@ -772,14 +772,14 @@ void TaskManagerChildProcessResource::SetSupportNetworkUsage() { } string16 TaskManagerChildProcessResource::GetLocalizedTitle() const { - string16 title = WideToUTF16Hack(child_process_.name()); + string16 title = child_process_.name(); if (child_process_.type() == ChildProcessInfo::PLUGIN_PROCESS && title.empty()) { title = l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); } // Explicitly mark name as LTR if there is no strong RTL character, - // to avoid the wrong concatenation result similar to "!Yahoo! Mail: the + // to avoid the wrong concatenation result similar to "!Yahoo Mail: the // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew // or Arabic word for "plugin". base::i18n::AdjustStringForLocaleDirection(&title); @@ -801,8 +801,7 @@ string16 TaskManagerChildProcessResource::GetLocalizedTitle() const { case ChildProcessInfo::PPAPI_PLUGIN_PROCESS: case ChildProcessInfo::PPAPI_BROKER_PROCESS: { return l10n_util::GetStringFUTF16( - IDS_TASK_MANAGER_PLUGIN_PREFIX, title, - WideToUTF16Hack(child_process_.version())); + IDS_TASK_MANAGER_PLUGIN_PREFIX, title, child_process_.version()); } case ChildProcessInfo::NACL_LOADER_PROCESS: diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index f656fd0..dda918a 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -9,6 +9,7 @@ #include "base/message_loop.h" #include "base/message_loop_proxy.h" #include "base/scoped_temp_dir.h" +#include "base/utf_string_conversions.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/chrome_utility_messages.h" #include "ipc/ipc_switches.h" @@ -94,7 +95,7 @@ bool ServiceUtilityProcessHost::StartProcess(bool no_sandbox, const FilePath& exposed_dir) { // Name must be set or metrics_service will crash in any test which // launches a UtilityProcessHost. - set_name(L"utility process"); + set_name(ASCIIToUTF16("utility process")); if (!CreateChannel()) return false; diff --git a/content/browser/plugin_process_host.cc b/content/browser/plugin_process_host.cc index 56fc90e..863133f 100644 --- a/content/browser/plugin_process_host.cc +++ b/content/browser/plugin_process_host.cc @@ -155,8 +155,8 @@ PluginProcessHost::~PluginProcessHost() { bool PluginProcessHost::Init(const webkit::npapi::WebPluginInfo& info, const std::string& locale) { info_ = info; - set_name(UTF16ToWideHack(info_.name)); - set_version(UTF16ToWideHack(info_.version)); + set_name(info_.name); + set_version(info_.version); if (!CreateChannel()) return false; diff --git a/content/browser/ppapi_broker_process_host.cc b/content/browser/ppapi_broker_process_host.cc index b464250..387f943 100644 --- a/content/browser/ppapi_broker_process_host.cc +++ b/content/browser/ppapi_broker_process_host.cc @@ -25,8 +25,8 @@ PpapiBrokerProcessHost::~PpapiBrokerProcessHost() { bool PpapiBrokerProcessHost::Init(const PepperPluginInfo& info) { broker_path_ = info.path; - set_name(UTF8ToWide(info.name)); - set_version(UTF8ToWide(info.version)); + set_name(UTF8ToUTF16(info.name)); + set_version(UTF8ToUTF16(info.version)); if (!CreateChannel()) return false; diff --git a/content/browser/ppapi_plugin_process_host.cc b/content/browser/ppapi_plugin_process_host.cc index 7527f08..7108f02 100644 --- a/content/browser/ppapi_plugin_process_host.cc +++ b/content/browser/ppapi_plugin_process_host.cc @@ -31,8 +31,8 @@ PpapiPluginProcessHost::~PpapiPluginProcessHost() { bool PpapiPluginProcessHost::Init(const PepperPluginInfo& info) { plugin_path_ = info.path; - set_name(UTF8ToWide(info.name)); - set_version(UTF8ToWide(info.version)); + set_name(UTF8ToUTF16(info.name)); + set_version(UTF8ToUTF16(info.version)); if (!CreateChannel()) return false; diff --git a/content/browser/utility_process_host.cc b/content/browser/utility_process_host.cc index ce7e1d2..44a7ef5 100644 --- a/content/browser/utility_process_host.cc +++ b/content/browser/utility_process_host.cc @@ -6,6 +6,7 @@ #include "base/command_line.h" #include "base/message_loop.h" +#include "base/utf_string_conversions.h" #include "content/browser/content_browser_client.h" #include "content/common/content_switches.h" #include "content/common/utility_messages.h" @@ -72,7 +73,7 @@ bool UtilityProcessHost::StartProcess() { return true; // Name must be set or metrics_service will crash in any test which // launches a UtilityProcessHost. - set_name(L"utility process"); + set_name(ASCIIToUTF16("utility process")); if (!CreateChannel()) return false; diff --git a/content/browser/worker_host/worker_process_host.cc b/content/browser/worker_host/worker_process_host.cc index d6e559c..e3db990 100644 --- a/content/browser/worker_host/worker_process_host.cc +++ b/content/browser/worker_host/worker_process_host.cc @@ -485,7 +485,7 @@ void WorkerProcessHost::UpdateTitle() { display_title += *i; } - set_name(ASCIIToWide(display_title)); + set_name(ASCIIToUTF16(display_title)); } void WorkerProcessHost::DocumentDetached(WorkerMessageFilter* filter, diff --git a/content/common/child_process_info.h b/content/common/child_process_info.h index 4b709bd..a0c8c27 100644 --- a/content/common/child_process_info.h +++ b/content/common/child_process_info.h @@ -60,11 +60,11 @@ class ChildProcessInfo { // Returns the name of the process. i.e. for plugins it might be Flash, while // for workers it might be the domain that it's from. - std::wstring name() const { return name_; } + const string16& name() const { return name_; } // Returns the version of the exe, this only appliest to plugins. Otherwise // the string is empty. - std::wstring version() const { return version_; } + const string16& version() const { return version_; } // Getter to the process handle. base::ProcessHandle handle() const { return process_.handle(); } @@ -120,15 +120,15 @@ class ChildProcessInfo { void set_type(ProcessType type) { type_ = type; } void set_renderer_type(RendererProcessType type) { renderer_type_ = type; } - void set_name(const std::wstring& name) { name_ = name; } - void set_version(const std::wstring& ver) { version_ = ver; } + void set_name(const string16& name) { name_ = name; } + void set_version(const string16& ver) { version_ = ver; } void set_handle(base::ProcessHandle handle) { process_.set_handle(handle); } private: ProcessType type_; RendererProcessType renderer_type_; - std::wstring name_; - std::wstring version_; + string16 name_; + string16 version_; int id_; // The handle to the process. |