Merge remote-tracking branch 'origin/tracking' into custom

This commit is contained in:
roytam1 2024-11-21 21:09:29 +08:00
commit 310c05b97a
177 changed files with 514 additions and 4888 deletions

View file

@ -114,8 +114,6 @@ public:
*/
static void JoinAllSubprocesses();
static bool PreallocatedProcessReady();
/**
* Get or create a content process for:
* 1. browser iframe
@ -129,21 +127,16 @@ public:
ContentParent* aOpener = nullptr,
bool aLargeAllocationProcess = false);
/**
* Create a subprocess suitable for use as a preallocated app process.
*/
static already_AddRefed<ContentParent> PreallocateAppProcess();
/**
* Get or create a content process for the given TabContext. aFrameElement
* should be the frame/iframe element with which this process will
* associated.
*/
static TabParent*
CreateBrowserOrApp(const TabContext& aContext,
Element* aFrameElement,
ContentParent* aOpenerContentParent,
bool aFreshProcess = false);
CreateBrowser(const TabContext& aContext,
Element* aFrameElement,
ContentParent* aOpenerContentParent,
bool aFreshProcess = false);
static void GetAll(nsTArray<ContentParent*>& aArray);
@ -231,7 +224,6 @@ public:
const hal::ProcessPriority& aPriority,
const TabId& aOpenerTabId,
ContentParentId* aCpId,
bool* aIsForApp,
bool* aIsForBrowser,
TabId* aTabId) override;
@ -320,8 +312,6 @@ public:
bool IsAlive() const;
virtual bool IsForApp() const override;
virtual bool IsForBrowser() const override
{
return mIsForBrowser;
@ -354,10 +344,6 @@ public:
ContentParentId ChildID() const override { return mChildID; }
const nsString& AppManifestURL() const { return mAppManifestURL; }
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,
@ -543,8 +529,7 @@ protected:
void OnCompositorUnexpectedShutdown() override;
private:
static nsDataHashtable<nsStringHashKey, ContentParent*> *sAppContentParents;
static nsTArray<ContentParent*>* sNonAppContentParents;
static nsTArray<ContentParent*>* sBrowserContentParents;
static nsTArray<ContentParent*>* sLargeAllocationContentParents;
static nsTArray<ContentParent*>* sPrivateContent;
static StaticAutoPtr<LinkedList<ContentParent> > sContentParents;
@ -552,15 +537,6 @@ private:
static void JoinProcessesIOThread(const nsTArray<ContentParent*>* aProcesses,
Monitor* aMonitor, bool* aDone);
// Take the preallocated process and transform it into a "real" app process,
// for the specified manifest URL. If there is no preallocated process (or
// if it's dead), create a new one and set aTookPreAllocated to false.
static already_AddRefed<ContentParent>
GetNewOrPreallocatedAppProcess(mozIApplication* aApp,
hal::ProcessPriority aInitialPriority,
ContentParent* aOpener,
/*out*/ bool* aTookPreAllocated = nullptr);
static hal::ProcessPriority GetInitialProcessPriority(Element* aFrameElement);
static ContentBridgeParent* CreateContentBridgeParent(const TabContext& aContext,
@ -576,18 +552,13 @@ private:
const IPCTabContext& context,
const uint32_t& chromeFlags,
const ContentParentId& aCpId,
const bool& aIsForApp,
const bool& aIsForBrowser) override;
using PContentParent::SendPTestShellConstructor;
FORWARD_SHMEM_ALLOCATOR_TO(PContentParent)
// No more than one of !!aApp, aIsForBrowser, and aIsForPreallocated may be
// true.
ContentParent(mozIApplication* aApp,
ContentParent* aOpener,
bool aIsForBrowser,
bool aIsForPreallocated);
ContentParent(ContentParent* aOpener,
bool aIsForBrowser);
// The common initialization for the constructors.
void InitializeMembers();
@ -607,7 +578,7 @@ private:
// Some information could be sent to content very early, it
// should be send from this function. This function should only be
// called after the process has been transformed to app or browser.
// called after the process has been transformed to browser.
void ForwardKnownInfo();
// Set the child process's priority and then check whether the child is
@ -616,15 +587,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 "real" app
// process, for the specified manifest URL.
void TransformPreallocatedIntoApp(ContentParent* aOpener,
const nsAString& aAppManifestURL);
// 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.
@ -683,7 +645,6 @@ private:
ProcessId aOtherProcess) override;
virtual bool RecvGetProcessAttributes(ContentParentId* aCpId,
bool* aIsForApp,
bool* aIsForBrowser) override;
virtual bool
@ -708,7 +669,6 @@ private:
const IPCTabContext& aContext,
const uint32_t& aChromeFlags,
const ContentParentId& aCpId,
const bool& aIsForApp,
const bool& aIsForBrowser) override;
virtual bool DeallocPBrowserParent(PBrowserParent* frame) override;
@ -907,8 +867,6 @@ private:
virtual bool RecvPrivateDocShellsExist(const bool& aExist) override;
virtual bool RecvFirstIdle() override;
virtual bool RecvAudioChannelChangeDefVolChannel(const int32_t& aChannel,
const bool& aHidden) override;
@ -1044,17 +1002,8 @@ private:
ContentParentId mChildID;
int32_t mGeolocationWatchID;
nsString mAppManifestURL;
nsCString mKillHardAnnotation;
/**
* We cache mAppName instead of looking it up using mAppManifestURL when we
* need it because it turns out that getting an app from the apps service is
* expensive.
*/
nsString mAppName;
// After we initiate shutdown, we also start a timer to ensure
// that even content processes that are 100% blocked (say from
// SIGSTOP), are still killed eventually. This task enforces that
@ -1070,7 +1019,7 @@ private:
// through.
bool mIsAlive;
// True only the if process is already a browser or app or has
// True only the if process is already a browser or has
// been transformed into one.
bool mMetamorphosed;