diff options
author | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-07 19:56:11 +0000 |
---|---|---|
committer | thomasvl@chromium.org <thomasvl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-07 19:56:11 +0000 |
commit | 13b290e700929fa5bee18ce68fa1ac50c2506a0a (patch) | |
tree | 5148c796039424bd41e71d325991c17376b46e04 | |
parent | 2e817e3527ff2cd9b767d55f53660e296b348aad (diff) | |
download | chromium_src-13b290e700929fa5bee18ce68fa1ac50c2506a0a.zip chromium_src-13b290e700929fa5bee18ce68fa1ac50c2506a0a.tar.gz chromium_src-13b290e700929fa5bee18ce68fa1ac50c2506a0a.tar.bz2 |
[Mac] This probably won't fix the bug complete, but just put in some checks to make sure the process name is only getting set in ways we expect.
BUG=40583
TEST=none
Review URL: http://codereview.chromium.org/1628007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@43867 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/mac_util.mm | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/base/mac_util.mm b/base/mac_util.mm index 5735aa3..91ad48c 100644 --- a/base/mac_util.mm +++ b/base/mac_util.mm @@ -388,6 +388,16 @@ CFTypeRef GetValueFromDictionary(CFDictionaryRef dict, } 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). @@ -449,9 +459,12 @@ void SetProcessName(CFStringRef process_name) { PrivateLSASN asn = ls_get_current_application_asn_func(); // Constant used by WebKit; what exactly it means is unknown. const int magic_session_constant = -2; - ls_set_application_information_item_func(magic_session_constant, asn, - ls_display_name_key, process_name, - NULL /* optional out param */); + OSErr err = + ls_set_application_information_item_func(magic_session_constant, asn, + ls_display_name_key, + process_name, + NULL /* optional out param */); + LOG_IF(ERROR, err) << "Call to set process name failed, err " << err; } } // namespace mac_util |