Commit cd95c253 authored by amistry's avatar amistry Committed by Commit bot

Add a name to the proxy resolver utility process and display it in the task manager.

BUG=467832

Review URL: https://codereview.chromium.org/960753003

Cr-Commit-Position: refs/heads/master@{#321495}
parent 147fd75c
......@@ -3915,7 +3915,7 @@ Even if you have downloaded files from this website before, the website might ha
Web Worker: <ph name="WORKER_NAME">$1<ex>http://www.domain.com</ex></ph>
</message>
<message name="IDS_TASK_MANAGER_UTILITY_PREFIX" desc="The prefix for a utility process row">
Utility:
Utility: <ph name="UTILITY_TYPE">$1<ex>Image Decoder</ex></ph>
</message>
<message name="IDS_TASK_MANAGER_NACL_PREFIX" desc="The prefix for a Task Manager Native Client module row">
Native Client module: <ph name="NEXE_NAME">$1<ex>Unknown Native Client module</ex></ph>
......@@ -3937,6 +3937,10 @@ Even if you have downloaded files from this website before, the website might ha
</message>
</if>
<message name="IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME" desc="The name of the utility process used for out-of-process V8 proxy resolution.">
V8 Proxy Resolver
</message>
<if expr="not is_android">
<!-- Performance Monitor page -->
<message name="IDS_PERFORMANCE_MONITOR_TITLE" desc="Title for the Performance tab.">
......
......@@ -6,11 +6,13 @@
#include "base/logging.h"
#include "base/memory/singleton.h"
#include "chrome/grit/generated_resources.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/utility_process_host.h"
#include "content/public/browser/utility_process_host_client.h"
#include "content/public/common/service_registry.h"
#include "net/proxy/mojo_proxy_resolver_factory.h"
#include "ui/base/l10n/l10n_util.h"
// static
UtilityProcessMojoProxyResolverFactory*
......@@ -37,6 +39,8 @@ void UtilityProcessMojoProxyResolverFactory::CreateProcessAndConnect() {
content::UtilityProcessHost::Create(
scoped_refptr<content::UtilityProcessHostClient>(),
base::MessageLoopProxy::current().get());
utility_process_host->SetName(l10n_util::GetStringUTF8(
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME));
bool process_started = utility_process_host->StartMojoMode();
if (process_started) {
content::ServiceRegistry* service_registry =
......
......@@ -172,7 +172,7 @@ base::string16 ChildProcessResource::GetLocalizedTitle() const {
switch (process_type_) {
case content::PROCESS_TYPE_UTILITY:
return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX);
return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, title);
case content::PROCESS_TYPE_GPU:
return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_GPU_PREFIX);
case content::PROCESS_TYPE_PLUGIN:
......
......@@ -108,7 +108,8 @@ UtilityProcessHostImpl::UtilityProcessHostImpl(
#else
child_flags_(ChildProcessHost::CHILD_NORMAL),
#endif
started_(false) {
started_(false),
name_("utility process") {
}
UtilityProcessHostImpl::~UtilityProcessHostImpl() {
......@@ -191,6 +192,10 @@ ServiceRegistry* UtilityProcessHostImpl::GetServiceRegistry() {
return mojo_application_host_->service_registry();
}
void UtilityProcessHostImpl::SetName(const std::string& name) {
name_ = name;
}
bool UtilityProcessHostImpl::StartProcess() {
if (started_)
return true;
......@@ -202,7 +207,7 @@ bool UtilityProcessHostImpl::StartProcess() {
// Name must be set or metrics_service will crash in any test which
// launches a UtilityProcessHost.
process_.reset(new BrowserChildProcessHostImpl(PROCESS_TYPE_UTILITY, this));
process_->SetName(base::ASCIIToUTF16("utility process"));
process_->SetName(base::UTF8ToUTF16(name_));
std::string channel_id = process_->GetHost()->CreateChannel();
if (channel_id.empty())
......
......@@ -58,6 +58,7 @@ class CONTENT_EXPORT UtilityProcessHostImpl
#endif
bool StartMojoMode() override;
ServiceRegistry* GetServiceRegistry() override;
void SetName(const std::string& name) override;
void set_child_flags(int flags) { child_flags_ = flags; }
......@@ -98,6 +99,10 @@ class CONTENT_EXPORT UtilityProcessHostImpl
bool started_;
// A user-visible name identifying this process. Used to indentify this
// process in the task manager.
std::string name_;
scoped_ptr<BrowserChildProcessHostImpl> process_;
// Used in single-process mode instead of process_.
......
......@@ -83,6 +83,9 @@ class UtilityProcessHost : public IPC::Sender,
// Returns the ServiceRegistry for this process. Only valid to call this if
// the process was started with StartMojoMode().
virtual ServiceRegistry* GetServiceRegistry() = 0;
// Set the name of the process to appear in the task manager.
virtual void SetName(const std::string& name) = 0;
};
}; // namespace content
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment