Rename the Helper process to Renderer/Plug-In Host/Utility as appropriate

This matches Chrome.
This commit is contained in:
Adam Roben 2013-07-17 11:04:45 -04:00
parent 33b574b434
commit bacf11d53f
3 changed files with 24 additions and 0 deletions

View file

@ -34,6 +34,7 @@ void MainDelegate::PreSandboxStartup() {
#if defined(OS_MACOSX)
OverrideChildProcessPath();
OverrideFrameworkBundlePath();
SetProcessName();
#endif
InitializeResourceBundle();
}

View file

@ -39,6 +39,7 @@ private:
static base::FilePath GetResourcesPakFilePath();
static void OverrideChildProcessPath();
static void OverrideFrameworkBundlePath();
static void SetProcessName();
#endif
scoped_ptr<ContentClient> content_client_;

View file

@ -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));
}
}