mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1525720, part 16 - Cycle collect RemoteBrowser and support weak references in BrowserHost. r=nika
BrowserParent is cycle collected and supported weak references, so this commit adds support for these things to BrowserHost. Differential Revision: https://phabricator.services.mozilla.com/D31448 --HG-- extra : source : e65cb2d4c5a55e3049922df02af643337b7a58b2
This commit is contained in:
parent
7073efe48d
commit
8768003b13
@ -157,7 +157,7 @@ typedef ScrollableLayerGuid::ViewID ViewID;
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(nsFrameLoader, mBrowsingContext,
|
||||
mMessageManager, mChildMessageManager,
|
||||
mParentSHistory)
|
||||
mParentSHistory, mRemoteBrowser)
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameLoader)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
|
||||
|
||||
|
@ -9,6 +9,15 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserBridgeHost)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(BrowserBridgeHost)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(BrowserBridgeHost)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(BrowserBridgeHost)
|
||||
|
||||
BrowserBridgeHost::BrowserBridgeHost(BrowserBridgeChild* aChild)
|
||||
: mBridge(aChild) {}
|
||||
|
||||
|
@ -28,7 +28,8 @@ class BrowserBridgeHost : public RemoteBrowser {
|
||||
|
||||
explicit BrowserBridgeHost(BrowserBridgeChild* aChild);
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(BrowserBridgeHost, override);
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(BrowserBridgeHost)
|
||||
|
||||
// Get the IPDL actor for the BrowserBridgeChild.
|
||||
BrowserBridgeChild* GetActor() { return mBridge; }
|
||||
|
@ -12,7 +12,16 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS(BrowserHost, nsIRemoteTab)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserHost)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRemoteTab)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, RemoteBrowser)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(BrowserHost, mRoot)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(BrowserHost)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(BrowserHost)
|
||||
|
||||
BrowserHost::BrowserHost(BrowserParent* aParent) : mRoot(aParent) {
|
||||
mRoot->SetBrowserHost(this);
|
||||
|
@ -32,7 +32,9 @@ class Element;
|
||||
* See `dom/docs/Fission-IPC-Diagram.svg` for an overview of the DOM IPC
|
||||
* actors.
|
||||
*/
|
||||
class BrowserHost : public RemoteBrowser, public nsIRemoteTab {
|
||||
class BrowserHost : public RemoteBrowser,
|
||||
public nsIRemoteTab,
|
||||
public nsSupportsWeakReference {
|
||||
public:
|
||||
typedef mozilla::layers::LayersId LayersId;
|
||||
|
||||
@ -40,10 +42,13 @@ class BrowserHost : public RemoteBrowser, public nsIRemoteTab {
|
||||
|
||||
static BrowserHost* GetFrom(nsIRemoteTab* aRemoteTab);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
// NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
// nsIRemoteTab
|
||||
NS_DECL_NSIREMOTETAB
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(BrowserHost, RemoteBrowser)
|
||||
|
||||
// Get the IPDL actor for the root BrowserParent. This method should be
|
||||
// avoided and consumers migrated to use this class.
|
||||
BrowserParent* GetActor() { return mRoot; }
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mozilla/dom/ipc/IdType.h"
|
||||
#include "mozilla/layers/LayersTypes.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsRect.h"
|
||||
@ -33,10 +34,8 @@ class BrowserBridgeHost;
|
||||
* nsFrameLoader will use BrowserHost, and a content process nsFrameLoader will
|
||||
* use BrowserBridgeHost.
|
||||
*/
|
||||
class RemoteBrowser {
|
||||
class RemoteBrowser : public nsISupports {
|
||||
public:
|
||||
NS_INLINE_DECL_PURE_VIRTUAL_REFCOUNTING
|
||||
|
||||
typedef mozilla::layers::LayersId LayersId;
|
||||
|
||||
// Try to cast this RemoteBrowser to a BrowserHost, may return null
|
||||
|
Loading…
Reference in New Issue
Block a user