зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 6 changesets (bug 1875528) for causing leakcheck failures. CLOSED TREE
Backed out changeset dcbbb7316940 (bug 1875528) Backed out changeset a5c0564f9761 (bug 1875528) Backed out changeset f3bc6e972f79 (bug 1875528) Backed out changeset 535378dd79b0 (bug 1875528) Backed out changeset 3cef14ed0f25 (bug 1875528) Backed out changeset f0941fdbbabb (bug 1875528)
This commit is contained in:
Родитель
dcf8ed8dd6
Коммит
5a48aa44db
|
@ -24,9 +24,7 @@ class AccShowEvent;
|
||||||
*/
|
*/
|
||||||
class DocAccessibleChild : public PDocAccessibleChild {
|
class DocAccessibleChild : public PDocAccessibleChild {
|
||||||
public:
|
public:
|
||||||
DocAccessibleChild(DocAccessible* aDoc,
|
DocAccessibleChild(DocAccessible* aDoc, IProtocol* aManager) : mDoc(aDoc) {
|
||||||
mozilla::ipc::IRefCountedProtocol* aManager)
|
|
||||||
: mDoc(aDoc) {
|
|
||||||
MOZ_COUNT_CTOR(DocAccessibleChild);
|
MOZ_COUNT_CTOR(DocAccessibleChild);
|
||||||
SetManager(aManager);
|
SetManager(aManager);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2150,23 +2150,18 @@ bool BrowserChild::DeallocPDocAccessibleChild(
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
RefPtr<VsyncMainChild> BrowserChild::GetVsyncChild() {
|
RefPtr<VsyncMainChild> BrowserChild::GetVsyncChild() {
|
||||||
// Initializing VsyncMainChild here turns on per-BrowserChild Vsync for a
|
// Initializing mVsyncChild here turns on per-BrowserChild Vsync for a
|
||||||
// given platform. Note: this only makes sense if nsWindow returns a
|
// given platform. Note: this only makes sense if nsWindow returns a
|
||||||
// window-specific VsyncSource.
|
// window-specific VsyncSource.
|
||||||
#if defined(MOZ_WAYLAND)
|
#if defined(MOZ_WAYLAND)
|
||||||
if (IsWaylandEnabled()) {
|
if (IsWaylandEnabled() && !mVsyncChild) {
|
||||||
if (auto* actor = static_cast<VsyncMainChild*>(
|
mVsyncChild = MakeRefPtr<VsyncMainChild>();
|
||||||
LoneManagedOrNullAsserts(ManagedPVsyncChild()))) {
|
if (!SendPVsyncConstructor(mVsyncChild)) {
|
||||||
return actor;
|
mVsyncChild = nullptr;
|
||||||
}
|
}
|
||||||
auto actor = MakeRefPtr<VsyncMainChild>();
|
|
||||||
if (!SendPVsyncConstructor(actor)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return actor;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return nullptr;
|
return mVsyncChild;
|
||||||
}
|
}
|
||||||
|
|
||||||
mozilla::ipc::IPCResult BrowserChild::RecvLoadRemoteScript(
|
mozilla::ipc::IPCResult BrowserChild::RecvLoadRemoteScript(
|
||||||
|
|
|
@ -748,6 +748,8 @@ class BrowserChild final : public nsMessageManagerScriptExecutor,
|
||||||
Maybe<bool> mLayersConnectRequested;
|
Maybe<bool> mLayersConnectRequested;
|
||||||
EffectsInfo mEffectsInfo;
|
EffectsInfo mEffectsInfo;
|
||||||
|
|
||||||
|
RefPtr<VsyncMainChild> mVsyncChild;
|
||||||
|
|
||||||
RefPtr<APZEventState> mAPZEventState;
|
RefPtr<APZEventState> mAPZEventState;
|
||||||
|
|
||||||
// Position of client area relative to the outer window
|
// Position of client area relative to the outer window
|
||||||
|
|
|
@ -265,22 +265,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(BrowserParent)
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventListener)
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMEventListener)
|
||||||
NS_INTERFACE_MAP_END
|
NS_INTERFACE_MAP_END
|
||||||
|
NS_IMPL_CYCLE_COLLECTION_WEAK(BrowserParent, mFrameLoader, mBrowsingContext)
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(BrowserParent)
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(BrowserParent)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mFrameLoader)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mBrowsingContext)
|
|
||||||
tmp->UnlinkManager();
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_WEAK_REFERENCE
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(BrowserParent)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mFrameLoader)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBrowsingContext)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_RAWPTR(Manager())
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(BrowserParent)
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(BrowserParent)
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(BrowserParent)
|
NS_IMPL_CYCLE_COLLECTING_RELEASE(BrowserParent)
|
||||||
|
|
||||||
|
@ -307,6 +292,7 @@ BrowserParent::BrowserParent(ContentParent* aManager, const TabId& aTabId,
|
||||||
mUpdatedDimensions(false),
|
mUpdatedDimensions(false),
|
||||||
mSizeMode(nsSizeMode_Normal),
|
mSizeMode(nsSizeMode_Normal),
|
||||||
mCreatingWindow(false),
|
mCreatingWindow(false),
|
||||||
|
mVsyncParent(nullptr),
|
||||||
mMarkedDestroying(false),
|
mMarkedDestroying(false),
|
||||||
mIsDestroyed(false),
|
mIsDestroyed(false),
|
||||||
mRemoteTargetSetsCursor(false),
|
mRemoteTargetSetsCursor(false),
|
||||||
|
@ -1405,19 +1391,21 @@ IPCResult BrowserParent::RecvNewWindowGlobal(
|
||||||
return IPC_OK();
|
return IPC_OK();
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<PVsyncParent> BrowserParent::AllocPVsyncParent() {
|
PVsyncParent* BrowserParent::AllocPVsyncParent() {
|
||||||
return MakeAndAddRef<VsyncParent>();
|
MOZ_ASSERT(!mVsyncParent);
|
||||||
|
mVsyncParent = new VsyncParent();
|
||||||
|
UpdateVsyncParentVsyncDispatcher();
|
||||||
|
return mVsyncParent.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
IPCResult BrowserParent::RecvPVsyncConstructor(PVsyncParent* aActor) {
|
bool BrowserParent::DeallocPVsyncParent(PVsyncParent* aActor) {
|
||||||
UpdateVsyncParentVsyncDispatcher();
|
MOZ_ASSERT(aActor);
|
||||||
return IPC_OK();
|
mVsyncParent = nullptr;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BrowserParent::UpdateVsyncParentVsyncDispatcher() {
|
void BrowserParent::UpdateVsyncParentVsyncDispatcher() {
|
||||||
VsyncParent* actor = static_cast<VsyncParent*>(
|
if (!mVsyncParent) {
|
||||||
LoneManagedOrNullAsserts(ManagedPVsyncParent()));
|
|
||||||
if (!actor) {
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1426,7 +1414,7 @@ void BrowserParent::UpdateVsyncParentVsyncDispatcher() {
|
||||||
if (!vsyncDispatcher) {
|
if (!vsyncDispatcher) {
|
||||||
vsyncDispatcher = gfxPlatform::GetPlatform()->GetGlobalVsyncDispatcher();
|
vsyncDispatcher = gfxPlatform::GetPlatform()->GetGlobalVsyncDispatcher();
|
||||||
}
|
}
|
||||||
actor->UpdateVsyncDispatcher(vsyncDispatcher);
|
mVsyncParent->UpdateVsyncDispatcher(vsyncDispatcher);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -423,9 +423,9 @@ class BrowserParent final : public PBrowserParent,
|
||||||
const nsString& aTitle, const nsString& aInitialColor,
|
const nsString& aTitle, const nsString& aInitialColor,
|
||||||
const nsTArray<nsString>& aDefaultColors);
|
const nsTArray<nsString>& aDefaultColors);
|
||||||
|
|
||||||
already_AddRefed<PVsyncParent> AllocPVsyncParent();
|
PVsyncParent* AllocPVsyncParent();
|
||||||
|
|
||||||
mozilla::ipc::IPCResult RecvPVsyncConstructor(PVsyncParent* aActor) override;
|
bool DeallocPVsyncParent(PVsyncParent* aActor);
|
||||||
|
|
||||||
#ifdef ACCESSIBILITY
|
#ifdef ACCESSIBILITY
|
||||||
PDocAccessibleParent* AllocPDocAccessibleParent(
|
PDocAccessibleParent* AllocPDocAccessibleParent(
|
||||||
|
@ -941,6 +941,8 @@ class BrowserParent final : public PBrowserParent,
|
||||||
|
|
||||||
nsTArray<nsString> mVerifyDropLinks;
|
nsTArray<nsString> mVerifyDropLinks;
|
||||||
|
|
||||||
|
RefPtr<VsyncParent> mVsyncParent;
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int32_t mActiveSupressDisplayportCount = 0;
|
int32_t mActiveSupressDisplayportCount = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -878,26 +878,9 @@ nsISupports* WindowGlobalChild::GetParentObject() {
|
||||||
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
|
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_CLASS(WindowGlobalChild)
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_WEAK_PTR(WindowGlobalChild, mWindowGlobal,
|
||||||
|
mContainerFeaturePolicy,
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(WindowGlobalChild)
|
mWindowContext)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindowGlobal)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mContainerFeaturePolicy)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindowContext)
|
|
||||||
tmp->UnlinkManager();
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_WEAK_PTR
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(WindowGlobalChild)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindowGlobal)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContainerFeaturePolicy)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindowContext)
|
|
||||||
if (!tmp->IsInProcess()) {
|
|
||||||
CycleCollectionNoteChild(cb, static_cast<BrowserChild*>(tmp->Manager()),
|
|
||||||
"Manager()");
|
|
||||||
}
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
||||||
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WindowGlobalChild)
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WindowGlobalChild)
|
||||||
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
||||||
|
|
|
@ -1697,22 +1697,8 @@ IPCResult WindowGlobalParent::RecvSetCookies(
|
||||||
aCookies, GetBrowsingContext());
|
aCookies, GetBrowsingContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_CLASS(WindowGlobalParent)
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(WindowGlobalParent, WindowContext,
|
||||||
|
mPageUseCountersWindow)
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(WindowGlobalParent,
|
|
||||||
WindowContext)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPageUseCountersWindow)
|
|
||||||
tmp->UnlinkManager();
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(WindowGlobalParent,
|
|
||||||
WindowContext)
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPageUseCountersWindow)
|
|
||||||
if (!tmp->IsInProcess()) {
|
|
||||||
CycleCollectionNoteChild(cb, static_cast<BrowserParent*>(tmp->Manager()),
|
|
||||||
"Manager()");
|
|
||||||
}
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(WindowGlobalParent,
|
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(WindowGlobalParent,
|
||||||
WindowContext)
|
WindowContext)
|
||||||
|
|
|
@ -234,15 +234,14 @@ RefPtr<layers::CanvasChild> CanvasManagerChild::GetCanvasChild() {
|
||||||
}
|
}
|
||||||
|
|
||||||
RefPtr<webgpu::WebGPUChild> CanvasManagerChild::GetWebGPUChild() {
|
RefPtr<webgpu::WebGPUChild> CanvasManagerChild::GetWebGPUChild() {
|
||||||
if (PWebGPUChild* actor = LoneManagedOrNullAsserts(ManagedPWebGPUChild())) {
|
if (!mWebGPUChild) {
|
||||||
return static_cast<webgpu::WebGPUChild*>(actor);
|
mWebGPUChild = MakeAndAddRef<webgpu::WebGPUChild>();
|
||||||
|
if (!SendPWebGPUConstructor(mWebGPUChild)) {
|
||||||
|
mWebGPUChild = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
auto actor = MakeRefPtr<webgpu::WebGPUChild>();
|
return mWebGPUChild;
|
||||||
if (!SendPWebGPUConstructor(actor)) {
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
return actor;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
layers::ActiveResourceTracker* CanvasManagerChild::GetActiveResourceTracker() {
|
layers::ActiveResourceTracker* CanvasManagerChild::GetActiveResourceTracker() {
|
||||||
|
|
|
@ -71,6 +71,7 @@ class CanvasManagerChild final : public PCanvasManagerChild {
|
||||||
|
|
||||||
RefPtr<mozilla::dom::ThreadSafeWorkerRef> mWorkerRef;
|
RefPtr<mozilla::dom::ThreadSafeWorkerRef> mWorkerRef;
|
||||||
RefPtr<layers::CanvasChild> mCanvasChild;
|
RefPtr<layers::CanvasChild> mCanvasChild;
|
||||||
|
RefPtr<webgpu::WebGPUChild> mWebGPUChild;
|
||||||
UniquePtr<layers::ActiveResourceTracker> mActiveResourceTracker;
|
UniquePtr<layers::ActiveResourceTracker> mActiveResourceTracker;
|
||||||
std::set<dom::CanvasRenderingContext2D*> mActiveCanvas;
|
std::set<dom::CanvasRenderingContext2D*> mActiveCanvas;
|
||||||
const uint32_t mId;
|
const uint32_t mId;
|
||||||
|
|
|
@ -561,12 +561,7 @@ class ChildImpl final : public BackgroundChildImpl {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// This type is threadsafe refcounted as actors managed by it may be destroyed
|
NS_INLINE_DECL_REFCOUNTING(ChildImpl, override)
|
||||||
// after the thread it is bound to dies, and hold a reference to this object.
|
|
||||||
//
|
|
||||||
// It is _not_ safe to use this type or any methods on it from off of the
|
|
||||||
// thread it was created for.
|
|
||||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ChildImpl, override)
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// Forwarded from BackgroundChild.
|
// Forwarded from BackgroundChild.
|
||||||
|
|
|
@ -57,7 +57,7 @@ UntypedManagedEndpoint::~UntypedManagedEndpoint() {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool UntypedManagedEndpoint::BindCommon(IProtocol* aActor,
|
bool UntypedManagedEndpoint::BindCommon(IProtocol* aActor,
|
||||||
IRefCountedProtocol* aManager) {
|
IProtocol* aManager) {
|
||||||
MOZ_ASSERT(aManager);
|
MOZ_ASSERT(aManager);
|
||||||
if (!mInner) {
|
if (!mInner) {
|
||||||
NS_WARNING("Cannot bind to invalid endpoint");
|
NS_WARNING("Cannot bind to invalid endpoint");
|
||||||
|
|
|
@ -214,7 +214,7 @@ class UntypedManagedEndpoint {
|
||||||
|
|
||||||
~UntypedManagedEndpoint() noexcept;
|
~UntypedManagedEndpoint() noexcept;
|
||||||
|
|
||||||
bool BindCommon(IProtocol* aActor, IRefCountedProtocol* aManager);
|
bool BindCommon(IProtocol* aActor, IProtocol* aManager);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend struct IPDLParamTraits<UntypedManagedEndpoint>;
|
friend struct IPDLParamTraits<UntypedManagedEndpoint>;
|
||||||
|
@ -267,8 +267,7 @@ class ManagedEndpoint : public UntypedManagedEndpoint {
|
||||||
ManagedEndpoint(const PrivateIPDLInterface&, IProtocol* aActor)
|
ManagedEndpoint(const PrivateIPDLInterface&, IProtocol* aActor)
|
||||||
: UntypedManagedEndpoint(aActor) {}
|
: UntypedManagedEndpoint(aActor) {}
|
||||||
|
|
||||||
bool Bind(const PrivateIPDLInterface&, PFooSide* aActor,
|
bool Bind(const PrivateIPDLInterface&, PFooSide* aActor, IProtocol* aManager,
|
||||||
IRefCountedProtocol* aManager,
|
|
||||||
ManagedContainer<PFooSide>& aContainer) {
|
ManagedContainer<PFooSide>& aContainer) {
|
||||||
if (!BindCommon(aActor, aManager)) {
|
if (!BindCommon(aActor, aManager)) {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -257,6 +257,12 @@ ActorLifecycleProxy::ActorLifecycleProxy(IProtocol* aActor) : mActor(aActor) {
|
||||||
MOZ_ASSERT(mActor->CanSend(),
|
MOZ_ASSERT(mActor->CanSend(),
|
||||||
"Cannot create LifecycleProxy for non-connected actor!");
|
"Cannot create LifecycleProxy for non-connected actor!");
|
||||||
|
|
||||||
|
// Take a reference to our manager's lifecycle proxy to try to hold it &
|
||||||
|
// ensure it doesn't die before us.
|
||||||
|
if (mActor->mManager) {
|
||||||
|
mManager = mActor->mManager->mLifecycleProxy;
|
||||||
|
}
|
||||||
|
|
||||||
// Record that we've taken our first reference to our actor.
|
// Record that we've taken our first reference to our actor.
|
||||||
mActor->ActorAlloc();
|
mActor->ActorAlloc();
|
||||||
}
|
}
|
||||||
|
@ -487,13 +493,13 @@ bool IProtocol::DeallocShmem(Shmem& aMem) {
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IProtocol::SetManager(IRefCountedProtocol* aManager) {
|
void IProtocol::SetManager(IProtocol* aManager) {
|
||||||
MOZ_RELEASE_ASSERT(!mManager || mManager == aManager);
|
MOZ_RELEASE_ASSERT(!mManager || mManager == aManager);
|
||||||
mManager = aManager;
|
mManager = aManager;
|
||||||
mToplevel = aManager->mToplevel;
|
mToplevel = aManager->mToplevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IProtocol::SetManagerAndRegister(IRefCountedProtocol* aManager) {
|
void IProtocol::SetManagerAndRegister(IProtocol* aManager) {
|
||||||
// Set the manager prior to registering so registering properly inherits
|
// Set the manager prior to registering so registering properly inherits
|
||||||
// the manager's event target.
|
// the manager's event target.
|
||||||
SetManager(aManager);
|
SetManager(aManager);
|
||||||
|
@ -501,8 +507,7 @@ void IProtocol::SetManagerAndRegister(IRefCountedProtocol* aManager) {
|
||||||
aManager->Register(this);
|
aManager->Register(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IProtocol::SetManagerAndRegister(IRefCountedProtocol* aManager,
|
void IProtocol::SetManagerAndRegister(IProtocol* aManager, int32_t aId) {
|
||||||
int32_t aId) {
|
|
||||||
// Set the manager prior to registering so registering properly inherits
|
// Set the manager prior to registering so registering properly inherits
|
||||||
// the manager's event target.
|
// the manager's event target.
|
||||||
SetManager(aManager);
|
SetManager(aManager);
|
||||||
|
@ -510,11 +515,6 @@ void IProtocol::SetManagerAndRegister(IRefCountedProtocol* aManager,
|
||||||
aManager->RegisterID(this, aId);
|
aManager->RegisterID(this, aId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IProtocol::UnlinkManager() {
|
|
||||||
mToplevel = nullptr;
|
|
||||||
mManager = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IProtocol::ChannelSend(UniquePtr<IPC::Message> aMsg) {
|
bool IProtocol::ChannelSend(UniquePtr<IPC::Message> aMsg) {
|
||||||
if (CanSend()) {
|
if (CanSend()) {
|
||||||
// NOTE: This send call failing can only occur during toplevel channel
|
// NOTE: This send call failing can only occur during toplevel channel
|
||||||
|
|
|
@ -215,7 +215,7 @@ class IProtocol : public HasResultCodes {
|
||||||
const char* GetProtocolName() const { return ProtocolIdToName(mProtocolId); }
|
const char* GetProtocolName() const { return ProtocolIdToName(mProtocolId); }
|
||||||
|
|
||||||
int32_t Id() const { return mId; }
|
int32_t Id() const { return mId; }
|
||||||
IRefCountedProtocol* Manager() const { return mManager; }
|
IProtocol* Manager() const { return mManager; }
|
||||||
|
|
||||||
ActorLifecycleProxy* GetLifecycleProxy() { return mLifecycleProxy; }
|
ActorLifecycleProxy* GetLifecycleProxy() { return mLifecycleProxy; }
|
||||||
WeakActorLifecycleProxy* GetWeakLifecycleProxy();
|
WeakActorLifecycleProxy* GetWeakLifecycleProxy();
|
||||||
|
@ -259,18 +259,13 @@ class IProtocol : public HasResultCodes {
|
||||||
|
|
||||||
// We have separate functions because the accessibility code manually
|
// We have separate functions because the accessibility code manually
|
||||||
// calls SetManager.
|
// calls SetManager.
|
||||||
void SetManager(IRefCountedProtocol* aManager);
|
void SetManager(IProtocol* aManager);
|
||||||
|
|
||||||
// Clear `mManager` and `mToplevel` to nullptr. Only intended to be called
|
|
||||||
// within the unlink implementation of cycle collected IPDL actors with cycle
|
|
||||||
// collected managers.
|
|
||||||
void UnlinkManager();
|
|
||||||
|
|
||||||
// Sets the manager for the protocol and registers the protocol with
|
// Sets the manager for the protocol and registers the protocol with
|
||||||
// its manager, setting up channels for the protocol as well. Not
|
// its manager, setting up channels for the protocol as well. Not
|
||||||
// for use outside of IPDL.
|
// for use outside of IPDL.
|
||||||
void SetManagerAndRegister(IRefCountedProtocol* aManager);
|
void SetManagerAndRegister(IProtocol* aManager);
|
||||||
void SetManagerAndRegister(IRefCountedProtocol* aManager, int32_t aId);
|
void SetManagerAndRegister(IProtocol* aManager, int32_t aId);
|
||||||
|
|
||||||
// Helpers for calling `Send` on our underlying IPC channel.
|
// Helpers for calling `Send` on our underlying IPC channel.
|
||||||
bool ChannelSend(UniquePtr<IPC::Message> aMsg);
|
bool ChannelSend(UniquePtr<IPC::Message> aMsg);
|
||||||
|
@ -338,7 +333,7 @@ class IProtocol : public HasResultCodes {
|
||||||
Side mSide;
|
Side mSide;
|
||||||
LinkStatus mLinkStatus;
|
LinkStatus mLinkStatus;
|
||||||
ActorLifecycleProxy* mLifecycleProxy;
|
ActorLifecycleProxy* mLifecycleProxy;
|
||||||
RefPtr<IRefCountedProtocol> mManager;
|
IProtocol* mManager;
|
||||||
IToplevelProtocol* mToplevel;
|
IToplevelProtocol* mToplevel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -671,6 +666,10 @@ class ActorLifecycleProxy {
|
||||||
|
|
||||||
IProtocol* MOZ_NON_OWNING_REF mActor;
|
IProtocol* MOZ_NON_OWNING_REF mActor;
|
||||||
|
|
||||||
|
// Hold a reference to the actor's manager's ActorLifecycleProxy to help
|
||||||
|
// prevent it from dying while we're still alive!
|
||||||
|
RefPtr<ActorLifecycleProxy> mManager;
|
||||||
|
|
||||||
// When requested, the current self-referencing weak reference for this
|
// When requested, the current self-referencing weak reference for this
|
||||||
// ActorLifecycleProxy.
|
// ActorLifecycleProxy.
|
||||||
RefPtr<WeakActorLifecycleProxy> mWeakProxy;
|
RefPtr<WeakActorLifecycleProxy> mWeakProxy;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче