Bug 1011225: Improve e10s process naming on OS X. Patch started by Benoit Girard, completed by Josh Aas. r=njn,benwa

This commit is contained in:
Josh Aas 2014-08-26 12:03:09 -05:00
parent 0735cf9d8c
commit bc9f156182
8 changed files with 40 additions and 7 deletions

View File

@ -592,6 +592,7 @@ ContentChild::Init(MessageLoop* aIOLoop,
void
ContentChild::InitProcessAttributes()
{
#ifdef MOZ_WIDGET_GONK
#ifdef MOZ_NUWA_PROCESS
if (IsNuwaProcess()) {
SetProcessName(NS_LITERAL_STRING("(Nuwa)"), false);
@ -603,7 +604,9 @@ ContentChild::InitProcessAttributes()
} else {
SetProcessName(NS_LITERAL_STRING("Browser"), false);
}
#else
SetProcessName(NS_LITERAL_STRING("Web Content"), true);
#endif
}
void

View File

@ -184,7 +184,10 @@ PluginModuleChild::Init(const std::string& aPluginFilename,
AddQuirk(QUIRK_FLASH_EXPOSE_COORD_TRANSLATION);
}
#else // defined(OS_MACOSX)
mozilla::plugins::PluginUtilsOSX::SetProcessName(info.fName);
const char* namePrefix = "Plugin Content";
char nameBuffer[80];
snprintf(nameBuffer, sizeof(nameBuffer), "%s (%s)", namePrefix, info.fName);
mozilla::plugins::PluginUtilsOSX::SetProcessName(nameBuffer);
#endif
pluginFile.FreePluginInfo(info);

View File

@ -277,7 +277,7 @@ bool mozilla::plugins::PluginUtilsOSX::SetProcessName(const char* aProcessName)
char formattedName[1024];
snprintf(formattedName, sizeof(formattedName),
"%s (%s)", [currentName UTF8String], aProcessName);
"%s %s", [currentName UTF8String], aProcessName);
aProcessName = formattedName;

View File

@ -4,4 +4,4 @@
/* Localized versions of Info.plist keys */
CFBundleName = "%APP_NAME% Plugin Process";
CFBundleName = "%APP_NAME%";

View File

@ -0,0 +1,20 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "ProcessUtils.h"
#include "nsString.h"
#include "mozilla/plugins/PluginUtilsOSX.h"
namespace mozilla {
namespace ipc {
void SetThisProcessName(const char *aName)
{
mozilla::plugins::PluginUtilsOSX::SetProcessName(aName);
}
} // namespace ipc
} // namespace mozilla

View File

@ -85,6 +85,10 @@ elif CONFIG['OS_ARCH'] in ('DragonFly', 'FreeBSD', 'NetBSD', 'OpenBSD'):
UNIFIED_SOURCES += [
'ProcessUtils_bsd.cpp'
]
elif CONFIG['OS_ARCH'] in ('Darwin'):
UNIFIED_SOURCES += [
'ProcessUtils_mac.mm'
]
else:
UNIFIED_SOURCES += [
'ProcessUtils_none.cpp',

View File

@ -126,7 +126,10 @@
// Note: Match "vsize" but not "vsize-max-contiguous".
let vsizes = actual.match(/vsize[^-]/g);
let endOfBrowsers = actual.match(/End of Browser/g);
let endOfBrowsers = actual.match(/End of Browser/g);
if (endOfBrowsers == null) {
endOfBrowsers = actual.match(/End of Web Content/g);
}
let m2 = (vsizes.length == 4 && endOfBrowsers.length == 3);
ok(m2, "three child processes present in loaded data");
good = good && !!m2;

View File

@ -85,8 +85,8 @@
if (processes[i] == "") {
numEmptyProcesses++;
} else {
ok(processes[i].startsWith("Browser ("),
"correct non-empty process name prefix");
ok(processes[i].startsWith("Browser (") || processes[i].startsWith("Web Content ("),
"correct non-empty process name prefix: " + processes[i]);
numNonEmptyProcesses++;
}
}