Bug 1540731 - Part 2: Move toplevel actors to override ActorDestroy, r=froydnj

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Nika Layzell 2019-05-21 17:04:21 +00:00
Родитель c293c9007f
Коммит 95e8f0306b
35 изменённых файлов: 36 добавлений и 44 удалений

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

@ -131,9 +131,7 @@ void RemoteDecoderManagerChild::ActorDestroy(ActorDestroyReason aWhy) {
mCanSend = false; mCanSend = false;
} }
void RemoteDecoderManagerChild::DeallocPRemoteDecoderManagerChild() { void RemoteDecoderManagerChild::ActorDealloc() { mIPDLSelfRef = nullptr; }
mIPDLSelfRef = nullptr;
}
bool RemoteDecoderManagerChild::CanSend() { bool RemoteDecoderManagerChild::CanSend() {
MOZ_ASSERT(NS_GetCurrentThread() == GetManagerThread()); MOZ_ASSERT(NS_GetCurrentThread() == GetManagerThread());

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

@ -33,7 +33,7 @@ class RemoteDecoderManagerChild final : public PRemoteDecoderManagerChild {
void InitIPDL(); void InitIPDL();
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPRemoteDecoderManagerChild() override; void ActorDealloc() override;
PRemoteDecoderChild* AllocPRemoteDecoderChild( PRemoteDecoderChild* AllocPRemoteDecoderChild(
const RemoteDecoderInfoIPDL& aRemoteDecoderInfo, const RemoteDecoderInfoIPDL& aRemoteDecoderInfo,

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

@ -190,8 +190,6 @@ void RemoteDecoderManagerParent::Open(
AddRef(); AddRef();
} }
void RemoteDecoderManagerParent::DeallocPRemoteDecoderManagerParent() { void RemoteDecoderManagerParent::ActorDealloc() { Release(); }
Release();
}
} // namespace mozilla } // namespace mozilla

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

@ -34,7 +34,7 @@ class RemoteDecoderManagerParent final : public PRemoteDecoderManagerParent {
void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override; void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override;
void DeallocPRemoteDecoderManagerParent() override; void ActorDealloc() override;
private: private:
explicit RemoteDecoderManagerParent( explicit RemoteDecoderManagerParent(

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

@ -153,9 +153,7 @@ void VideoDecoderManagerChild::ActorDestroy(ActorDestroyReason aWhy) {
mCanSend = false; mCanSend = false;
} }
void VideoDecoderManagerChild::DeallocPVideoDecoderManagerChild() { void VideoDecoderManagerChild::ActorDealloc() { mIPDLSelfRef = nullptr; }
mIPDLSelfRef = nullptr;
}
bool VideoDecoderManagerChild::CanSend() { bool VideoDecoderManagerChild::CanSend() {
MOZ_ASSERT(NS_GetCurrentThread() == GetManagerThread()); MOZ_ASSERT(NS_GetCurrentThread() == GetManagerThread());

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

@ -67,7 +67,7 @@ class VideoDecoderManagerChild final : public PVideoDecoderManagerChild,
void InitIPDL(); void InitIPDL();
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPVideoDecoderManagerChild() override; void ActorDealloc() override;
void HandleFatalError(const char* aMsg) const override; void HandleFatalError(const char* aMsg) const override;

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

@ -223,9 +223,7 @@ void VideoDecoderManagerParent::Open(
AddRef(); AddRef();
} }
void VideoDecoderManagerParent::DeallocPVideoDecoderManagerParent() { void VideoDecoderManagerParent::ActorDealloc() { Release(); }
Release();
}
mozilla::ipc::IPCResult VideoDecoderManagerParent::RecvReadback( mozilla::ipc::IPCResult VideoDecoderManagerParent::RecvReadback(
const SurfaceDescriptorGPUVideo& aSD, SurfaceDescriptor* aResult) { const SurfaceDescriptorGPUVideo& aSD, SurfaceDescriptor* aResult) {

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

@ -48,7 +48,7 @@ class VideoDecoderManagerParent final : public PVideoDecoderManagerParent {
void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override; void ActorDestroy(mozilla::ipc::IProtocol::ActorDestroyReason) override;
void DeallocPVideoDecoderManagerParent() override; void ActorDealloc() override;
private: private:
explicit VideoDecoderManagerParent( explicit VideoDecoderManagerParent(

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

@ -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) { void VsyncBridgeChild::ProcessingError(Result aCode, const char* aReason) {
MOZ_RELEASE_ASSERT(aCode == MsgDropped, MOZ_RELEASE_ASSERT(aCode == MsgDropped,

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

@ -27,7 +27,7 @@ class VsyncBridgeChild final : public PVsyncBridgeChild {
void Close(); void Close();
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPVsyncBridgeChild() override; void ActorDealloc() override;
void ProcessingError(Result aCode, const char* aReason) override; void ProcessingError(Result aCode, const char* aReason) override;
void NotifyVsync(const VsyncEvent& aVsync, const layers::LayersId& aLayersId); void NotifyVsync(const VsyncEvent& aVsync, const layers::LayersId& aLayersId);

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

@ -70,7 +70,7 @@ void VsyncBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
mCompositorThreadRef = nullptr; mCompositorThreadRef = nullptr;
} }
void VsyncBridgeParent::DeallocPVsyncBridgeParent() { Release(); } void VsyncBridgeParent::ActorDealloc() { Release(); }
} // namespace gfx } // namespace gfx
} // namespace mozilla } // namespace mozilla

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

@ -26,7 +26,7 @@ class VsyncBridgeParent final : public PVsyncBridgeParent {
mozilla::ipc::IPCResult RecvNotifyVsync(const VsyncEvent& aVsync, mozilla::ipc::IPCResult RecvNotifyVsync(const VsyncEvent& aVsync,
const LayersId& aLayersId); const LayersId& aLayersId);
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPVsyncBridgeParent() override; void ActorDealloc() override;
void Shutdown(); void Shutdown();

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

@ -203,7 +203,7 @@ CompositorManagerChild::CompositorManagerChild(
SetReplyTimeout(); SetReplyTimeout();
} }
void CompositorManagerChild::DeallocPCompositorManagerChild() { void CompositorManagerChild::ActorDealloc() {
MOZ_ASSERT(!mCanSend); MOZ_ASSERT(!mCanSend);
Release(); Release();
} }

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

@ -97,7 +97,7 @@ class CompositorManagerChild : public PCompositorManagerChild {
virtual ~CompositorManagerChild() = default; virtual ~CompositorManagerChild() = default;
void DeallocPCompositorManagerChild() override; void ActorDealloc() override;
already_AddRefed<nsIEventTarget> GetSpecificMessageEventTarget( already_AddRefed<nsIEventTarget> GetSpecificMessageEventTarget(
const Message& aMsg) override; const Message& aMsg) override;

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

@ -158,7 +158,7 @@ void CompositorManagerParent::ActorDestroy(ActorDestroyReason aReason) {
} }
} }
void CompositorManagerParent::DeallocPCompositorManagerParent() { void CompositorManagerParent::ActorDealloc() {
MessageLoop::current()->PostTask( MessageLoop::current()->PostTask(
NewRunnableMethod("layers::CompositorManagerParent::DeferredDestroy", NewRunnableMethod("layers::CompositorManagerParent::DeferredDestroy",
this, &CompositorManagerParent::DeferredDestroy)); this, &CompositorManagerParent::DeferredDestroy));

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

@ -74,7 +74,7 @@ class CompositorManagerParent final : public PCompositorManagerParent {
void Bind(Endpoint<PCompositorManagerParent>&& aEndpoint, bool aIsRoot); void Bind(Endpoint<PCompositorManagerParent>&& aEndpoint, bool aIsRoot);
void DeallocPCompositorManagerParent() override; void ActorDealloc() override;
void DeferredDestroy(); void DeferredDestroy();

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

@ -214,7 +214,7 @@ void ImageBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
} }
} }
void ImageBridgeChild::DeallocPImageBridgeChild() { this->Release(); } void ImageBridgeChild::ActorDealloc() { this->Release(); }
void ImageBridgeChild::CreateImageClientSync(SynchronousTask* aTask, void ImageBridgeChild::CreateImageClientSync(SynchronousTask* aTask,
RefPtr<ImageClient>* result, RefPtr<ImageClient>* result,

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

@ -368,7 +368,7 @@ class ImageBridgeChild final : public PImageBridgeChild,
void MarkShutDown(); void MarkShutDown();
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPImageBridgeChild() override; void ActorDealloc() override;
bool CanSend() const; bool CanSend() const;
bool CanPostTask() const; bool CanPostTask() const;

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

@ -215,7 +215,7 @@ void UiCompositorControllerChild::ActorDestroy(ActorDestroyReason aWhy) {
} }
} }
void UiCompositorControllerChild::DeallocPUiCompositorControllerChild() { void UiCompositorControllerChild::ActorDealloc() {
if (mParent) { if (mParent) {
mParent = nullptr; mParent = nullptr;
} }

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

@ -55,7 +55,7 @@ class UiCompositorControllerChild final
protected: protected:
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPUiCompositorControllerChild() override; void ActorDealloc() override;
void ProcessingError(Result aCode, const char* aReason) override; void ProcessingError(Result aCode, const char* aReason) override;
void HandleFatalError(const char* aMsg) const override; void HandleFatalError(const char* aMsg) const override;
mozilla::ipc::IPCResult RecvToolbarAnimatorMessageFromCompositor( mozilla::ipc::IPCResult RecvToolbarAnimatorMessageFromCompositor(

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

@ -213,7 +213,7 @@ UiCompositorControllerParent::RecvToolbarPixelsToCompositor(
void UiCompositorControllerParent::ActorDestroy(ActorDestroyReason aWhy) {} void UiCompositorControllerParent::ActorDestroy(ActorDestroyReason aWhy) {}
void UiCompositorControllerParent::DeallocPUiCompositorControllerParent() { void UiCompositorControllerParent::ActorDealloc() {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread()); MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
Shutdown(); Shutdown();
Release(); // For AddRef in Initialize() Release(); // For AddRef in Initialize()

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

@ -54,7 +54,7 @@ class UiCompositorControllerParent final
mozilla::ipc::IPCResult RecvToolbarPixelsToCompositor( mozilla::ipc::IPCResult RecvToolbarPixelsToCompositor(
Shmem&& aMem, const ScreenIntSize& aSize); Shmem&& aMem, const ScreenIntSize& aSize);
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPUiCompositorControllerParent() override; void ActorDealloc() override;
// Class specific functions // Class specific functions
#if defined(MOZ_WIDGET_ANDROID) #if defined(MOZ_WIDGET_ANDROID)

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

@ -77,7 +77,7 @@ void VideoBridgeChild::ActorDestroy(ActorDestroyReason aWhy) {
mCanSend = false; mCanSend = false;
} }
void VideoBridgeChild::DeallocPVideoBridgeChild() { mIPDLSelfRef = nullptr; } void VideoBridgeChild::ActorDealloc() { mIPDLSelfRef = nullptr; }
PTextureChild* VideoBridgeChild::CreateTexture( PTextureChild* VideoBridgeChild::CreateTexture(
const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock, const SurfaceDescriptor& aSharedData, const ReadLockDescriptor& aReadLock,

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

@ -33,7 +33,7 @@ class VideoBridgeChild final : public PVideoBridgeChild,
bool DeallocPTextureChild(PTextureChild* actor); bool DeallocPTextureChild(PTextureChild* actor);
void ActorDestroy(ActorDestroyReason aWhy) override; void ActorDestroy(ActorDestroyReason aWhy) override;
void DeallocPVideoBridgeChild() override; void ActorDealloc() override;
// ISurfaceAllocator // ISurfaceAllocator
bool AllocUnsafeShmem(size_t aSize, bool AllocUnsafeShmem(size_t aSize,

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

@ -38,7 +38,7 @@ void VideoBridgeParent::ActorDestroy(ActorDestroyReason aWhy) {
mClosed = true; mClosed = true;
} }
void VideoBridgeParent::DeallocPVideoBridgeParent() { void VideoBridgeParent::ActorDealloc() {
mCompositorThreadRef = nullptr; mCompositorThreadRef = nullptr;
mSelfRef = nullptr; mSelfRef = nullptr;
} }

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

@ -56,7 +56,7 @@ class VideoBridgeParent final : public PVideoBridgeParent,
void DeallocShmem(ipc::Shmem& aShmem) override; void DeallocShmem(ipc::Shmem& aShmem) override;
private: private:
void DeallocPVideoBridgeParent() override; void ActorDealloc() override;
// This keeps us alive until ActorDestroy(), at which point we do a // This keeps us alive until ActorDestroy(), at which point we do a
// deferred destruction of ourselves. // deferred destruction of ourselves.

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

@ -53,7 +53,7 @@ class InProcessChild : public PInProcessChild {
// NOTE: PInProcess lifecycle management is declared as staic methods and // NOTE: PInProcess lifecycle management is declared as staic methods and
// state on InProcessParent, and implemented in InProcessImpl.cpp. // state on InProcessParent, and implemented in InProcessImpl.cpp.
virtual void ActorDestroy(ActorDestroyReason aWhy) override; virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual void DeallocPInProcessChild() override; virtual void ActorDealloc() override;
~InProcessChild() = default; ~InProcessChild() = default;
static StaticRefPtr<InProcessChild> sSingleton; static StaticRefPtr<InProcessChild> sSingleton;

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

@ -120,12 +120,12 @@ void InProcessChild::ActorDestroy(ActorDestroyReason aWhy) {
InProcessParent::Shutdown(); InProcessParent::Shutdown();
} }
void InProcessParent::DeallocPInProcessParent() { void InProcessParent::ActorDealloc() {
MOZ_ASSERT(!InProcessParent::sSingleton); MOZ_ASSERT(!InProcessParent::sSingleton);
Release(); // Release the reference taken in InProcessParent::Startup. Release(); // Release the reference taken in InProcessParent::Startup.
} }
void InProcessChild::DeallocPInProcessChild() { void InProcessChild::ActorDealloc() {
MOZ_ASSERT(!InProcessChild::sSingleton); MOZ_ASSERT(!InProcessChild::sSingleton);
Release(); // Release the reference taken in InProcessParent::Startup. Release(); // Release the reference taken in InProcessParent::Startup.
} }

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

@ -57,7 +57,7 @@ class InProcessParent : public nsIObserver, public PInProcessParent {
private: private:
// Lifecycle management is implemented in InProcessImpl.cpp // Lifecycle management is implemented in InProcessImpl.cpp
virtual void ActorDestroy(ActorDestroyReason aWhy) override; virtual void ActorDestroy(ActorDestroyReason aWhy) override;
virtual void DeallocPInProcessParent() override; virtual void ActorDealloc() override;
~InProcessParent() = default; ~InProcessParent() = default;
static void Startup(); static void Startup();

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

@ -512,7 +512,7 @@ void StreamFilterChild::ActorDestroy(ActorDestroyReason aWhy) {
mStreamFilter = nullptr; mStreamFilter = nullptr;
} }
void StreamFilterChild::DeallocPStreamFilterChild() { void StreamFilterChild::ActorDealloc() {
RefPtr<StreamFilterChild> self = dont_AddRef(this); RefPtr<StreamFilterChild> self = dont_AddRef(this);
} }

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

@ -99,7 +99,7 @@ class StreamFilterChild final : public PStreamFilterChild,
IPCResult RecvResumed(); IPCResult RecvResumed();
IPCResult RecvFlushData(); IPCResult RecvFlushData();
virtual void DeallocPStreamFilterChild() override; virtual void ActorDealloc() override;
void SetStreamFilter(StreamFilter* aStreamFilter) { void SetStreamFilter(StreamFilter* aStreamFilter) {
mStreamFilter = aStreamFilter; mStreamFilter = aStreamFilter;

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

@ -699,7 +699,7 @@ void StreamFilterParent::ActorDestroy(ActorDestroyReason aWhy) {
} }
} }
void StreamFilterParent::DeallocPStreamFilterParent() { void StreamFilterParent::ActorDealloc() {
RefPtr<StreamFilterParent> self = dont_AddRef(this); RefPtr<StreamFilterParent> self = dont_AddRef(this);
} }

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

@ -96,7 +96,7 @@ class StreamFilterParent final : public PStreamFilterParent,
IPCResult RecvDisconnect(); IPCResult RecvDisconnect();
IPCResult RecvDestroy(); IPCResult RecvDestroy();
virtual void DeallocPStreamFilterParent() override; virtual void ActorDealloc() override;
private: private:
bool IPCActive() { bool IPCActive() {

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

@ -246,6 +246,6 @@ void ProfilerParent::ActorDestroy(ActorDestroyReason aActorDestroyReason) {
mDestroyed = true; mDestroyed = true;
} }
void ProfilerParent::DeallocPProfilerParent() { mSelfRef = nullptr; } void ProfilerParent::ActorDealloc() { mSelfRef = nullptr; }
} // namespace mozilla } // namespace mozilla

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

@ -68,7 +68,7 @@ class ProfilerParent final : public PProfilerParent {
void Init(); void Init();
void ActorDestroy(ActorDestroyReason aActorDestroyReason) override; void ActorDestroy(ActorDestroyReason aActorDestroyReason) override;
void DeallocPProfilerParent() override; void ActorDealloc() override;
RefPtr<ProfilerParent> mSelfRef; RefPtr<ProfilerParent> mSelfRef;
nsTArray<MozPromiseHolder<SingleProcessProfilePromise>> nsTArray<MozPromiseHolder<SingleProcessProfilePromise>>