зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset d53d91a3fae7 (bug 1155547) for b2g xpcshell orange CLOSED TREE
This commit is contained in:
Родитель
f8d9269061
Коммит
2dd76b5a8a
|
@ -2276,12 +2276,7 @@ nsFrameLoader::TryRemoteBrowser()
|
|||
NS_ENSURE_TRUE(rv, false);
|
||||
|
||||
nsCOMPtr<Element> ownerElement = mOwnerContent;
|
||||
TabParent* browser = ContentParent::CreateBrowserOrApp(context, ownerElement, openerContentParent);
|
||||
if (mRemoteBrowser) {
|
||||
MOZ_ASSERT(mRemoteBrowser == browser, "Must be the same as that obtained from another call");
|
||||
return false;
|
||||
}
|
||||
mRemoteBrowser = browser;
|
||||
mRemoteBrowser = ContentParent::CreateBrowserOrApp(context, ownerElement, openerContentParent);
|
||||
if (!mRemoteBrowser) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -703,22 +703,7 @@ ContentParent::GetNewOrPreallocatedAppProcess(mozIApplication* aApp,
|
|||
/*out*/ bool* aTookPreAllocated)
|
||||
{
|
||||
MOZ_ASSERT(aApp);
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
nsRefPtr<ContentParent> process;
|
||||
{
|
||||
nsAutoString manifestURL;
|
||||
if (NS_FAILED(aApp->GetManifestURL(manifestURL))) {
|
||||
NS_ERROR("Failed to get manifest URL");
|
||||
return nullptr;
|
||||
}
|
||||
process = PreallocatedProcessManager::BlockForNewProcess(manifestURL);
|
||||
if (!process) {
|
||||
process = sAppContentParents->Get(manifestURL);
|
||||
}
|
||||
}
|
||||
#else
|
||||
nsRefPtr<ContentParent> process = PreallocatedProcessManager::Take();
|
||||
#endif
|
||||
|
||||
if (process) {
|
||||
if (!process->SetPriorityAndCheckIsAlive(aInitialPriority)) {
|
||||
|
@ -886,11 +871,7 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
|
|||
}
|
||||
|
||||
// Try to take and transform the preallocated process into browser.
|
||||
#ifdef MOZ_NUWA_PROCESS
|
||||
nsRefPtr<ContentParent> p = PreallocatedProcessManager::BlockForNewProcess(NS_LITERAL_STRING(""));
|
||||
#else
|
||||
nsRefPtr<ContentParent> p = PreallocatedProcessManager::Take();
|
||||
#endif
|
||||
if (p) {
|
||||
p->TransformPreallocatedIntoBrowser(aOpener);
|
||||
} else {
|
||||
|
|
|
@ -59,7 +59,6 @@ public:
|
|||
void OnNuwaReady();
|
||||
bool PreallocatedProcessReady();
|
||||
already_AddRefed<ContentParent> GetSpareProcess();
|
||||
already_AddRefed<ContentParent> BlockForNewProcess(const nsAString& aManifestURL);
|
||||
|
||||
private:
|
||||
void NuwaFork();
|
||||
|
@ -73,7 +72,6 @@ private:
|
|||
|
||||
// Nuwa process is ready for creating new process.
|
||||
bool mIsNuwaReady;
|
||||
nsTArray<nsString> mWaitingList;
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
@ -285,44 +283,6 @@ PreallocatedProcessManagerImpl::GetSpareProcess()
|
|||
return process.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<ContentParent>
|
||||
PreallocatedProcessManagerImpl::BlockForNewProcess(const nsAString& aManifestURL)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mEnabled || !IsNuwaReady()) {
|
||||
// If nuwa is not ready, we can't enter the nested loop.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (mSpareProcesses.IsEmpty()) {
|
||||
// a request comes in while there's no preallocated process. fork now.
|
||||
if (aManifestURL.Length() == 0) {
|
||||
// for browser.
|
||||
NuwaFork();
|
||||
} else if (mWaitingList.IndexOf(aManifestURL) == nsTArray<nsString>::NoIndex) {
|
||||
// add the manifest url to waiting list. if there's another request came in while
|
||||
// we are in nested loop, this will prevent later request from forking again.
|
||||
NuwaFork();
|
||||
mWaitingList.AppendElement(aManifestURL);
|
||||
}
|
||||
while (mSpareProcesses.IsEmpty() &&
|
||||
(aManifestURL.Length() != 0 &&
|
||||
mWaitingList.IndexOf(aManifestURL) != nsTArray<nsString>::NoIndex)) {
|
||||
NS_ProcessNextEvent();
|
||||
}
|
||||
// If we are no longer in the waiting list, just return and content parent will
|
||||
// get a process for us.
|
||||
if (aManifestURL.Length() != 0 &&
|
||||
mWaitingList.IndexOf(aManifestURL) == nsTArray<nsString>::NoIndex) {
|
||||
return nullptr;
|
||||
}
|
||||
mWaitingList.RemoveElement(aManifestURL);
|
||||
}
|
||||
|
||||
return GetSpareProcess();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Publish a ContentParent to spare process list.
|
||||
*/
|
||||
|
@ -524,12 +484,6 @@ PreallocatedProcessManager::PreallocatedProcessReady()
|
|||
return GetPPMImpl()->PreallocatedProcessReady();
|
||||
}
|
||||
|
||||
/* static */ already_AddRefed<ContentParent>
|
||||
PreallocatedProcessManager::BlockForNewProcess(const nsAString& aManifestURL)
|
||||
{
|
||||
return GetPPMImpl()->BlockForNewProcess(aManifestURL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -84,7 +84,6 @@ public:
|
|||
static bool IsNuwaReady();
|
||||
static void OnNuwaReady();
|
||||
static bool PreallocatedProcessReady();
|
||||
static already_AddRefed<ContentParent> BlockForNewProcess(const nsAString& aManifestURL);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
|
Загрузка…
Ссылка в новой задаче