Bug 1534267 - Make BrowserBridgeParent* available via TabParent. r=rhunt

Differential Revision: https://phabricator.services.mozilla.com/D22972

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Henri Sivonen 2019-03-11 18:47:20 +00:00
Родитель a24b99a70f
Коммит 69686abca6
3 изменённых файлов: 27 добавлений и 4 удалений

Просмотреть файл

@ -17,7 +17,11 @@ namespace dom {
BrowserBridgeParent::BrowserBridgeParent() : mIPCOpen(false) {}
BrowserBridgeParent::~BrowserBridgeParent() {}
BrowserBridgeParent::~BrowserBridgeParent() {
if (mTabParent) {
mTabParent->mBrowserBridgeParent = nullptr;
}
}
nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
const nsString& aRemoteType) {
@ -53,7 +57,7 @@ nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
// Construct the TabParent object for our subframe.
uint32_t chromeFlags = 0;
RefPtr<TabParent> tabParent(
new TabParent(constructorSender, tabId, tabContext, chromeFlags));
new TabParent(constructorSender, tabId, tabContext, chromeFlags, this));
PBrowserParent* browser = constructorSender->SendPBrowserConstructor(
// DeallocPBrowserParent() releases this ref.

Просмотреть файл

@ -144,7 +144,8 @@ NS_IMPL_ISUPPORTS(TabParent, nsITabParent, nsIAuthPromptProvider,
nsISupportsWeakReference)
TabParent::TabParent(ContentParent* aManager, const TabId& aTabId,
const TabContext& aContext, uint32_t aChromeFlags)
const TabContext& aContext, uint32_t aChromeFlags,
BrowserBridgeParent* aBrowserBridgeParent)
: TabContext(aContext),
mFrameElement(nullptr),
mContentCache(*this),
@ -162,6 +163,7 @@ TabParent::TabParent(ContentParent* aManager, const TabId& aTabId,
mIsDestroyed(false),
mChromeFlags(aChromeFlags),
mDragValid(false),
mBrowserBridgeParent(aBrowserBridgeParent),
mTabId(aTabId),
mCreatingWindow(false),
mCursor(eCursorInvalid),
@ -2320,6 +2322,10 @@ RenderFrame* TabParent::GetRenderFrame() {
return &mRenderFrame;
}
BrowserBridgeParent* TabParent::GetBrowserBridgeParent() const {
return mBrowserBridgeParent;
}
mozilla::ipc::IPCResult TabParent::RecvRequestIMEToCommitComposition(
const bool& aCancel, bool* aIsCommitted, nsString* aCommittedString) {
nsCOMPtr<nsIWidget> widget = GetWidget();

Просмотреть файл

@ -72,6 +72,7 @@ class ClonedMessageData;
class ContentParent;
class Element;
class DataTransfer;
class BrowserBridgeParent;
namespace ipc {
class StructuredCloneData;
@ -88,6 +89,7 @@ class TabParent final : public PBrowserParent,
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
friend class PBrowserParent;
friend class BrowserBridgeParent; // for clearing mBrowserBridgeParent
virtual ~TabParent();
@ -101,7 +103,8 @@ class TabParent final : public PBrowserParent,
NS_DECL_NSIDOMEVENTLISTENER
TabParent(ContentParent* aManager, const TabId& aTabId,
const TabContext& aContext, uint32_t aChromeFlags);
const TabContext& aContext, uint32_t aChromeFlags,
BrowserBridgeParent* aBrowserBridgeParent = nullptr);
Element* GetOwnerElement() const { return mFrameElement; }
already_AddRefed<nsPIDOMWindowOuter> GetParentWindowOuter();
@ -570,6 +573,10 @@ class TabParent final : public PBrowserParent,
layout::RenderFrame* GetRenderFrame();
// Returns the BrowserBridgeParent if this TabParent is for an out-of-process
// iframe and nullptr otherwise.
BrowserBridgeParent* GetBrowserBridgeParent() const;
mozilla::ipc::IPCResult RecvEnsureLayersConnected(
CompositorOptions* aCompositorOptions);
@ -704,6 +711,12 @@ class TabParent final : public PBrowserParent,
// The root browsing context loaded in this TabParent.
RefPtr<CanonicalBrowsingContext> mBrowsingContext;
// Pointer back to BrowserBridgeParent if there is one associated with
// this TabParent. This is non-owning to avoid cycles and is managed
// by the BrowserBridgeParent instance, which has the strong reference
// to this TabParent.
BrowserBridgeParent* mBrowserBridgeParent;
TabId mTabId;
// When loading a new tab or window via window.open, the child is