summaryrefslogtreecommitdiffstats
path: root/base/mac
diff options
context:
space:
mode:
authoravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 20:47:00 +0000
committeravi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 20:47:00 +0000
commit901bc6f0153757765b80d34f0c3866747f1820e5 (patch)
treea855bd74a5610b285b0df5409cbe3c229c40a2dc /base/mac
parent4a4171ad8f06933631c58f87fffb28283a030b02 (diff)
downloadchromium_src-901bc6f0153757765b80d34f0c3866747f1820e5.zip
chromium_src-901bc6f0153757765b80d34f0c3866747f1820e5.tar.gz
chromium_src-901bc6f0153757765b80d34f0c3866747f1820e5.tar.bz2
Do not set process names in the Activity Monitor.
This involves Process Manager functions, which in 10.9 cause a WindowServer checkin, which causes "not responding" notifications on any child process that doesn't pump events (which is everything but the renderers). BUG=304860 TEST=Plugin process on Mavericks shouldn't have an app icon to its left, shouldn't be "not responding" R=mark@chromium.org, thakis@chromium.org Review URL: https://codereview.chromium.org/45253002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231108 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/mac')
-rw-r--r--base/mac/mac_util.h3
-rw-r--r--base/mac/mac_util.mm90
2 files changed, 0 insertions, 93 deletions
diff --git a/base/mac/mac_util.h b/base/mac/mac_util.h
index 5f82f43..cb7ed7e 100644
--- a/base/mac/mac_util.h
+++ b/base/mac/mac_util.h
@@ -92,9 +92,6 @@ BASE_EXPORT bool AmIForeground();
// Excludes the file given by |file_path| from being backed up by Time Machine.
BASE_EXPORT bool SetFileBackupExclusion(const FilePath& file_path);
-// Sets the process name as displayed in Activity Monitor to process_name.
-BASE_EXPORT void SetProcessName(CFStringRef process_name);
-
// Converts a NSImage to a CGImageRef. Normally, the system frameworks can do
// this fine, especially on 10.6. On 10.5, however, CGImage cannot handle
// converting a PDF-backed NSImage into a CGImageRef. This function will
diff --git a/base/mac/mac_util.mm b/base/mac/mac_util.mm
index bb35c2b..dad1d85 100644
--- a/base/mac/mac_util.mm
+++ b/base/mac/mac_util.mm
@@ -298,96 +298,6 @@ bool SetFileBackupExclusion(const FilePath& file_path) {
return os_err == noErr;
}
-void SetProcessName(CFStringRef process_name) {
- if (!process_name || CFStringGetLength(process_name) == 0) {
- NOTREACHED() << "SetProcessName given bad name.";
- return;
- }
-
- if (![NSThread isMainThread]) {
- NOTREACHED() << "Should only set process name from main thread.";
- return;
- }
-
- // Warning: here be dragons! This is SPI reverse-engineered from WebKit's
- // plugin host, and could break at any time (although realistically it's only
- // likely to break in a new major release).
- // When 10.7 is available, check that this still works, and update this
- // comment for 10.8.
-
- // Private CFType used in these LaunchServices calls.
- typedef CFTypeRef PrivateLSASN;
- typedef PrivateLSASN (*LSGetCurrentApplicationASNType)();
- typedef OSStatus (*LSSetApplicationInformationItemType)(int, PrivateLSASN,
- CFStringRef,
- CFStringRef,
- CFDictionaryRef*);
-
- static LSGetCurrentApplicationASNType ls_get_current_application_asn_func =
- NULL;
- static LSSetApplicationInformationItemType
- ls_set_application_information_item_func = NULL;
- static CFStringRef ls_display_name_key = NULL;
-
- static bool did_symbol_lookup = false;
- if (!did_symbol_lookup) {
- did_symbol_lookup = true;
- CFBundleRef launch_services_bundle =
- CFBundleGetBundleWithIdentifier(CFSTR("com.apple.LaunchServices"));
- if (!launch_services_bundle) {
- DLOG(ERROR) << "Failed to look up LaunchServices bundle";
- return;
- }
-
- ls_get_current_application_asn_func =
- reinterpret_cast<LSGetCurrentApplicationASNType>(
- CFBundleGetFunctionPointerForName(
- launch_services_bundle, CFSTR("_LSGetCurrentApplicationASN")));
- if (!ls_get_current_application_asn_func)
- DLOG(ERROR) << "Could not find _LSGetCurrentApplicationASN";
-
- ls_set_application_information_item_func =
- reinterpret_cast<LSSetApplicationInformationItemType>(
- CFBundleGetFunctionPointerForName(
- launch_services_bundle,
- CFSTR("_LSSetApplicationInformationItem")));
- if (!ls_set_application_information_item_func)
- DLOG(ERROR) << "Could not find _LSSetApplicationInformationItem";
-
- CFStringRef* key_pointer = reinterpret_cast<CFStringRef*>(
- CFBundleGetDataPointerForName(launch_services_bundle,
- CFSTR("_kLSDisplayNameKey")));
- ls_display_name_key = key_pointer ? *key_pointer : NULL;
- if (!ls_display_name_key)
- DLOG(ERROR) << "Could not find _kLSDisplayNameKey";
-
- // Internally, this call relies on the Mach ports that are started up by the
- // Carbon Process Manager. In debug builds this usually happens due to how
- // the logging layers are started up; but in release, it isn't started in as
- // much of a defined order. So if the symbols had to be loaded, go ahead
- // and force a call to make sure the manager has been initialized and hence
- // the ports are opened.
- ProcessSerialNumber psn;
- GetCurrentProcess(&psn);
- }
- if (!ls_get_current_application_asn_func ||
- !ls_set_application_information_item_func ||
- !ls_display_name_key) {
- return;
- }
-
- PrivateLSASN asn = ls_get_current_application_asn_func();
- // Constant used by WebKit; what exactly it means is unknown.
- const int magic_session_constant = -2;
- OSErr err =
- ls_set_application_information_item_func(magic_session_constant, asn,
- ls_display_name_key,
- process_name,
- NULL /* optional out param */);
- OSSTATUS_DLOG_IF(ERROR, err != noErr, err)
- << "Call to set process name failed";
-}
-
// Converts a NSImage to a CGImageRef. Normally, the system frameworks can do
// this fine, especially on 10.6. On 10.5, however, CGImage cannot handle
// converting a PDF-backed NSImage into a CGImageRef. This function will