-
-
-
-
-
-
-
-
-
diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp
index 1d82a4852f..ce639fe22a 100644
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -557,7 +557,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
#endif
SendGetProcessAttributes(&mID, &mIsForBrowser);
- InitProcessAttributes();
#ifdef NS_PRINTING
// Force the creation of the nsPrintingProxy so that it's IPC counterpart,
@@ -568,12 +567,6 @@ ContentChild::Init(MessageLoop* aIOLoop,
return true;
}
-void
-ContentChild::InitProcessAttributes()
-{
- SetProcessName(NS_LITERAL_STRING("Web Content"), true);
-}
-
void
ContentChild::SetProcessName(const nsAString& aName, bool aDontOverride)
{
@@ -1245,15 +1238,6 @@ ContentChild::RecvBidiKeyboardNotify(const bool& aIsLangRTL,
return true;
}
-static CancelableRunnable* sFirstIdleTask;
-
-static void FirstIdle(void)
-{
- MOZ_ASSERT(sFirstIdleTask);
- sFirstIdleTask = nullptr;
- ContentChild::GetSingleton()->SendFirstIdle();
-}
-
mozilla::jsipc::PJavaScriptChild *
ContentChild::AllocPJavaScriptChild()
{
@@ -1322,22 +1306,6 @@ ContentChild::RecvPBrowserConstructor(PBrowserChild* aActor,
os->NotifyObservers(tc, "tab-child-created", nullptr);
}
- static bool hasRunOnce = false;
- if (!hasRunOnce) {
- hasRunOnce = true;
-
- MOZ_ASSERT(!sFirstIdleTask);
- RefPtr firstIdleTask = NewCancelableRunnableFunction(FirstIdle);
- sFirstIdleTask = firstIdleTask;
- MessageLoop::current()->PostIdleTask(firstIdleTask.forget());
-
- // Redo InitProcessAttributes() when the app or browser is really
- // launching so the attributes will be correct.
- mID = aCpID;
- mIsForBrowser = aIsForBrowser;
- InitProcessAttributes();
- }
-
return true;
}
@@ -1786,9 +1754,6 @@ ContentChild::ActorDestroy(ActorDestroyReason why)
// keep persistent state.
ProcessChild::QuickExit();
#else
- if (sFirstIdleTask) {
- sFirstIdleTask->Cancel();
- }
nsHostObjectProtocolHandler::RemoveDataEntries();
@@ -2082,16 +2047,6 @@ ContentChild::RecvCycleCollect()
return true;
}
-static void
-PreloadSlowThings()
-{
- // This fetches and creates all the built-in stylesheets.
- nsLayoutStylesheetCache::Get()->UserContentSheet();
-
- TabChild::PreloadSlowThings();
-
-}
-
bool
ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
const nsCString& name, const nsCString& UAName,
@@ -2107,25 +2062,6 @@ ContentChild::RecvAppInfo(const nsCString& version, const nsCString& buildID,
return true;
}
-bool
-ContentChild::RecvAppInit()
-{
- if (!Preferences::GetBool("dom.ipc.processPrelaunch.enabled", false)) {
- return true;
- }
-
- // If we're part of the mozbrowser machinery, go ahead and start
- // preloading things. We can only do this for mozbrowser because
- // PreloadSlowThings() may set the docshell of the first TabChild
- // inactive, and we can only safely restore it to active from
- // BrowserElementChild.js.
- if (mIsForBrowser) {
- PreloadSlowThings();
- }
-
- return true;
-}
-
bool
ContentChild::RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig)
{
diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h
index 46e9febe24..8d0c12dba3 100644
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -91,8 +91,6 @@ public:
base::ProcessId aParentPid,
IPC::Channel* aChannel);
- void InitProcessAttributes();
-
void InitXPCOM();
void InitGraphicsDeviceData();
@@ -380,8 +378,6 @@ public:
const nsCString& name, const nsCString& UAName,
const nsCString& ID, const nsCString& vendor) override;
- virtual bool RecvAppInit() override;
-
virtual bool
RecvInitServiceWorkers(const ServiceWorkerConfiguration& aConfig) override;
diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp
index 0261950822..319b20d1f9 100644
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -144,7 +144,6 @@
#include "nsThreadUtils.h"
#include "nsToolkitCompsCID.h"
#include "nsWidgetsCID.h"
-#include "PreallocatedProcessManager.h"
#include "ProcessPriorityManager.h"
#include "SandboxHal.h"
#include "ScreenManagerParent.h"
@@ -493,25 +492,6 @@ static const char* sObserverTopics[] = {
"cacheservice:empty-cache",
};
-// PreallocateAppProcess is called by the PreallocatedProcessManager.
-// ContentParent then takes this process back within
-// GetNewOrPreallocatedAppProcess.
-/*static*/ already_AddRefed
-ContentParent::PreallocateAppProcess()
-{
- RefPtr process =
- new ContentParent(/* aOpener = */ nullptr,
- /* isForBrowserElement = */ false,
- /* isForPreallocated = */ true);
-
- if (!process->LaunchSubprocess(PROCESS_PRIORITY_PREALLOC)) {
- return nullptr;
- }
-
- process->Init();
- return process.forget();
-}
-
/*static*/ void
ContentParent::StartUp()
{
@@ -533,9 +513,6 @@ ContentParent::StartUp()
BackgroundChild::Startup();
- // Try to preallocate a process that we can transform into an app later.
- PreallocatedProcessManager::AllocateAfterDelay();
-
sDisableUnsafeCPOWWarnings = PR_GetEnv("DISABLE_UNSAFE_CPOW_WARNINGS");
}
@@ -640,23 +617,14 @@ ContentParent::GetNewOrUsedBrowserProcess(bool aForBrowserElement,
} while (currIdx != startIdx);
}
- // Try to take and transform the preallocated process into browser.
- RefPtr p = PreallocatedProcessManager::Take();
- if (p) {
- p->TransformPreallocatedIntoBrowser(aOpener);
- } else {
- // Failed in using the preallocated process: fork from the chrome process.
- p = new ContentParent(aOpener,
- aForBrowserElement,
- /* isForPreallocated = */ false);
+ RefPtr p = new ContentParent(aOpener, aForBrowserElement);
- if (!p->LaunchSubprocess(aPriority)) {
- return nullptr;
- }
-
- p->Init();
+ if (!p->LaunchSubprocess(aPriority)) {
+ return nullptr;
}
+ p->Init();
+
p->mLargeAllocationProcess = aLargeAllocationProcess;
p->ForwardKnownInfo();
@@ -711,12 +679,6 @@ ContentParent::SendAsyncUpdate(nsIWidget* aWidget)
}
#endif // defined(XP_WIN)
-bool
-ContentParent::PreallocatedProcessReady()
-{
- return true;
-}
-
bool
ContentParent::RecvCreateChildProcess(const IPCTabContext& aContext,
const hal::ProcessPriority& aPriority,
@@ -1124,15 +1086,6 @@ ContentParent::SetPriorityAndCheckIsAlive(ProcessPriority aPriority)
return true;
}
-void
-ContentParent::TransformPreallocatedIntoBrowser(ContentParent* aOpener)
-{
- // Reset mIsForBrowser and mOSPrivileges for browser.
- mMetamorphosed = true;
- mOpener = aOpener;
- mIsForBrowser = true;
-}
-
void
ContentParent::ShutDownProcess(ShutDownMethod aMethod)
{
@@ -1683,20 +1636,14 @@ ContentParent::LaunchSubprocess(ProcessPriority aInitialPriority /* = PROCESS_PR
}
ContentParent::ContentParent(ContentParent* aOpener,
- bool aIsForBrowser,
- bool aIsForPreallocated)
+ bool aIsForBrowser)
: nsIContentParent()
, mOpener(aOpener)
, mIsForBrowser(aIsForBrowser)
- , mIsPreallocated(aIsForPreallocated)
, mLargeAllocationProcess(false)
{
InitializeMembers(); // Perform common initialization.
- // No more than one of aIsForBrowser, aIsForPreallocated should be
- // true.
- MOZ_ASSERT(aIsForBrowser + aIsForPreallocated <= 1);
-
mMetamorphosed = true;
// Insert ourselves into the global linked list of ContentParent objects.
@@ -1806,11 +1753,6 @@ ContentParent::InitInternal(ProcessPriority aInitialPriority,
}
}
- if (gAppData) {
- // Sending all information to content process.
- Unused << SendAppInit();
- }
-
nsStyleSheetService *sheetService = nsStyleSheetService::GetInstance();
if (sheetService) {
// This looks like a lot of work, but in a normal browser session we just
@@ -2110,17 +2052,6 @@ ContentParent::RecvGetShowPasswordSetting(bool* showPassword)
return true;
}
-bool
-ContentParent::RecvFirstIdle()
-{
- // When the ContentChild goes idle, it sends us a FirstIdle message
- // which we use as a good time to prelaunch another process. If we
- // prelaunch any sooner than this, then we'll be competing with the
- // child process and slowing it down.
- PreallocatedProcessManager::AllocateAfterDelay();
- return true;
-}
-
bool
ContentParent::RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
const bool& aHidden)
@@ -2511,19 +2442,11 @@ ContentParent::KillHard(const char* aReason)
otherProcessHandle, /*force=*/true));
}
-bool
-ContentParent::IsPreallocated() const
-{
- return mIsPreallocated;
-}
-
void
ContentParent::FriendlyName(nsAString& aName, bool aAnonymize)
{
aName.Truncate();
- if (IsPreallocated()) {
- aName.AssignLiteral("(Preallocated)");
- } else if (mIsForBrowser) {
+ if (mIsForBrowser) {
aName.AssignLiteral("Browser");
} else if (aAnonymize) {
aName.AssignLiteral("");
diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h
index e8e7c86c3b..d99ce31f17 100644
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -114,8 +114,6 @@ public:
*/
static void JoinAllSubprocesses();
- static bool PreallocatedProcessReady();
-
/**
* Get or create a content process for:
* 1. browser iframe
@@ -129,11 +127,6 @@ public:
ContentParent* aOpener = nullptr,
bool aLargeAllocationProcess = false);
- /**
- * Create a subprocess suitable for use as a preallocated app process.
- */
- static already_AddRefed PreallocateAppProcess();
-
/**
* Get or create a content process for the given TabContext. aFrameElement
* should be the frame/iframe element with which this process will
@@ -353,8 +346,6 @@ public:
ContentParentId ChildID() const override { return mChildID; }
- bool IsPreallocated() const;
-
/**
* Get a user-friendly name for this ContentParent. We make no guarantees
* about this name: It might not be unique, apps can spoof special names,
@@ -568,11 +559,8 @@ private:
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
- // No more than one of aIsForBrowser, and aIsForPreallocated may be
- // true.
ContentParent(ContentParent* aOpener,
- bool aIsForBrowser,
- bool aIsForPreallocated);
+ bool aIsForBrowser);
// The common initialization for the constructors.
void InitializeMembers();
@@ -601,10 +589,6 @@ private:
// unlikely that the process will be killed after this point.
bool SetPriorityAndCheckIsAlive(hal::ProcessPriority aPriority);
- // Transform a pre-allocated app process into a browser process. If this
- // returns false, the child process has died.
- void TransformPreallocatedIntoBrowser(ContentParent* aOpener);
-
/**
* Mark this ContentParent as dead for the purposes of Get*().
* This method is idempotent.
@@ -887,8 +871,6 @@ private:
virtual bool RecvPrivateDocShellsExist(const bool& aExist) override;
- virtual bool RecvFirstIdle() override;
-
virtual bool RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
const bool& aHidden) override;
@@ -1047,7 +1029,6 @@ private:
bool mSendPermissionUpdates;
bool mIsForBrowser;
- bool mIsPreallocated;
// These variables track whether we've called Close() and KillHard() on our
// channel.
diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl
index 9c45e748ed..a78cd8bb9f 100644
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -400,7 +400,6 @@ child:
async AppInfo(nsCString version, nsCString buildID, nsCString name, nsCString UAName,
nsCString ID, nsCString vendor);
- async AppInit();
/**
* Send ServiceWorkerRegistrationData to child process.
@@ -757,9 +756,6 @@ parent:
// Notify the parent of the presence or absence of private docshells
async PrivateDocShellsExist(bool aExist);
- // Tell the parent that the child has gone idle for the first time
- async FirstIdle();
-
async AudioChannelServiceStatus(bool aActiveTelephonyChannel,
bool aContentOrNormalChannel,
bool aAnyActiveChannel);
diff --git a/dom/ipc/PreallocatedProcessManager.cpp b/dom/ipc/PreallocatedProcessManager.cpp
deleted file mode 100644
index c02e0eccf5..0000000000
--- a/dom/ipc/PreallocatedProcessManager.cpp
+++ /dev/null
@@ -1,251 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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 "mozilla/PreallocatedProcessManager.h"
-#include "mozilla/ClearOnShutdown.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/Unused.h"
-#include "mozilla/dom/ContentParent.h"
-#include "mozilla/dom/ScriptSettings.h"
-#include "nsIPropertyBag2.h"
-#include "ProcessPriorityManager.h"
-#include "nsServiceManagerUtils.h"
-
-// This number is fairly arbitrary ... the intention is to put off
-// launching another app process until the last one has finished
-// loading its content, to reduce CPU/memory/IO contention.
-#define DEFAULT_ALLOCATE_DELAY 1000
-
-using namespace mozilla;
-using namespace mozilla::hal;
-using namespace mozilla::dom;
-
-namespace {
-
-/**
- * This singleton class implements the static methods on
- * PreallocatedProcessManager.
- */
-class PreallocatedProcessManagerImpl final
- : public nsIObserver
-{
-public:
- static PreallocatedProcessManagerImpl* Singleton();
-
- NS_DECL_ISUPPORTS
- NS_DECL_NSIOBSERVER
-
- // See comments on PreallocatedProcessManager for these methods.
- void AllocateAfterDelay();
- void AllocateOnIdle();
- void AllocateNow();
- already_AddRefed Take();
-
-private:
- static mozilla::StaticRefPtr sSingleton;
-
- PreallocatedProcessManagerImpl();
- ~PreallocatedProcessManagerImpl() {}
- DISALLOW_EVIL_CONSTRUCTORS(PreallocatedProcessManagerImpl);
-
- void Init();
-
- void RereadPrefs();
- void Enable();
- void Disable();
-
- void ObserveProcessShutdown(nsISupports* aSubject);
-
- bool mEnabled;
- bool mShutdown;
- RefPtr mPreallocatedAppProcess;
-};
-
-/* static */ StaticRefPtr
-PreallocatedProcessManagerImpl::sSingleton;
-
-/* static */ PreallocatedProcessManagerImpl*
-PreallocatedProcessManagerImpl::Singleton()
-{
- if (!sSingleton) {
- sSingleton = new PreallocatedProcessManagerImpl();
- sSingleton->Init();
- ClearOnShutdown(&sSingleton);
- }
-
- return sSingleton;
-}
-
-NS_IMPL_ISUPPORTS(PreallocatedProcessManagerImpl, nsIObserver)
-
-PreallocatedProcessManagerImpl::PreallocatedProcessManagerImpl()
- :
- mEnabled(false)
- , mShutdown(false)
-{}
-
-void
-PreallocatedProcessManagerImpl::Init()
-{
- Preferences::AddStrongObserver(this, "dom.ipc.processPrelaunch.enabled");
- nsCOMPtr os = services::GetObserverService();
- if (os) {
- os->AddObserver(this, "ipc:content-shutdown",
- /* weakRef = */ false);
- os->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID,
- /* weakRef = */ false);
- }
- {
- RereadPrefs();
- }
-}
-
-NS_IMETHODIMP
-PreallocatedProcessManagerImpl::Observe(nsISupports* aSubject,
- const char* aTopic,
- const char16_t* aData)
-{
- if (!strcmp("ipc:content-shutdown", aTopic)) {
- ObserveProcessShutdown(aSubject);
- } else if (!strcmp("nsPref:changed", aTopic)) {
- // The only other observer we registered was for our prefs.
- RereadPrefs();
- } else if (!strcmp(NS_XPCOM_SHUTDOWN_OBSERVER_ID, aTopic)) {
- mShutdown = true;
- } else {
- MOZ_ASSERT(false);
- }
-
- return NS_OK;
-}
-
-void
-PreallocatedProcessManagerImpl::RereadPrefs()
-{
- if (Preferences::GetBool("dom.ipc.processPrelaunch.enabled")) {
- Enable();
- } else {
- Disable();
- }
-}
-
-already_AddRefed
-PreallocatedProcessManagerImpl::Take()
-{
- return mPreallocatedAppProcess.forget();
-}
-
-void
-PreallocatedProcessManagerImpl::Enable()
-{
- if (mEnabled) {
- return;
- }
-
- mEnabled = true;
- AllocateAfterDelay();
-}
-
-void
-PreallocatedProcessManagerImpl::AllocateAfterDelay()
-{
- if (!mEnabled || mPreallocatedAppProcess) {
- return;
- }
-
- MessageLoop::current()->PostDelayedTask(
- NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateOnIdle),
- Preferences::GetUint("dom.ipc.processPrelaunch.delayMs",
- DEFAULT_ALLOCATE_DELAY));
-}
-
-void
-PreallocatedProcessManagerImpl::AllocateOnIdle()
-{
- if (!mEnabled || mPreallocatedAppProcess) {
- return;
- }
-
- MessageLoop::current()->PostIdleTask(NewRunnableMethod(this, &PreallocatedProcessManagerImpl::AllocateNow));
-}
-
-void
-PreallocatedProcessManagerImpl::AllocateNow()
-{
- if (!mEnabled || mPreallocatedAppProcess) {
- return;
- }
-
- mPreallocatedAppProcess = ContentParent::PreallocateAppProcess();
-}
-
-void
-PreallocatedProcessManagerImpl::Disable()
-{
- if (!mEnabled) {
- return;
- }
-
- mEnabled = false;
-
- if (mPreallocatedAppProcess) {
- mPreallocatedAppProcess->Close();
- mPreallocatedAppProcess = nullptr;
- }
-}
-
-void
-PreallocatedProcessManagerImpl::ObserveProcessShutdown(nsISupports* aSubject)
-{
- if (!mPreallocatedAppProcess) {
- return;
- }
-
- nsCOMPtr props = do_QueryInterface(aSubject);
- NS_ENSURE_TRUE_VOID(props);
-
- uint64_t childID = CONTENT_PROCESS_ID_UNKNOWN;
- props->GetPropertyAsUint64(NS_LITERAL_STRING("childID"), &childID);
- NS_ENSURE_TRUE_VOID(childID != CONTENT_PROCESS_ID_UNKNOWN);
-
- if (childID == mPreallocatedAppProcess->ChildID()) {
- mPreallocatedAppProcess = nullptr;
- }
-}
-
-inline PreallocatedProcessManagerImpl* GetPPMImpl()
-{
- return PreallocatedProcessManagerImpl::Singleton();
-}
-
-} // namespace
-
-namespace mozilla {
-
-/* static */ void
-PreallocatedProcessManager::AllocateAfterDelay()
-{
- GetPPMImpl()->AllocateAfterDelay();
-}
-
-/* static */ void
-PreallocatedProcessManager::AllocateOnIdle()
-{
- GetPPMImpl()->AllocateOnIdle();
-}
-
-/* static */ void
-PreallocatedProcessManager::AllocateNow()
-{
- GetPPMImpl()->AllocateNow();
-}
-
-/* static */ already_AddRefed
-PreallocatedProcessManager::Take()
-{
- return GetPPMImpl()->Take();
-}
-
-} // namespace mozilla
diff --git a/dom/ipc/PreallocatedProcessManager.h b/dom/ipc/PreallocatedProcessManager.h
deleted file mode 100644
index 5945616272..0000000000
--- a/dom/ipc/PreallocatedProcessManager.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef mozilla_PreallocatedProcessManager_h
-#define mozilla_PreallocatedProcessManager_h
-
-#include "base/basictypes.h"
-#include "nsCOMPtr.h"
-#include "nsIObserver.h"
-
-namespace mozilla {
-namespace dom {
-class ContentParent;
-} // namespace dom
-
-/**
- * This class manages a ContentParent that it starts up ahead of any particular
- * need. You can then call Take() to get this process and use it. Since we
- * already started it up, it should be ready for use faster than if you'd
- * created the process when you needed it.
- *
- * This class watches the dom.ipc.processPrelaunch.enabled pref. If it changes
- * from false to true, it preallocates a process. If it changes from true to
- * false, it kills the preallocated process, if any.
- *
- * We don't expect this pref to flip between true and false in production, but
- * flipping the pref is important for tests.
- *
- * The static methods here are implemented by forwarding calls on to a
- * PreallocatedProcessManagerImpl singleton class, so if you add a new static
- * method here, you'll need to write a corresponding public method on the
- * singleton.
- */
-class PreallocatedProcessManager final
-{
- typedef mozilla::dom::ContentParent ContentParent;
-
-public:
- /**
- * Create a process after a delay. We wait for a period of time (specified
- * by the dom.ipc.processPrelaunch.delayMs pref), then wait for this process
- * to go idle, then allocate the new process.
- *
- * If the dom.ipc.processPrelaunch.enabled pref is false, or if we already
- * have a preallocated process, this function does nothing.
- */
- static void AllocateAfterDelay();
-
- /**
- * Create a process once this process goes idle.
- *
- * If the dom.ipc.processPrelaunch.enabled pref is false, or if we already
- * have a preallocated process, this function does nothing.
- */
- static void AllocateOnIdle();
-
- /**
- * Create a process right now.
- *
- * If the dom.ipc.processPrelaunch.enabled pref is false, or if we already
- * have a preallocated process, this function does nothing.
- */
- static void AllocateNow();
-
- /**
- * Take the preallocated process, if we have one. If we don't have one, this
- * returns null.
- *
- * If you call Take() twice in a row, the second call is guaranteed to return
- * null.
- *
- * After you Take() the preallocated process, you need to call one of the
- * Allocate* functions (or change the dom.ipc.processPrelaunch pref from
- * false to true) before we'll create a new process.
- */
- static already_AddRefed Take();
-
-private:
- PreallocatedProcessManager();
- DISALLOW_EVIL_CONSTRUCTORS(PreallocatedProcessManager);
-};
-
-} // namespace mozilla
-
-#endif // defined mozilla_PreallocatedProcessManager_h
diff --git a/dom/ipc/ProcessPriorityManager.cpp b/dom/ipc/ProcessPriorityManager.cpp
index 4470a7b156..07548f8ee2 100644
--- a/dom/ipc/ProcessPriorityManager.cpp
+++ b/dom/ipc/ProcessPriorityManager.cpp
@@ -300,7 +300,6 @@ public:
int32_t Pid() const;
uint64_t ChildID() const;
- bool IsPreallocated() const;
/**
* Used in logging, this method returns the ContentParent's name followed by
@@ -617,15 +616,12 @@ ProcessPriorityManagerImpl::NotifyProcessPriorityChanged(
ProcessPriority aOldPriority)
{
ProcessPriority newPriority = aParticularManager->CurrentPriority();
- bool isPreallocated = aParticularManager->IsPreallocated();
if (newPriority == PROCESS_PRIORITY_BACKGROUND &&
- aOldPriority != PROCESS_PRIORITY_BACKGROUND &&
- !isPreallocated) {
+ aOldPriority != PROCESS_PRIORITY_BACKGROUND) {
mBackgroundLRUPool.Add(aParticularManager);
} else if (newPriority != PROCESS_PRIORITY_BACKGROUND &&
- aOldPriority == PROCESS_PRIORITY_BACKGROUND &&
- !isPreallocated) {
+ aOldPriority == PROCESS_PRIORITY_BACKGROUND) {
mBackgroundLRUPool.Remove(aParticularManager);
}
@@ -808,12 +804,6 @@ ParticularProcessPriorityManager::Pid() const
return mContentParent ? mContentParent->Pid() : -1;
}
-bool
-ParticularProcessPriorityManager::IsPreallocated() const
-{
- return mContentParent ? mContentParent->IsPreallocated() : false;
-}
-
const nsAutoCString&
ParticularProcessPriorityManager::NameWithComma()
{
diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp
index cb853dcb94..b274345786 100644
--- a/dom/ipc/TabChild.cpp
+++ b/dom/ipc/TabChild.cpp
@@ -319,8 +319,6 @@ private:
};
namespace {
-StaticRefPtr sPreallocatedTab;
-
std::map>&
NestedTabChildMap()
{
@@ -341,91 +339,13 @@ TabChild::FindTabChild(const TabId& aTabId)
return tabChild.forget();
}
-static void
-PreloadSlowThingsPostFork(void* aUnused)
-{
- nsCOMPtr observerService =
- mozilla::services::GetObserverService();
- observerService->NotifyObservers(nullptr, "preload-postfork", nullptr);
-
- MOZ_ASSERT(sPreallocatedTab);
- // Initialize initial reflow of the PresShell has to happen after fork
- // because about:blank content viewer is created in the above observer
- // notification.
- nsCOMPtr docShell =
- do_GetInterface(sPreallocatedTab->WebNavigation());
- if (nsIPresShell* presShell = docShell->GetPresShell()) {
- // Initialize and do an initial reflow of the about:blank
- // PresShell to let it preload some things for us.
- presShell->Initialize(0, 0);
- nsIDocument* doc = presShell->GetDocument();
- doc->FlushPendingNotifications(Flush_Layout);
- // ... but after it's done, make sure it doesn't do any more
- // work.
- presShell->MakeZombie();
- }
-
-}
-
-static bool sPreloaded = false;
-
-/*static*/ void
-TabChild::PreloadSlowThings()
-{
- if (sPreloaded) {
- // If we are alredy initialized in Nuwa, don't redo preloading.
- return;
- }
- sPreloaded = true;
-
- // Pass nullptr to aManager since at this point the TabChild is
- // not connected to any manager. Any attempt to use the TabChild
- // in IPC will crash.
- RefPtr tab(new TabChild(nullptr,
- TabId(0),
- TabContext(), /* chromeFlags */ 0));
- if (!NS_SUCCEEDED(tab->Init()) ||
- !tab->InitTabChildGlobal(DONT_LOAD_SCRIPTS)) {
- return;
- }
-
- // Just load and compile these scripts, but don't run them.
- tab->TryCacheLoadAndCompileScript(BROWSER_ELEMENT_CHILD_SCRIPT, true);
- // Load, compile, and run these scripts.
- tab->RecvLoadRemoteScript(
- NS_LITERAL_STRING("chrome://global/content/preload.js"),
- true);
-
- sPreallocatedTab = tab;
- ClearOnShutdown(&sPreallocatedTab);
-
- PreloadSlowThingsPostFork(nullptr);
-}
-
/*static*/ already_AddRefed
TabChild::Create(nsIContentChild* aManager,
const TabId& aTabId,
const TabContext &aContext,
uint32_t aChromeFlags)
{
- if (sPreallocatedTab &&
- sPreallocatedTab->mChromeFlags == aChromeFlags &&
- aContext.IsMozBrowser()) {
-
- RefPtr child = sPreallocatedTab.get();
- sPreallocatedTab = nullptr;
-
- MOZ_ASSERT(!child->mTriedBrowserInit);
-
- child->mManager = aManager;
- child->SetTabId(aTabId);
- child->SetTabContext(aContext);
- child->NotifyTabContextUpdated(true);
- return child.forget();
- }
-
- RefPtr iframe = new TabChild(aManager, aTabId,
- aContext, aChromeFlags);
+ RefPtr iframe = new TabChild(aManager, aTabId, aContext, aChromeFlags);
return NS_SUCCEEDED(iframe->Init()) ? iframe.forget() : nullptr;
}
@@ -614,13 +534,6 @@ TabChild::DoUpdateZoomConstraints(const uint32_t& aPresShellId,
const ViewID& aViewId,
const Maybe& aConstraints)
{
- if (sPreallocatedTab == this) {
- // If we're the preallocated tab, bail out because doing IPC will crash.
- // Once we get used for something we'll get another zoom constraints update
- // and all will be well.
- return true;
- }
-
if (!mApzcTreeManager) {
return false;
}
@@ -2446,7 +2359,7 @@ TabChild::DeallocPRenderFrameChild(PRenderFrameChild* aFrame)
}
bool
-TabChild::InitTabChildGlobal(FrameScriptLoading aScriptLoading)
+TabChild::InitTabChildGlobal()
{
if (!mGlobal && !mTabChildGlobal) {
nsCOMPtr window = do_GetInterface(WebNavigation());
@@ -2470,7 +2383,7 @@ TabChild::InitTabChildGlobal(FrameScriptLoading aScriptLoading)
root->SetParentTarget(scope);
}
- if (aScriptLoading != DONT_LOAD_SCRIPTS && !mTriedBrowserInit) {
+ if (!mTriedBrowserInit) {
mTriedBrowserInit = true;
// Initialize the child side of the browser element machinery,
// if appropriate.
diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h
index 6282ac48a9..5a09047c5d 100644
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -278,13 +278,6 @@ public:
nsresult Init();
- /**
- * This is expected to be called off the critical path to content
- * startup. This is an opportunity to load things that are slow
- * on the critical path.
- */
- static void PreloadSlowThings();
-
/** Return a TabChild with the given attributes. */
static already_AddRefed
Create(nsIContentChild* aManager, const TabId& aTabId,
@@ -697,9 +690,7 @@ private:
void ActorDestroy(ActorDestroyReason why) override;
- enum FrameScriptLoading { DONT_LOAD_SCRIPTS, DEFAULT_LOAD_SCRIPTS };
-
- bool InitTabChildGlobal(FrameScriptLoading aScriptLoading = DEFAULT_LOAD_SCRIPTS);
+ bool InitTabChildGlobal();
bool InitRenderingState(const TextureFactoryIdentifier& aTextureFactoryIdentifier,
const uint64_t& aLayersId,
diff --git a/dom/ipc/jar.mn b/dom/ipc/jar.mn
index 86920f0742..30288ecce6 100644
--- a/dom/ipc/jar.mn
+++ b/dom/ipc/jar.mn
@@ -10,4 +10,3 @@ toolkit.jar:
content/global/BrowserElementCopyPaste.js (../browser-element/BrowserElementCopyPaste.js)
content/global/extensions.js (extensions.js)
content/global/manifestMessages.js (manifestMessages.js)
- content/global/preload.js (preload.js)
diff --git a/dom/ipc/moz.build b/dom/ipc/moz.build
index 5f6cdbf08b..0f64700967 100644
--- a/dom/ipc/moz.build
+++ b/dom/ipc/moz.build
@@ -37,7 +37,6 @@ EXPORTS.mozilla.dom += [
EXPORTS.mozilla += [
'AppProcessChecker.h',
- 'PreallocatedProcessManager.h',
'ProcessHangMonitor.h',
'ProcessHangMonitorIPC.h',
'ProcessPriorityManager.h',
@@ -55,7 +54,6 @@ UNIFIED_SOURCES += [
'nsIContentChild.cpp',
'nsIContentParent.cpp',
'PermissionMessageUtils.cpp',
- 'PreallocatedProcessManager.cpp',
'ProcessPriorityManager.cpp',
'ScreenManagerParent.cpp',
'StructuredCloneData.cpp',
diff --git a/dom/ipc/preload.js b/dom/ipc/preload.js
deleted file mode 100644
index e85189d8b7..0000000000
--- a/dom/ipc/preload.js
+++ /dev/null
@@ -1,129 +0,0 @@
-/* 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/. */
-
-// Preload some things, in an attempt to make app startup faster.
-//
-// This script is run when the preallocated process starts. It is injected as
-// a frame script.
-
-var BrowserElementIsPreloaded = true;
-
-var DoPreloadPostfork = function(aCallback) {
- Services.obs.addObserver({
- _callback: aCallback,
-
- observe: function() {
- this._callback();
- Services.obs.removeObserver(this, "preload-postfork");
- }
- }, "preload-postfork", false);
-};
-
-(function (global) {
- "use strict";
-
- let Cu = Components.utils;
- let Cc = Components.classes;
- let Ci = Components.interfaces;
-
- Cu.import("resource://gre/modules/AppsUtils.jsm");
- Cu.import("resource://gre/modules/BrowserElementPromptService.jsm");
- Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
- Cu.import("resource://gre/modules/FileUtils.jsm");
- Cu.import("resource://gre/modules/Geometry.jsm");
- Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
- Cu.import("resource://gre/modules/NetUtil.jsm");
- Cu.import("resource://gre/modules/Services.jsm");
- Cu.import("resource://gre/modules/SettingsDB.jsm");
- Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
- Cc["@mozilla.org/appshell/appShellService;1"].getService(Ci["nsIAppShellService"]);
- Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci["nsIWindowMediator"]);
- Cc["@mozilla.org/categorymanager;1"].getService(Ci["nsICategoryManager"]);
- Cc["@mozilla.org/childprocessmessagemanager;1"].getService(Ci["nsIMessageSender"]);
- Cc["@mozilla.org/consoleservice;1"].getService(Ci["nsIConsoleService"]);
- Cc["@mozilla.org/docshell/urifixup;1"].getService(Ci["nsIURIFixup"]);
- Cc["@mozilla.org/dom/dom-request-service;1"].getService(Ci["nsIDOMRequestService"]);
- Cc["@mozilla.org/embedcomp/prompt-service;1"].getService(Ci["nsIPromptService"]);
- Cc["@mozilla.org/embedcomp/window-watcher;1"].getService(Ci["nsIWindowWatcher"]);
- Cc["@mozilla.org/eventlistenerservice;1"].getService(Ci["nsIEventListenerService"]);
- Cc["@mozilla.org/focus-manager;1"].getService(Ci["nsIFocusManager"]);
- Cc["@mozilla.org/intl/nslocaleservice;1"].getService(Ci["nsILocaleService"]);
- Cc["@mozilla.org/intl/stringbundle;1"].getService(Ci["nsIStringBundleService"]);
- Cc["@mozilla.org/layout/content-policy;1"].getService(Ci["nsIContentPolicy"]);
- Cc["@mozilla.org/message-loop;1"].getService(Ci["nsIMessageLoop"]);
- Cc["@mozilla.org/moz/jssubscript-loader;1"].getService(Ci["mozIJSSubScriptLoader"]);
- Cc["@mozilla.org/network/application-cache-service;1"].getService(Ci["nsIApplicationCacheService"]);
- Cc["@mozilla.org/network/dns-service;1"].getService(Ci["nsIDNSService"]);
- Cc["@mozilla.org/network/effective-tld-service;1"].getService(Ci["nsIEffectiveTLDService"]);
- Cc["@mozilla.org/network/idn-service;1"].getService(Ci["nsIIDNService"]);
- Cc["@mozilla.org/network/io-service;1"].getService(Ci["nsIIOService2"]);
- Cc["@mozilla.org/network/mime-hdrparam;1"].getService(Ci["nsIMIMEHeaderParam"]);
- Cc["@mozilla.org/network/socket-transport-service;1"].getService(Ci["nsISocketTransportService"]);
- Cc["@mozilla.org/network/stream-transport-service;1"].getService(Ci["nsIStreamTransportService"]);
- Cc["@mozilla.org/network/url-parser;1?auth=maybe"].getService(Ci["nsIURLParser"]);
- Cc["@mozilla.org/network/url-parser;1?auth=no"].getService(Ci["nsIURLParser"]);
- Cc["@mozilla.org/network/url-parser;1?auth=yes"].getService(Ci["nsIURLParser"]);
- Cc["@mozilla.org/observer-service;1"].getService(Ci["nsIObserverService"]);
- Cc["@mozilla.org/preferences-service;1"].getService(Ci["nsIPrefBranch"]);
- Cc["@mozilla.org/scriptsecuritymanager;1"].getService(Ci["nsIScriptSecurityManager"]);
- Cc["@mozilla.org/storage/service;1"].getService(Ci["mozIStorageService"]);
- Cc["@mozilla.org/system-info;1"].getService(Ci["nsIPropertyBag2"]);
- Cc["@mozilla.org/thread-manager;1"].getService(Ci["nsIThreadManager"]);
- Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci["nsIAppStartup"]);
- Cc["@mozilla.org/uriloader;1"].getService(Ci["nsIURILoader"]);
- Cc["@mozilla.org/cspcontext;1"].createInstance(Ci["nsIContentSecurityPolicy"]);
- Cc["@mozilla.org/settingsManager;1"].createInstance(Ci["nsISupports"]);
-
- /* Applications Specific Helper */
- try {
- if (Services.prefs.getBoolPref("dom.sysmsg.enabled")) {
- Cc["@mozilla.org/system-message-manager;1"].getService(Ci["nsIDOMNavigatorSystemMessages"]);
- }
- } catch(e) {
- }
-
- try {
- if (Services.prefs.getBoolPref("dom.mozInputMethod.enabled")) {
- Services.scriptloader.loadSubScript("chrome://global/content/forms.js", global);
- }
- } catch (e) {
- }
-
- Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementCopyPaste.js", global);
- Services.scriptloader.loadSubScript("chrome://global/content/BrowserElementChildPreload.js", global);
-
- Services.io.getProtocolHandler("app");
- Services.io.getProtocolHandler("default");
-
- // Register an observer for topic "preload_postfork" after we fork a content
- // process.
- DoPreloadPostfork(function () {
- // Load AppsServiceChild.jsm after fork since it sends an async message to
- // the chrome process in its init() function.
- Cu.import("resource://gre/modules/AppsServiceChild.jsm");
-
- // Load nsIAppsService after fork since its implementation loads
- // AppsServiceChild.jsm
- Cc["@mozilla.org/AppsService;1"].getService(Ci["nsIAppsService"]);
-
- // Load nsICookieService after fork since it sends an IPC constructor
- // message to the chrome process.
- Cc["@mozilla.org/cookieService;1"].getService(Ci["nsICookieService"]);
-
- // Load nsIPermissionManager after fork since it sends a message to the
- // chrome process to read permissions.
- Cc["@mozilla.org/permissionmanager;1"].getService(Ci["nsIPermissionManager"]);
-
- // Load nsIProtocolProxyService after fork since it asynchronously accesses
- // the "Proxy Resolution" thread after it's frozen.
- Cc["@mozilla.org/network/protocol-proxy-service;1"].getService(Ci["nsIProtocolProxyService"]);
-
- // Call docShell.createAboutBlankContentViewer() after fork since it has IPC
- // activity in the PCompositor protocol.
- docShell.createAboutBlankContentViewer(null);
- docShell.isActive = false;
- });
-})(this);
-
diff --git a/extensions/cookie/nsPermissionManager.cpp b/extensions/cookie/nsPermissionManager.cpp
index aa2d6d47ac..426cd79486 100644
--- a/extensions/cookie/nsPermissionManager.cpp
+++ b/extensions/cookie/nsPermissionManager.cpp
@@ -1530,12 +1530,6 @@ nsPermissionManager::AddInternal(nsIPrincipal* aPrincipal,
ContentParent::GetAll(cplist);
for (uint32_t i = 0; i < cplist.Length(); ++i) {
ContentParent* cp = cplist[i];
- // On platforms where we use a preallocated template process we don't
- // want to notify this process about session specific permissions so
- // new tabs or apps created on it won't inherit the session permissions.
- if (cp->IsPreallocated() &&
- aExpireType == nsIPermissionManager::EXPIRE_SESSION)
- continue;
if (cp->NeedsPermissionsUpdate())
Unused << cp->SendAddPermission(permission);
}
diff --git a/hal/Hal.cpp b/hal/Hal.cpp
index 88c1fa50bb..4baf617217 100644
--- a/hal/Hal.cpp
+++ b/hal/Hal.cpp
@@ -684,8 +684,6 @@ ProcessPriorityToString(ProcessPriority aPriority)
switch (aPriority) {
case PROCESS_PRIORITY_MASTER:
return "MASTER";
- case PROCESS_PRIORITY_PREALLOC:
- return "PREALLOC";
case PROCESS_PRIORITY_FOREGROUND_HIGH:
return "FOREGROUND_HIGH";
case PROCESS_PRIORITY_FOREGROUND:
diff --git a/hal/HalTypes.h b/hal/HalTypes.h
index dc29f0553b..99d295f3f5 100644
--- a/hal/HalTypes.h
+++ b/hal/HalTypes.h
@@ -40,9 +40,6 @@ enum ProcessPriority {
PROCESS_PRIORITY_BACKGROUND,
PROCESS_PRIORITY_BACKGROUND_PERCEIVABLE,
PROCESS_PRIORITY_FOREGROUND_KEYBOARD,
- // The special class for the preallocated process, high memory priority but
- // low CPU priority.
- PROCESS_PRIORITY_PREALLOC,
// Any priority greater than or equal to FOREGROUND is considered
// "foreground" for the purposes of priority testing, for example
// CurrentProcessIsForeground().
diff --git a/layout/base/nsIPresShell.h b/layout/base/nsIPresShell.h
index 5ae95d5825..248a7a4e67 100644
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -201,18 +201,6 @@ public:
bool IsDestroying() { return mIsDestroying; }
- /**
- * Make a one-way transition into a "zombie" state. In this state,
- * no reflow is done, no painting is done, and no refresh driver
- * ticks are processed. This is a dangerous state: it can leave
- * areas of the composition target unpainted if callers aren't
- * careful. (Don't let your zombie presshell out of the shed.)
- *
- * This is used in cases where a presshell is created for reasons
- * other than reflow/painting.
- */
- virtual void MakeZombie() = 0;
-
/**
* All frames owned by the shell are allocated from an arena. They
* are also recycled using free lists. Separate free lists are
@@ -1784,7 +1772,6 @@ protected:
bool mStylesHaveChanged : 1;
bool mDidInitialize : 1;
bool mIsDestroying : 1;
- bool mIsZombie : 1;
bool mIsReflowing : 1;
// For all documents we initially lock down painting.
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp
index 015dbcc078..f27ad60407 100644
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -1319,13 +1319,6 @@ PresShell::Destroy()
mTouchManager.Destroy();
}
-void
-PresShell::MakeZombie()
-{
- mIsZombie = true;
- CancelAllPendingReflows();
-}
-
nsRefreshDriver*
nsIPresShell::GetRefreshDriver() const
{
@@ -3959,10 +3952,6 @@ PresShell::FlushPendingNotifications(mozFlushType aType)
void
PresShell::FlushPendingNotifications(mozilla::ChangesToFlush aFlush)
{
- if (mIsZombie) {
- return;
- }
-
/**
* VERY IMPORTANT: If you add some sort of new flushing to this
* method, make sure to add the relevant SetNeedLayoutFlush or
@@ -6170,7 +6159,7 @@ PresShell::Paint(nsView* aViewToPaint,
MOZ_ASSERT(!mApproximateFrameVisibilityVisited, "Should have been cleared");
- if (!mIsActive || mIsZombie) {
+ if (!mIsActive) {
return;
}
@@ -9024,10 +9013,6 @@ PresShell::ScheduleReflowOffTimer()
bool
PresShell::DoReflow(nsIFrame* target, bool aInterruptible)
{
- if (mIsZombie) {
- return true;
- }
-
gfxTextPerfMetrics* tp = mPresContext->GetTextPerfMetrics();
TimeStamp timeStart;
if (tp) {
diff --git a/layout/base/nsPresShell.h b/layout/base/nsPresShell.h
index f47711253c..54ef6a3d96 100644
--- a/layout/base/nsPresShell.h
+++ b/layout/base/nsPresShell.h
@@ -102,7 +102,6 @@ public:
void Init(nsIDocument* aDocument, nsPresContext* aPresContext,
nsViewManager* aViewManager, nsStyleSet* aStyleSet);
virtual void Destroy() override;
- virtual void MakeZombie() override;
virtual void UpdatePreferenceStyles() override;
diff --git a/modules/libpref/test/unit_ipc/test_user_default_prefs.js b/modules/libpref/test/unit_ipc/test_user_default_prefs.js
index 3b8ca28c66..c39cae4d45 100644
--- a/modules/libpref/test/unit_ipc/test_user_default_prefs.js
+++ b/modules/libpref/test/unit_ipc/test_user_default_prefs.js
@@ -27,12 +27,6 @@ function run_test() {
// We finish in clean_up()
do_test_pending();
- try {
- if (pb.getCharPref('dom.ipc.processPrelaunch.enabled')) {
- dump('WARNING: Content process may already have launched, so this test may not be meaningful.');
- }
- } catch(e) { }
-
initialValue = pb.getCharPref(kPrefName);
test_user_setting();
@@ -73,4 +67,4 @@ function clean_up() {
check_child_pref_info_eq(function () {
do_test_finished();
});
-}
\ No newline at end of file
+}