зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1570369 - Part 1: Use IPDL refcounted for PWindowGlobal, r=farre
Differential Revision: https://phabricator.services.mozilla.com/D40252 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
ac145a8bd1
Коммит
57067bd337
|
@ -86,9 +86,8 @@ nsresult BrowserBridgeParent::Init(const nsString& aPresentationURL,
|
|||
auto windowParent =
|
||||
MakeRefPtr<WindowGlobalParent>(aWindowInit, /* inprocess */ false);
|
||||
|
||||
// DeallocPWindowGlobalParent releases the ref taken.
|
||||
ManagedEndpoint<PWindowGlobalChild> windowChildEp =
|
||||
browserParent->OpenPWindowGlobalEndpoint(do_AddRef(windowParent).take());
|
||||
browserParent->OpenPWindowGlobalEndpoint(windowParent);
|
||||
if (NS_WARN_IF(!windowChildEp.IsValid())) {
|
||||
MOZ_ASSERT(false, "WindowGlobal Open Endpoint Failed");
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -3290,18 +3290,6 @@ bool BrowserChild::DeallocPPaymentRequestChild(PPaymentRequestChild* actor) {
|
|||
return true;
|
||||
}
|
||||
|
||||
PWindowGlobalChild* BrowserChild::AllocPWindowGlobalChild(
|
||||
const WindowGlobalInit&) {
|
||||
MOZ_CRASH("We should never be manually allocating PWindowGlobalChild actors");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool BrowserChild::DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) {
|
||||
// This reference was added in WindowGlobalChild::Create.
|
||||
static_cast<WindowGlobalChild*>(aActor)->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
ScreenIntSize BrowserChild::GetInnerSize() {
|
||||
LayoutDeviceIntSize innerSize =
|
||||
RoundedToInt(mUnscaledInnerSize * mPuppetWidget->GetDefaultScale());
|
||||
|
|
|
@ -660,10 +660,6 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
|||
protected:
|
||||
virtual ~BrowserChild();
|
||||
|
||||
PWindowGlobalChild* AllocPWindowGlobalChild(const WindowGlobalInit& aInit);
|
||||
|
||||
bool DeallocPWindowGlobalChild(PWindowGlobalChild* aActor);
|
||||
|
||||
mozilla::ipc::IPCResult RecvDestroy();
|
||||
|
||||
mozilla::ipc::IPCResult RecvSetDocShellIsActive(const bool& aIsActive);
|
||||
|
|
|
@ -1242,18 +1242,11 @@ IPCResult BrowserParent::RecvNewWindowGlobal(
|
|||
// Construct our new WindowGlobalParent, bind, and initialize it.
|
||||
auto wgp = MakeRefPtr<WindowGlobalParent>(aInit, /* inproc */ false);
|
||||
|
||||
// Reference freed in DeallocPWindowGlobalParent.
|
||||
BindPWindowGlobalEndpoint(std::move(aEndpoint), do_AddRef(wgp).take());
|
||||
BindPWindowGlobalEndpoint(std::move(aEndpoint), wgp);
|
||||
wgp->Init(aInit);
|
||||
return IPC_OK();
|
||||
}
|
||||
|
||||
bool BrowserParent::DeallocPWindowGlobalParent(PWindowGlobalParent* aActor) {
|
||||
// Free reference from RecvNewWindowGlobal.
|
||||
static_cast<WindowGlobalParent*>(aActor)->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
IPCResult BrowserParent::RecvPBrowserBridgeConstructor(
|
||||
PBrowserBridgeParent* aActor, const nsString& aName,
|
||||
const nsString& aRemoteType, BrowsingContext* aBrowsingContext,
|
||||
|
|
|
@ -473,8 +473,6 @@ class BrowserParent final : public PBrowserParent,
|
|||
const uint64_t& aParentID, const uint32_t& aMsaaID,
|
||||
const IAccessibleHolder& aDocCOMProxy) override;
|
||||
|
||||
bool DeallocPWindowGlobalParent(PWindowGlobalParent* aActor);
|
||||
|
||||
mozilla::ipc::IPCResult RecvNewWindowGlobal(
|
||||
ManagedEndpoint<PWindowGlobalParent>&& aEndpoint,
|
||||
const WindowGlobalInit& aInit);
|
||||
|
|
|
@ -1019,9 +1019,8 @@ nsresult ContentChild::ProvideWindowCommon(
|
|||
}
|
||||
|
||||
// Open a remote endpoint for our PWindowGlobal actor.
|
||||
// DeallocPWindowGlobalChild releases the ref taken.
|
||||
ManagedEndpoint<PWindowGlobalParent> windowParentEp =
|
||||
newChild->OpenPWindowGlobalEndpoint(do_AddRef(windowChild).take());
|
||||
newChild->OpenPWindowGlobalEndpoint(windowChild);
|
||||
if (NS_WARN_IF(!windowParentEp.IsValid())) {
|
||||
return NS_ERROR_ABORT;
|
||||
}
|
||||
|
@ -1881,9 +1880,8 @@ mozilla::ipc::IPCResult ContentChild::RecvConstructBrowser(
|
|||
return IPC_FAIL(this, "BindPBrowserEndpoint failed");
|
||||
}
|
||||
|
||||
// The ref here is released in DeallocPWindowGlobalChild.
|
||||
if (NS_WARN_IF(!browserChild->BindPWindowGlobalEndpoint(
|
||||
std::move(aWindowEp), do_AddRef(windowChild).take()))) {
|
||||
if (NS_WARN_IF(!browserChild->BindPWindowGlobalEndpoint(std::move(aWindowEp),
|
||||
windowChild))) {
|
||||
return IPC_FAIL(this, "BindPWindowGlobalEndpoint failed");
|
||||
}
|
||||
windowChild->Init();
|
||||
|
|
|
@ -1222,9 +1222,8 @@ already_AddRefed<RemoteBrowser> ContentParent::CreateBrowser(
|
|||
MakeRefPtr<WindowGlobalParent>(windowInit, /* inprocess */ false);
|
||||
|
||||
// Open a remote endpoint for the initial PWindowGlobal actor.
|
||||
// DeallocPWindowGlobalParent releases the ref taken.
|
||||
ManagedEndpoint<PWindowGlobalChild> windowEp =
|
||||
browserParent->OpenPWindowGlobalEndpoint(do_AddRef(windowParent).take());
|
||||
browserParent->OpenPWindowGlobalEndpoint(windowParent);
|
||||
if (NS_WARN_IF(!windowEp.IsValid())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -3365,9 +3364,8 @@ mozilla::ipc::IPCResult ContentParent::RecvConstructPopupBrowser(
|
|||
}
|
||||
}
|
||||
|
||||
// The ref here is released in DeallocPWindowGlobalParent.
|
||||
if (NS_WARN_IF(!parent->BindPWindowGlobalEndpoint(
|
||||
std::move(aWindowEp), do_AddRef(initialWindow).take()))) {
|
||||
if (NS_WARN_IF(!parent->BindPWindowGlobalEndpoint(std::move(aWindowEp),
|
||||
initialWindow))) {
|
||||
return IPC_FAIL(this, "BindPWindowGlobalEndpoint failed");
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ struct JSWindowActorMessageMeta {
|
|||
* link either between the chrome/content process, or will be in-process, for
|
||||
* documents which are loaded in the chrome process.
|
||||
*/
|
||||
async protocol PWindowGlobal
|
||||
async refcounted protocol PWindowGlobal
|
||||
{
|
||||
manager PBrowser or PInProcess;
|
||||
|
||||
|
|
|
@ -101,22 +101,20 @@ already_AddRefed<WindowGlobalChild> WindowGlobalChild::Create(
|
|||
|
||||
// Note: ref is released in DeallocPWindowGlobalChild
|
||||
ManagedEndpoint<PWindowGlobalParent> endpoint =
|
||||
ipChild->OpenPWindowGlobalEndpoint(do_AddRef(wgc).take());
|
||||
ipChild->OpenPWindowGlobalEndpoint(wgc);
|
||||
|
||||
auto wgp = MakeRefPtr<WindowGlobalParent>(init, /* aInProcess */ true);
|
||||
|
||||
// Note: ref is released in DeallocPWindowGlobalParent
|
||||
ipParent->BindPWindowGlobalEndpoint(std::move(endpoint),
|
||||
do_AddRef(wgp).take());
|
||||
ipParent->BindPWindowGlobalEndpoint(std::move(endpoint), wgp);
|
||||
wgp->Init(init);
|
||||
} else {
|
||||
RefPtr<BrowserChild> browserChild =
|
||||
BrowserChild::GetFrom(static_cast<mozIDOMWindow*>(aWindow));
|
||||
MOZ_ASSERT(browserChild);
|
||||
|
||||
// Note: ref is released in DeallocPWindowGlobalChild
|
||||
ManagedEndpoint<PWindowGlobalParent> endpoint =
|
||||
browserChild->OpenPWindowGlobalEndpoint(do_AddRef(wgc).take());
|
||||
browserChild->OpenPWindowGlobalEndpoint(wgc);
|
||||
|
||||
browserChild->SendNewWindowGlobal(std::move(endpoint), init);
|
||||
}
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/ipc/InProcessChild.h"
|
||||
#include "mozilla/dom/WindowGlobalChild.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
bool InProcessChild::DeallocPWindowGlobalChild(PWindowGlobalChild* aActor) {
|
||||
// Free IPC-held reference
|
||||
static_cast<WindowGlobalChild*>(aActor)->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
|
@ -43,9 +43,6 @@ class InProcessChild : public PInProcessChild {
|
|||
// |nullptr|.
|
||||
static IProtocol* ParentActorFor(IProtocol* aActor);
|
||||
|
||||
protected:
|
||||
bool DeallocPWindowGlobalChild(mozilla::dom::PWindowGlobalChild* aActor);
|
||||
|
||||
private:
|
||||
// NOTE: PInProcess lifecycle management is declared as staic methods and
|
||||
// state on InProcessParent, and implemented in InProcessImpl.cpp.
|
||||
|
|
|
@ -192,5 +192,7 @@ IProtocol* InProcessChild::ParentActorFor(IProtocol* aActor) {
|
|||
return GetOtherInProcessActor(aActor);
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(InProcessParent, nsIObserver)
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/ipc/InProcessParent.h"
|
||||
#include "mozilla/dom/WindowGlobalParent.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
namespace ipc {
|
||||
|
||||
NS_IMPL_ISUPPORTS(InProcessParent, nsIObserver)
|
||||
|
||||
bool InProcessParent::DeallocPWindowGlobalParent(PWindowGlobalParent* aActor) {
|
||||
// Free IPC-held reference.
|
||||
static_cast<WindowGlobalParent*>(aActor)->Release();
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace mozilla
|
|
@ -44,9 +44,6 @@ class InProcessParent : public nsIObserver, public PInProcessParent {
|
|||
// |nullptr|.
|
||||
static IProtocol* ChildActorFor(IProtocol* aActor);
|
||||
|
||||
protected:
|
||||
bool DeallocPWindowGlobalParent(mozilla::dom::PWindowGlobalParent* aActor);
|
||||
|
||||
private:
|
||||
// Lifecycle management is implemented in InProcessImpl.cpp
|
||||
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
|
||||
|
|
|
@ -148,9 +148,7 @@ UNIFIED_SOURCES += [
|
|||
'CrashReporterMetadataShmem.cpp',
|
||||
'FileDescriptor.cpp',
|
||||
'FileDescriptorUtils.cpp',
|
||||
'InProcessChild.cpp',
|
||||
'InProcessImpl.cpp',
|
||||
'InProcessParent.cpp',
|
||||
'InputStreamUtils.cpp',
|
||||
'IPCMessageUtils.cpp',
|
||||
'IPCStreamChild.cpp',
|
||||
|
|
Загрузка…
Ссылка в новой задаче