Bug 1824465 - Part 12: Make PUICompositorController refcounted, r=ipc-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D173727
This commit is contained in:
Nika Layzell 2023-04-19 22:10:09 +00:00
parent b6c54cb5d6
commit 65fcf6d598
5 changed files with 4 additions and 19 deletions

View File

@ -20,7 +20,7 @@ namespace layers {
* compositor from the UI thread. Primarily used on Android to coordinate registering and
* releasing the surface with the compositor.
*/
[ManualDealloc, NeedsOtherPid]
[NeedsOtherPid]
sync protocol PUiCompositorController
{

View File

@ -200,13 +200,6 @@ void UiCompositorControllerChild::ActorDestroy(ActorDestroyReason aWhy) {
}
}
void UiCompositorControllerChild::ActorDealloc() {
if (mParent) {
mParent = nullptr;
}
Release();
}
void UiCompositorControllerChild::ProcessingError(Result aCode,
const char* aReason) {
if (aCode != MsgDropped) {
@ -272,7 +265,6 @@ void UiCompositorControllerChild::OpenForSameProcess() {
}
mParent->InitializeForSameProcess();
AddRef();
SendCachedValues();
// Let Ui thread know the connection is open;
RecvToolbarAnimatorMessageFromCompositor(COMPOSITOR_CONTROLLER_OPEN);
@ -293,7 +285,6 @@ void UiCompositorControllerChild::OpenForGPUProcess(
return;
}
AddRef();
SendCachedValues();
// Let Ui thread know the connection is open;
RecvToolbarAnimatorMessageFromCompositor(COMPOSITOR_CONTROLLER_OPEN);

View File

@ -29,7 +29,7 @@ class UiCompositorControllerChild final
friend class PUiCompositorControllerChild;
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(UiCompositorControllerChild)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(UiCompositorControllerChild, final)
static RefPtr<UiCompositorControllerChild> CreateForSameProcess(
const LayersId& aRootLayerTreeId, nsBaseWidget* aWidget);
@ -76,7 +76,6 @@ class UiCompositorControllerChild final
protected:
void ActorDestroy(ActorDestroyReason aWhy) override;
void ActorDealloc() override;
void ProcessingError(Result aCode, const char* aReason) override;
void HandleFatalError(const char* aMsg) const override;
mozilla::ipc::IPCResult RecvToolbarAnimatorMessageFromCompositor(

View File

@ -163,12 +163,9 @@ UiCompositorControllerParent::RecvEnableLayerUpdateNotifications(
return IPC_OK();
}
void UiCompositorControllerParent::ActorDestroy(ActorDestroyReason aWhy) {}
void UiCompositorControllerParent::ActorDealloc() {
void UiCompositorControllerParent::ActorDestroy(ActorDestroyReason aWhy) {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
Shutdown();
Release(); // For AddRef in Initialize()
}
void UiCompositorControllerParent::ToolbarAnimatorMessageFromCompositor(
@ -263,7 +260,6 @@ void UiCompositorControllerParent::InitializeForOutOfProcess() {
void UiCompositorControllerParent::Initialize() {
MOZ_ASSERT(CompositorThreadHolder::IsInCompositorThread());
AddRef();
LayerTreeState* state =
CompositorBridgeParent::GetIndirectShadowTree(mRootLayerTreeId);
MOZ_ASSERT(state);

View File

@ -23,7 +23,7 @@ class UiCompositorControllerParent final
friend class UiCompositorControllerChild;
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(UiCompositorControllerParent)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(UiCompositorControllerParent, final)
static RefPtr<UiCompositorControllerParent> GetFromRootLayerTreeId(
const LayersId& aRootLayerTreeId);
@ -46,7 +46,6 @@ class UiCompositorControllerParent final
mozilla::ipc::IPCResult RecvEnableLayerUpdateNotifications(
const bool& aEnable);
void ActorDestroy(ActorDestroyReason aWhy) override;
void ActorDealloc() override;
// Class specific functions
void ToolbarAnimatorMessageFromCompositor(int32_t aMessage);