Bug 1824465 - Part 15: Make PVRGPU refcounted, r=ipc-reviewers,mccr8

Differential Revision: https://phabricator.services.mozilla.com/D173730
This commit is contained in:
Nika Layzell 2023-04-19 22:10:09 +00:00
parent ba88b2535d
commit f47a74ba59
4 changed files with 4 additions and 13 deletions

View File

@ -11,7 +11,7 @@ namespace gfx {
// The parent process is the VR process.
// The child process is the GPU process.
[ManualDealloc, NeedsOtherPid, ChildImpl="VRGPUChild", ParentImpl="VRGPUParent"]
[NeedsOtherPid, ChildImpl="VRGPUChild", ParentImpl="VRGPUParent"]
async protocol PVRGPU
{
parent:

View File

@ -14,7 +14,7 @@ namespace gfx {
class VRGPUChild final : public PVRGPUChild {
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRGPUChild);
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRGPUChild, final);
static VRGPUChild* Get();
static bool InitForGPUProcess(Endpoint<PVRGPUChild>&& aEndpoint);

View File

@ -17,13 +17,12 @@ namespace gfx {
using namespace ipc;
VRGPUParent::VRGPUParent(ProcessId aChildProcessId) : mClosed(false) {
MOZ_COUNT_CTOR(VRGPUParent);
MOZ_ASSERT(NS_IsMainThread());
SetOtherProcessId(aChildProcessId);
}
VRGPUParent::~VRGPUParent() { MOZ_COUNT_DTOR(VRGPUParent); }
VRGPUParent::~VRGPUParent() = default;
void VRGPUParent::ActorDestroy(ActorDestroyReason aWhy) {
#if !defined(MOZ_WIDGET_ANDROID)
@ -34,13 +33,8 @@ void VRGPUParent::ActorDestroy(ActorDestroyReason aWhy) {
#endif
mClosed = true;
GetCurrentSerialEventTarget()->Dispatch(
NewRunnableMethod("gfx::VRGPUParent::DeferredDestroy", this,
&VRGPUParent::DeferredDestroy));
}
void VRGPUParent::DeferredDestroy() { mSelfRef = nullptr; }
/* static */
RefPtr<VRGPUParent> VRGPUParent::CreateForGPU(
Endpoint<PVRGPUParent>&& aEndpoint) {
@ -61,8 +55,6 @@ void VRGPUParent::Bind(Endpoint<PVRGPUParent>&& aEndpoint) {
if (!aEndpoint.Bind(this)) {
return;
}
mSelfRef = this;
}
mozilla::ipc::IPCResult VRGPUParent::RecvStartVRService() {

View File

@ -14,7 +14,7 @@ namespace mozilla {
namespace gfx {
class VRGPUParent final : public PVRGPUParent {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRGPUParent)
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRGPUParent, final)
friend class PVRGPUParent;
@ -37,7 +37,6 @@ class VRGPUParent final : public PVRGPUParent {
void DeferredDestroy();
RefPtr<VRGPUParent> mSelfRef;
#if !defined(MOZ_WIDGET_ANDROID)
RefPtr<VRService> mVRService;
#endif