From 69298c893ad7a9f9d59e2ec9376a05858926e4b1 Mon Sep 17 00:00:00 2001 From: Justin Lebar Date: Tue, 30 Apr 2013 13:44:05 -0400 Subject: [PATCH] Bug 844323 - Part 2 (The Main Event): Move ProcesPriorityManager to the main process. r=bent,khuey --- content/base/public/nsIFrameLoader.idl | 18 +- content/base/src/nsFrameLoader.cpp | 27 + content/base/src/nsFrameLoader.h | 5 + content/canvas/src/WebGLContext.cpp | 6 +- dom/audiochannel/AudioChannelService.cpp | 31 +- dom/audiochannel/AudioChannelService.h | 11 +- .../BrowserElementChildPreload.js | 13 +- dom/browser-element/BrowserElementParent.jsm | 17 +- dom/ipc/ContentChild.cpp | 66 +- dom/ipc/ContentChild.h | 5 + dom/ipc/ContentParent.cpp | 129 +- dom/ipc/ContentParent.h | 34 +- dom/ipc/PBrowser.ipdl | 14 - dom/ipc/PContent.ipdl | 6 + dom/ipc/ProcessPriorityManager.cpp | 1198 ++++++++++------- dom/ipc/ProcessPriorityManager.h | 89 +- dom/ipc/TabChild.cpp | 8 - dom/ipc/TabChild.h | 11 - dom/ipc/TabParent.cpp | 39 +- dom/ipc/TabParent.h | 14 + layout/build/nsLayoutStatics.cpp | 2 +- 21 files changed, 1138 insertions(+), 605 deletions(-) diff --git a/content/base/public/nsIFrameLoader.idl b/content/base/public/nsIFrameLoader.idl index 59c15b178bfb..ae31ec2258f0 100644 --- a/content/base/public/nsIFrameLoader.idl +++ b/content/base/public/nsIFrameLoader.idl @@ -12,6 +12,7 @@ interface nsSubDocumentFrame; interface nsIMessageSender; interface nsIVariant; interface nsIDOMElement; +interface nsITabParent; typedef unsigned long long nsContentViewId; @@ -109,7 +110,7 @@ interface nsIContentViewManager : nsISupports readonly attribute nsIContentView rootContentView; }; -[scriptable, uuid(a4db652e-e3b0-4345-8107-cf6a30486759)] +[scriptable, builtinclass, uuid(e4333e51-f2fa-4fdd-becd-75d000703355)] interface nsIFrameLoader : nsISupports { /** @@ -117,6 +118,12 @@ interface nsIFrameLoader : nsISupports */ readonly attribute nsIDocShell docShell; + /** + * Get this frame loader's TabParent, if it has a remote frame. Otherwise, + * returns null. + */ + readonly attribute nsITabParent tabParent; + /** * Start loading the frame. This method figures out what to load * from the owner content in the frame loader. @@ -248,6 +255,15 @@ interface nsIFrameLoader : nsISupports * returns the iframe element. */ readonly attribute nsIDOMElement ownerElement; + + /** + * Get or set this frame loader's visibility. + * + * The notion of "visibility" here is separate from the notion of a + * window/docshell's visibility. This field is mostly here so that we can + * have a notion of visibility in the parent process when frames are OOP. + */ + [infallible] attribute boolean visible; }; native alreadyAddRefed_nsFrameLoader(already_AddRefed); diff --git a/content/base/src/nsFrameLoader.cpp b/content/base/src/nsFrameLoader.cpp index dc8204f5c61d..e66987bb1896 100644 --- a/content/base/src/nsFrameLoader.cpp +++ b/content/base/src/nsFrameLoader.cpp @@ -301,6 +301,7 @@ nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated) , mClampScrollPosition(true) , mRemoteBrowserInitialized(false) , mObservingOwnerContent(false) + , mVisible(true) , mCurrentRemoteFrame(nullptr) , mRemoteBrowser(nullptr) , mRenderMode(RENDER_MODE_DEFAULT) @@ -2583,3 +2584,29 @@ nsFrameLoader::ResetPermissionManagerStatus() } } +/* [infallible] */ NS_IMETHODIMP +nsFrameLoader::SetVisible(bool aVisible) +{ + mVisible = aVisible; + nsCOMPtr os = services::GetObserverService(); + if (os) { + os->NotifyObservers(NS_ISUPPORTS_CAST(nsIFrameLoader*, this), + "frameloader-visible-changed", nullptr); + } + return NS_OK; +} + +/* [infallible] */ NS_IMETHODIMP +nsFrameLoader::GetVisible(bool* aVisible) +{ + *aVisible = mVisible; + return NS_OK; +} + +NS_IMETHODIMP +nsFrameLoader::GetTabParent(nsITabParent** aTabParent) +{ + nsCOMPtr tp = mRemoteBrowser; + tp.forget(aTabParent); + return NS_OK; +} diff --git a/content/base/src/nsFrameLoader.h b/content/base/src/nsFrameLoader.h index 1136a7a8f8e6..6d4656115d5e 100644 --- a/content/base/src/nsFrameLoader.h +++ b/content/base/src/nsFrameLoader.h @@ -428,6 +428,11 @@ private: bool mRemoteBrowserInitialized : 1; bool mObservingOwnerContent : 1; + // Backs nsIFrameLoader::{Get,Set}Visible. Visibility state here relates to + // whether this frameloader's