Skip to content

Commit

Permalink
Bug 1540731 - Part 2: Move toplevel actors to override ActorDestroy, …
Browse files Browse the repository at this point in the history
…r=froydnj

Differential Revision: https://phabricator.services.mozilla.com/D28573
  • Loading branch information
mystor committed May 21, 2019
1 parent 8152ba2 commit 72a7cc5
Show file tree
Hide file tree
Showing 35 changed files with 36 additions and 44 deletions.
4 changes: 1 addition & 3 deletions dom/media/ipc/RemoteDecoderManagerChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,7 @@ void RemoteDecoderManagerChild::ActorDestroy(ActorDestroyReason aWhy) {
mCanSend = false;
}

void RemoteDecoderManagerChild::DeallocPRemoteDecoderManagerChild() {
mIPDLSelfRef = nullptr;
}
void RemoteDecoderManagerChild::ActorDealloc() { mIPDLSelfRef = nullptr; }

bool RemoteDecoderManagerChild::CanSend() {
MOZ_ASSERT(NS_GetCurrentThread() == GetManagerThread());
Expand Down
2 changes: 1 addition & 1 deletion dom/media/ipc/RemoteDecoderManagerChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class RemoteDecoderManagerChild final : public PRemoteDecoderManagerChild {
void InitIPDL();

void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPRemoteDecoderManagerChild() override;
void ActorDealloc() override;

PRemoteDecoderChild* AllocPRemoteDecoderChild(
const RemoteDecoderInfoIPDL& aRemoteDecoderInfo,
Expand Down
4 changes: 1 addition & 3 deletions dom/media/ipc/RemoteDecoderManagerParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,6 @@ void RemoteDecoderManagerParent::Open(
AddRef();
}

void RemoteDecoderManagerParent::DeallocPRemoteDecoderManagerParent() {
Release();
}
void RemoteDecoderManagerParent::ActorDealloc() { Release(); }

} // namespace mozilla
2 changes: 1 addition & 1 deletion dom/media/ipc/RemoteDecoderManagerParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class RemoteDecoderManagerParent final : public PRemoteDecoderManagerParent {

void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override;

void DeallocPRemoteDecoderManagerParent() override;
void ActorDealloc() override;

private:
explicit RemoteDecoderManagerParent(
Expand Down
4 changes: 1 addition & 3 deletions dom/media/ipc/VideoDecoderManagerChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,7 @@ void VideoDecoderManagerChild::ActorDestroy(ActorDestroyReason aWhy) {
mCanSend = false;
}

void VideoDecoderManagerChild::DeallocPVideoDecoderManagerChild() {
mIPDLSelfRef = nullptr;
}
void VideoDecoderManagerChild::ActorDealloc() { mIPDLSelfRef = nullptr; }

bool VideoDecoderManagerChild::CanSend() {
MOZ_ASSERT(NS_GetCurrentThread() == GetManagerThread());
Expand Down
2 changes: 1 addition & 1 deletion dom/media/ipc/VideoDecoderManagerChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class VideoDecoderManagerChild final : public PVideoDecoderManagerChild,
void InitIPDL();

void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPVideoDecoderManagerChild() override;
void ActorDealloc() override;

void HandleFatalError(const char* aMsg) const override;

Expand Down
4 changes: 1 addition & 3 deletions dom/media/ipc/VideoDecoderManagerParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@ void VideoDecoderManagerParent::Open(
AddRef();
}

void VideoDecoderManagerParent::DeallocPVideoDecoderManagerParent() {
Release();
}
void VideoDecoderManagerParent::ActorDealloc() { Release(); }

mozilla::ipc::IPCResult VideoDecoderManagerParent::RecvReadback(
const SurfaceDescriptorGPUVideo& aSD, SurfaceDescriptor* aResult) {
Expand Down
2 changes: 1 addition & 1 deletion dom/media/ipc/VideoDecoderManagerParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class VideoDecoderManagerParent final : public PVideoDecoderManagerParent {

void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override;

void DeallocPVideoDecoderManagerParent() override;
void ActorDealloc() override;

private:
explicit VideoDecoderManagerParent(
Expand Down
2 changes: 1 addition & 1 deletion gfx/ipc/VsyncBridgeChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void VsyncBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
}
}

void VsyncBridgeChild::DeallocPVsyncBridgeChild() { Release(); }
void VsyncBridgeChild::ActorDealloc() { Release(); }

void VsyncBridgeChild::ProcessingError(Result aCode, const char* aReason) {
MOZ_RELEASE_ASSERT(aCode == MsgDropped,
Expand Down
2 changes: 1 addition & 1 deletion gfx/ipc/VsyncBridgeChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class VsyncBridgeChild final : public PVsyncBridgeChild {
void Close();

void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPVsyncBridgeChild() override;
void ActorDealloc() override;
void ProcessingError(Result aCode, const char* aReason) override;

void NotifyVsync(const VsyncEvent& aVsync, const layers::LayersId& aLayersId);
Expand Down
2 changes: 1 addition & 1 deletion gfx/ipc/VsyncBridgeParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void VsyncBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
mCompositorThreadRef = nullptr;
}

void VsyncBridgeParent::DeallocPVsyncBridgeParent() { Release(); }
void VsyncBridgeParent::ActorDealloc() { Release(); }

} // namespace gfx
} // namespace mozilla
2 changes: 1 addition & 1 deletion gfx/ipc/VsyncBridgeParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class VsyncBridgeParent final : public PVsyncBridgeParent {
mozilla::ipc::IPCResult RecvNotifyVsync(const VsyncEvent& aVsync,
const LayersId& aLayersId);
void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPVsyncBridgeParent() override;
void ActorDealloc() override;

void Shutdown();

Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/CompositorManagerChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ CompositorManagerChild::CompositorManagerChild(
SetReplyTimeout();
}

void CompositorManagerChild::DeallocPCompositorManagerChild() {
void CompositorManagerChild::ActorDealloc() {
MOZ_ASSERT(!mCanSend);
Release();
}
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/CompositorManagerChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class CompositorManagerChild : public PCompositorManagerChild {

virtual ~CompositorManagerChild() = default;

void DeallocPCompositorManagerChild() override;
void ActorDealloc() override;

already_AddRefed<nsIEventTarget> GetSpecificMessageEventTarget(
const Message& aMsg) override;
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/CompositorManagerParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ void CompositorManagerParent::ActorDestroy(ActorDestroyReason aReason) {
}
}

void CompositorManagerParent::DeallocPCompositorManagerParent() {
void CompositorManagerParent::ActorDealloc() {
MessageLoop::current()->PostTask(
NewRunnableMethod("layers::CompositorManagerParent::DeferredDestroy",
this, &CompositorManagerParent::DeferredDestroy));
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/CompositorManagerParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class CompositorManagerParent final : public PCompositorManagerParent {

void Bind(Endpoint<PCompositorManagerParent>&& aEndpoint, bool aIsRoot);

void DeallocPCompositorManagerParent() override;
void ActorDealloc() override;

void DeferredDestroy();

Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/ImageBridgeChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void ImageBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
}
}

void ImageBridgeChild::DeallocPImageBridgeChild() { this->Release(); }
void ImageBridgeChild::ActorDealloc() { this->Release(); }

void ImageBridgeChild::CreateImageClientSync(SynchronousTask* aTask,
RefPtr<ImageClient>* result,
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/ImageBridgeChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ class ImageBridgeChild final : public PImageBridgeChild,
void MarkShutDown();

void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPImageBridgeChild() override;
void ActorDealloc() override;

bool CanSend() const;
bool CanPostTask() const;
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/UiCompositorControllerChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ void UiCompositorControllerChild::ActorDestroy(ActorDestroyReason aWhy) {
}
}

void UiCompositorControllerChild::DeallocPUiCompositorControllerChild() {
void UiCompositorControllerChild::ActorDealloc() {
if (mParent) {
mParent = nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/UiCompositorControllerChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class UiCompositorControllerChild final

protected:
void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPUiCompositorControllerChild() override;
void ActorDealloc() override;
void ProcessingError(Result aCode, const char* aReason) override;
void HandleFatalError(const char* aMsg) const override;
mozilla::ipc::IPCResult RecvToolbarAnimatorMessageFromCompositor(
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/UiCompositorControllerParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ UiCompositorControllerParent::RecvToolbarPixelsToCompositor(

void UiCompositorControllerParent::ActorDestroy(ActorDestroyReason aWhy) {}

void UiCompositorControllerParent::DeallocPUiCompositorControllerParent() {
void UiCompositorControllerParent::ActorDealloc() {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
Shutdown();
Release(); // For AddRef in Initialize()
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/UiCompositorControllerParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class UiCompositorControllerParent final
mozilla::ipc::IPCResult RecvToolbarPixelsToCompositor(
Shmem&& aMem, const ScreenIntSize& aSize);
void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPUiCompositorControllerParent() override;
void ActorDealloc() override;

// Class specific functions
#if defined(MOZ_WIDGET_ANDROID)
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/VideoBridgeChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void VideoBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
mCanSend = false;
}

void VideoBridgeChild::DeallocPVideoBridgeChild() { mIPDLSelfRef = nullptr; }
void VideoBridgeChild::ActorDealloc() { mIPDLSelfRef = nullptr; }

PTextureChild* VideoBridgeChild::CreateTexture(
const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock,
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/VideoBridgeChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class VideoBridgeChild final : public PVideoBridgeChild,
bool DeallocPTextureChild(PTextureChild* actor);

void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPVideoBridgeChild() override;
void ActorDealloc() override;

// ISurfaceAllocator
bool AllocUnsafeShmem(size_t aSize,
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/VideoBridgeParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ void VideoBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
mClosed = true;
}

void VideoBridgeParent::DeallocPVideoBridgeParent() {
void VideoBridgeParent::ActorDealloc() {
mCompositorThreadRef = nullptr;
mSelfRef = nullptr;
}
Expand Down
2 changes: 1 addition & 1 deletion gfx/layers/ipc/VideoBridgeParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class VideoBridgeParent final : public PVideoBridgeParent,
void DeallocShmem(ipc::Shmem& aShmem) override;

private:
void DeallocPVideoBridgeParent() override;
void ActorDealloc() override;

// This keeps us alive until ActorDestroy(), at which point we do a
// deferred destruction of ourselves.
Expand Down
2 changes: 1 addition & 1 deletion ipc/glue/InProcessChild.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class InProcessChild : public PInProcessChild {
// NOTE: PInProcess lifecycle management is declared as staic methods and
// state on InProcessParent, and implemented in InProcessImpl.cpp.
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual void DeallocPInProcessChild() override;
virtual void ActorDealloc() override;
~InProcessChild() = default;

static StaticRefPtr<InProcessChild> sSingleton;
Expand Down
4 changes: 2 additions & 2 deletions ipc/glue/InProcessImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -120,12 +120,12 @@ void InProcessChild::ActorDestroy(ActorDestroyReason aWhy) {
InProcessParent::Shutdown();
}

void InProcessParent::DeallocPInProcessParent() {
void InProcessParent::ActorDealloc() {
MOZ_ASSERT(!InProcessParent::sSingleton);
Release(); // Release the reference taken in InProcessParent::Startup.
}

void InProcessChild::DeallocPInProcessChild() {
void InProcessChild::ActorDealloc() {
MOZ_ASSERT(!InProcessChild::sSingleton);
Release(); // Release the reference taken in InProcessParent::Startup.
}
Expand Down
2 changes: 1 addition & 1 deletion ipc/glue/InProcessParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class InProcessParent : public nsIObserver, public PInProcessParent {
private:
// Lifecycle management is implemented in InProcessImpl.cpp
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual void DeallocPInProcessParent() override;
virtual void ActorDealloc() override;
~InProcessParent() = default;

static void Startup();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ void StreamFilterChild::ActorDestroy(ActorDestroyReason aWhy) {
mStreamFilter = nullptr;
}

void StreamFilterChild::DeallocPStreamFilterChild() {
void StreamFilterChild::ActorDealloc() {
RefPtr<StreamFilterChild> self = dont_AddRef(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class StreamFilterChild final : public PStreamFilterChild,
IPCResult RecvResumed();
IPCResult RecvFlushData();

virtual void DeallocPStreamFilterChild() override;
virtual void ActorDealloc() override;

void SetStreamFilter(StreamFilter* aStreamFilter) {
mStreamFilter = aStreamFilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -699,7 +699,7 @@ void StreamFilterParent::ActorDestroy(ActorDestroyReason aWhy) {
}
}

void StreamFilterParent::DeallocPStreamFilterParent() {
void StreamFilterParent::ActorDealloc() {
RefPtr<StreamFilterParent> self = dont_AddRef(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ class StreamFilterParent final : public PStreamFilterParent,
IPCResult RecvDisconnect();
IPCResult RecvDestroy();

virtual void DeallocPStreamFilterParent() override;
virtual void ActorDealloc() override;

private:
bool IPCActive() {
Expand Down
2 changes: 1 addition & 1 deletion tools/profiler/gecko/ProfilerParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,6 @@ void ProfilerParent::ActorDestroy(ActorDestroyReason aActorDestroyReason) {
mDestroyed = true;
}

void ProfilerParent::DeallocPProfilerParent() { mSelfRef = nullptr; }
void ProfilerParent::ActorDealloc() { mSelfRef = nullptr; }

} // namespace mozilla
2 changes: 1 addition & 1 deletion tools/profiler/public/ProfilerParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ class ProfilerParent final : public PProfilerParent {

void Init();
void ActorDestroy(ActorDestroyReason aActorDestroyReason) override;
void DeallocPProfilerParent() override;
void ActorDealloc() override;

RefPtr<ProfilerParent> mSelfRef;
nsTArray<MozPromiseHolder<SingleProcessProfilePromise>>
Expand Down

0 comments on commit 72a7cc5

Please sign in to comment.