From bacf11d53f9168d3eb2fdd4837c37381e4aaa551 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 17 Jul 2013 11:04:45 -0400 Subject: [PATCH] Rename the Helper process to Renderer/Plug-In Host/Utility as appropriate This matches Chrome. --- brightray/common/main_delegate.cc | 1 + brightray/common/main_delegate.h | 1 + brightray/common/main_delegate_mac.mm | 22 ++++++++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/brightray/common/main_delegate.cc b/brightray/common/main_delegate.cc index 5578fc7c3af3..b58b2e9d72f5 100644 --- a/brightray/common/main_delegate.cc +++ b/brightray/common/main_delegate.cc @@ -34,6 +34,7 @@ void MainDelegate::PreSandboxStartup() { #if defined(OS_MACOSX) OverrideChildProcessPath(); OverrideFrameworkBundlePath(); + SetProcessName(); #endif InitializeResourceBundle(); } diff --git a/brightray/common/main_delegate.h b/brightray/common/main_delegate.h index f5cbe88d4e84..ba99f5155f04 100644 --- a/brightray/common/main_delegate.h +++ b/brightray/common/main_delegate.h @@ -39,6 +39,7 @@ private: static base::FilePath GetResourcesPakFilePath(); static void OverrideChildProcessPath(); static void OverrideFrameworkBundlePath(); + static void SetProcessName(); #endif scoped_ptr content_client_; diff --git a/brightray/common/main_delegate_mac.mm b/brightray/common/main_delegate_mac.mm index aa7bf0f46251..c9aaecbede36 100644 --- a/brightray/common/main_delegate_mac.mm +++ b/brightray/common/main_delegate_mac.mm @@ -9,9 +9,14 @@ #include "common/mac/foundation_util.h" #include "common/mac/main_application_bundle.h" +#include "base/command_line.h" #include "base/mac/bundle_locations.h" +#include "base/mac/mac_util.h" #include "base/path_service.h" +#include "base/stringprintf.h" +#include "base/strings/sys_string_conversions.h" #include "content/public/common/content_paths.h" +#include "content/public/common/content_switches.h" namespace brightray { @@ -43,4 +48,21 @@ void MainDelegate::OverrideChildProcessPath() { PathService::Override(content::CHILD_PROCESS_EXE, helper_path); } +void MainDelegate::SetProcessName() { + const auto& command_line = *CommandLine::ForCurrentProcess(); + auto process_type = command_line.GetSwitchValueASCII(switches::kProcessType); + std::string suffix; + if (process_type == switches::kRendererProcess) + suffix = "Renderer"; + else if (process_type == switches::kPluginProcess || process_type == switches::kPpapiPluginProcess) + suffix = "Plug-In Host"; + else if (process_type == switches::kUtilityProcess) + suffix = "Utility"; + else + return; + + auto name = base::SysUTF8ToNSString(base::StringPrintf("%s %s", GetApplicationName().c_str(), suffix.c_str())); + base::mac::SetProcessName(base::mac::NSToCFCast(name)); +} + }