diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-26 15:45:24 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-02-26 15:45:24 +0000 |
commit | ccbaf8a180e4793163cf7eeb336af80c3505b34f (patch) | |
tree | 599f986d3aa51727f4cb5a11ae22ea0d9a0180d5 | |
parent | 4ebd6dd369ae815e9c1c0195befa2dc0890719c6 (diff) | |
download | chromium_src-ccbaf8a180e4793163cf7eeb336af80c3505b34f.zip chromium_src-ccbaf8a180e4793163cf7eeb336af80c3505b34f.tar.gz chromium_src-ccbaf8a180e4793163cf7eeb336af80c3505b34f.tar.bz2 |
[Mac] Use the process type to tweak the name showed in Activity Montior to better label what process it is.
BUG=none
TEST=Don't see "Helper" in actvitiy monitor.
Review URL: http://codereview.chromium.org/660140
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40123 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/DEPS | 1 | ||||
-rw-r--r-- | chrome/app/chrome_dll_main.cc | 31 | ||||
-rw-r--r-- | chrome/chrome_dll.gypi | 3 |
3 files changed, 35 insertions, 0 deletions
diff --git a/chrome/app/DEPS b/chrome/app/DEPS index ef4974d..d83f0a1 100644 --- a/chrome/app/DEPS +++ b/chrome/app/DEPS @@ -2,6 +2,7 @@ include_rules = [ "+breakpad", "+chrome/browser", "+chrome/installer", + "+grit", # For generated headers "+sandbox", "+tools/memory_watcher", ] diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc index f3abd2a..b8188bf 100644 --- a/chrome/app/chrome_dll_main.cc +++ b/chrome/app/chrome_dll_main.cc @@ -67,9 +67,11 @@ #endif #if defined(OS_MACOSX) +#include "app/l10n_util_mac.h" #include "base/mac_util.h" #include "chrome/common/chrome_paths_internal.h" #include "chrome/app/breakpad_mac.h" +#include "grit/chromium_strings.h" #include "third_party/WebKit/WebKit/mac/WebCoreSupport/WebSystemInterface.h" #endif @@ -362,6 +364,28 @@ bool SubprocessNeedsResourceBundle(const std::string& process_type) { process_type == switches::kUtilityProcess; } +#if defined(OS_MACOSX) +// Update the name shown in Activity Monitor so users are less likely to ask +// why Chrome has so many processes. +void SetMacProcessName(const std::string& process_type) { + // Don't worry about the browser process, its gets the stock name. + int name_id = 0; + if (process_type == switches::kRendererProcess) { + name_id = IDS_RENDERER_APP_NAME; + } else if (process_type == switches::kPluginProcess) { + name_id = IDS_PLUGIN_APP_NAME; + } else if (process_type == switches::kExtensionProcess) { + name_id = IDS_WORKER_APP_NAME; + } else if (process_type == switches::kUtilityProcess) { + name_id = IDS_UTILITY_APP_NAME; + } + if (name_id) { + NSString* app_name = l10n_util::GetNSString(name_id); + mac_util::SetProcessName(reinterpret_cast<CFStringRef>(app_name)); + } +} +#endif // defined(OS_MACOSX) + } // namespace #if defined(OS_WIN) @@ -636,6 +660,13 @@ int ChromeMain(int argc, char** argv) { DCHECK(parsed_command_line.HasSwitch(switches::kLang) || process_type == switches::kZygoteProcess); ResourceBundle::InitSharedInstance(std::wstring()); + +#if defined(OS_MACOSX) + // Update the process name (need resources to get the strings, so + // only do this when ResourcesBundle has been initialized). + SetMacProcessName(process_type); +#endif // defined(OS_MACOSX) + } if (!process_type.empty()) diff --git a/chrome/chrome_dll.gypi b/chrome/chrome_dll.gypi index bc4c312..47beb7a 100644 --- a/chrome/chrome_dll.gypi +++ b/chrome/chrome_dll.gypi @@ -172,6 +172,9 @@ 'app/chrome_dll_resource.h', 'app/chrome_exe_main.mm', ], + 'include_dirs': [ + '<(grit_out_dir)', + ], # TODO(mark): Come up with a fancier way to do this. It should # only be necessary to list framework-Info.plist once, not the # three times it is listed here. |