Backed out changeset 8f1051f12365 (bug 1637085) for build bustages on selftest.py. CLOSED TREE

This commit is contained in:
Razvan Maries 2020-06-01 21:52:34 +03:00
parent c5a8f831d4
commit 9b7eb56aa8
2 changed files with 19 additions and 76 deletions

View File

@ -616,6 +616,8 @@ static bool sCreatedFirstContentProcess = false;
static uint64_t gContentChildID = 1;
static const char* sObserverTopics[] = {
"xpcom-shutdown",
"profile-before-change",
NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC,
NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC,
NS_IPC_CAPTIVE_PORTAL_SET_STATE,
@ -1471,8 +1473,6 @@ void ContentParent::Init() {
}
}
AddShutdownBlockers();
// Flush any pref updates that happened during launch and weren't
// included in the blobs set up in BeginSubprocessLaunch.
for (const Pref& pref : mQueuedPrefs) {
@ -1724,8 +1724,6 @@ void ContentParent::ActorDestroy(ActorDestroyReason why) {
// finish waiting in the xpcom-shutdown/profile-before-change observer.
mIPCOpen = false;
RemoveShutdownBlockers();
if (mHangMonitorActor) {
ProcessHangMonitor::RemoveProcess(mHangMonitorActor);
mHangMonitorActor = nullptr;
@ -3083,77 +3081,30 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ContentParent)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionCallback)
NS_INTERFACE_MAP_ENTRY(nsIDOMGeoPositionErrorCallback)
NS_INTERFACE_MAP_ENTRY(nsIAsyncShutdownBlocker)
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIContentParent)
NS_INTERFACE_MAP_END
// Async shutdown blocker
NS_IMETHODIMP
ContentParent::BlockShutdown(nsIAsyncShutdownClient* aClient) {
// Make sure that our process will get scheduled.
ProcessPriorityManager::SetProcessPriority(this, PROCESS_PRIORITY_FOREGROUND);
// Okay to call ShutDownProcess multiple times.
ShutDownProcess(SEND_SHUTDOWN_MESSAGE);
MarkAsDead();
return NS_OK;
}
NS_IMETHODIMP
ContentParent::GetName(nsAString& aName) {
aName.AssignLiteral("ContentParent: remoteType=");
aName.Append(RemoteTypePrefix(mRemoteType));
aName.AppendPrintf(" id=%p", this);
return NS_OK;
}
NS_IMETHODIMP
ContentParent::GetState(nsIPropertyBag** aResult) {
*aResult = nullptr;
return NS_OK;
}
static StaticRefPtr<nsIAsyncShutdownClient> sXPCOMShutdownClient;
static StaticRefPtr<nsIAsyncShutdownClient> sProfileBeforeChangeClient;
static void InitClients() {
if (!sXPCOMShutdownClient) {
nsresult rv;
nsCOMPtr<nsIAsyncShutdownService> svc = services::GetAsyncShutdown();
nsCOMPtr<nsIAsyncShutdownClient> client;
rv = svc->GetXpcomWillShutdown(getter_AddRefs(client));
sXPCOMShutdownClient = client.forget();
ClearOnShutdown(&sXPCOMShutdownClient);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv), "XPCOMShutdown shutdown blocker");
rv = svc->GetProfileBeforeChange(getter_AddRefs(client));
sProfileBeforeChangeClient = client.forget();
ClearOnShutdown(&sProfileBeforeChangeClient);
MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv),
"profileBeforeChange shutdown blocker");
}
}
void ContentParent::AddShutdownBlockers() {
InitClients();
sXPCOMShutdownClient->AddBlocker(this, NS_LITERAL_STRING(__FILE__), __LINE__,
EmptyString());
sProfileBeforeChangeClient->AddBlocker(this, NS_LITERAL_STRING(__FILE__),
__LINE__, EmptyString());
}
void ContentParent::RemoveShutdownBlockers() {
Unused << sXPCOMShutdownClient->RemoveBlocker(this);
Unused << sProfileBeforeChangeClient->RemoveBlocker(this);
}
NS_IMETHODIMP
ContentParent::Observe(nsISupports* aSubject, const char* aTopic,
const char16_t* aData) {
if (mSubprocess && (!strcmp(aTopic, "profile-before-change") ||
!strcmp(aTopic, "xpcom-shutdown"))) {
// Make sure that our process will get scheduled.
ProcessPriorityManager::SetProcessPriority(this,
PROCESS_PRIORITY_FOREGROUND);
// Okay to call ShutDownProcess multiple times.
ShutDownProcess(SEND_SHUTDOWN_MESSAGE);
MarkAsDead();
// Wait for shutdown to complete, so that we receive any shutdown
// data (e.g. telemetry) from the child before we quit.
// This loop terminate prematurely based on mForceKillTimer.
SpinEventLoopUntil([&]() { return !mIPCOpen || mCalledKillHard; });
NS_ASSERTION(!mSubprocess, "Close should have nulled mSubprocess");
}
if (IsDead() || !mSubprocess) {
return NS_OK;
}
@ -3594,8 +3545,6 @@ void ContentParent::KillHard(const char* aReason) {
mCalledKillHard = true;
mForceKillTimer = nullptr;
RemoveShutdownBlockers();
GeneratePairedMinidump(aReason);
nsDependentCString reason(aReason);

View File

@ -36,7 +36,6 @@
#include "nsPluginTags.h"
#include "nsFrameMessageManager.h"
#include "nsHashKeys.h"
#include "nsIAsyncShutdown.h"
#include "nsIContentParent.h"
#include "nsIInterfaceRequestor.h"
#include "nsIObserver.h"
@ -133,7 +132,6 @@ class ContentParent final
public nsIObserver,
public nsIDOMGeoPositionCallback,
public nsIDOMGeoPositionErrorCallback,
public nsIAsyncShutdownBlocker,
public nsIInterfaceRequestor,
public gfx::gfxVarReceiver,
public mozilla::LinkedListElement<ContentParent>,
@ -342,7 +340,6 @@ class ContentParent final
NS_DECL_NSIOBSERVER
NS_DECL_NSIDOMGEOPOSITIONCALLBACK
NS_DECL_NSIDOMGEOPOSITIONERRORCALLBACK
NS_DECL_NSIASYNCSHUTDOWNBLOCKER
NS_DECL_NSIINTERFACEREQUESTOR
/**
@ -707,9 +704,6 @@ class ContentParent final
sJSPluginContentParents;
static StaticAutoPtr<LinkedList<ContentParent>> sContentParents;
void AddShutdownBlockers();
void RemoveShutdownBlockers();
#if defined(XP_MACOSX) && defined(MOZ_SANDBOX)
// Cached Mac sandbox params used when launching content processes.
static StaticAutoPtr<std::vector<std::string>> sMacSandboxParams;