Bug 1395827 - Eliminate NO_REMOTE_TYPE and default GetNewOrUsedBrowserProcess() remote type arg. r=billm

NO_REMOTE_TYPE seems to have been an artifact of introducing remote types and
not wanting to change things.  This eliminates the type, changing
GetNewOrUsedBrowserProcess() to no longer use a default argument so that
callers must think about the remote type they want.  Additionally, the existing
call-site used by xpcshell in nsEmbedFunctions.cpp is updated to use the
DEFAULT_REMOTE_TYPE of "web", as-is the unused nsAppRunner.cpp case.  (That is,
no one appears to call nsXULAppInfo::EnsureContentProcess directly or via its
XPCOM interface, and so it probably should be removed.  However, since I
potentially want this patch uplifted to beta 56 and legacy extensions exist
there, we're not addressing that in this patch.)

--HG--
extra : rebase_source : bb87ec781d041bcea49268585bb5b45522b19bc2
This commit is contained in:
Andrew Sutherland 2017-09-01 02:24:47 -04:00
parent 9d11ba2233
commit 53d89ea1a9
3 changed files with 10 additions and 5 deletions

View File

@ -36,8 +36,6 @@
#define CHILD_PROCESS_SHUTDOWN_MESSAGE NS_LITERAL_STRING("child-process-shutdown")
#define NO_REMOTE_TYPE ""
// These must match the similar ones in E10SUtils.jsm.
// Process names as reported by about:memory are defined in
// ContentChild:RecvRemoteType. Add your value there too or it will be called
@ -169,7 +167,7 @@ public:
* 3. normal iframe
*/
static already_AddRefed<ContentParent>
GetNewOrUsedBrowserProcess(const nsAString& aRemoteType = NS_LITERAL_STRING(NO_REMOTE_TYPE),
GetNewOrUsedBrowserProcess(const nsAString& aRemoteType,
hal::ProcessPriority aPriority =
hal::ProcessPriority::PROCESS_PRIORITY_FOREGROUND,
ContentParent* aOpener = nullptr,

View File

@ -1014,7 +1014,8 @@ nsXULAppInfo::EnsureContentProcess()
if (!XRE_IsParentProcess())
return NS_ERROR_NOT_AVAILABLE;
RefPtr<ContentParent> unused = ContentParent::GetNewOrUsedBrowserProcess();
RefPtr<ContentParent> unused = ContentParent::GetNewOrUsedBrowserProcess(
NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE));
return NS_OK;
}

View File

@ -901,7 +901,13 @@ ContentParent* gContentParent; //long-lived, manually refcounted
TestShellParent* GetOrCreateTestShellParent()
{
if (!gContentParent) {
RefPtr<ContentParent> parent = ContentParent::GetNewOrUsedBrowserProcess();
// Use a "web" child process by default. File a bug if you don't like
// this and you're sure you wouldn't be better off writing a "browser"
// chrome mochitest where you can have multiple types of content
// processes.
RefPtr<ContentParent> parent =
ContentParent::GetNewOrUsedBrowserProcess(
NS_LITERAL_STRING(DEFAULT_REMOTE_TYPE));
parent.forget(&gContentParent);
} else if (!gContentParent->IsAlive()) {
return nullptr;