Bug 1400407 - Part 1: Cleanup WebVR dead code,r=daoshengmu,r=jgilbert

- VRManagerChild no longer needs to be a TextureForwarder
- VRManagerParent no longer descends from HostIPCAllocator or ShmemAllocator
- PVRManager no longer manages PTexture's
- VRLayerParent::mSize was not used and has been removed

MozReview-Commit-ID: 3bNN5FR5j7M

--HG--
extra : rebase_source : 634277825c00057bca6f8c77cdc942de61d61e9c
This commit is contained in:
Kearwood "Kip" Gilbert 2017-09-14 17:10:15 -07:00
parent 2755938ad8
commit 07bf2f8968
8 changed files with 8 additions and 200 deletions

View File

@ -323,12 +323,7 @@ SurfaceFactory::NewTexClient(const gfx::IntSize& size, const layers::LayersIPCCh
mRecycleFreePool.pop(); mRecycleFreePool.pop();
if (cur->Surf()->mSize == size){ if (cur->Surf()->mSize == size){
// In the general case, textureClients transit textures through if (aLayersChannel && aLayersChannel == cur->GetAllocator()) {
// CompositorForwarder. But, the textureClient created by VRManagerChild
// has a different LayerIPCChannel, PVRManager. Therefore, textureClients
// need to be separated into different cases.
if ((aLayersChannel && aLayersChannel == cur->GetAllocator()) ||
(cur->GetAllocator() != gfx::VRManagerChild::Get())) {
cur->Surf()->WaitForBufferOwnership(); cur->Surf()->WaitForBufferOwnership();
return cur.forget(); return cur.forget();
} }

View File

@ -9,7 +9,6 @@ include LayersSurfaces;
include protocol PLayerTransaction; include protocol PLayerTransaction;
include protocol PCompositorBridge; include protocol PCompositorBridge;
include protocol PImageBridge; include protocol PImageBridge;
include protocol PVRManager;
include protocol PVideoBridge; include protocol PVideoBridge;
include "mozilla/GfxMessageUtils.h"; include "mozilla/GfxMessageUtils.h";
include "mozilla/layers/LayersMessageUtils.h"; include "mozilla/layers/LayersMessageUtils.h";
@ -24,7 +23,7 @@ namespace layers {
* PTexture is the IPDL glue between a TextureClient and a TextureHost. * PTexture is the IPDL glue between a TextureClient and a TextureHost.
*/ */
sync protocol PTexture { sync protocol PTexture {
manager PImageBridge or PCompositorBridge or PVRManager or PVideoBridge; manager PImageBridge or PCompositorBridge or PVideoBridge;
child: child:
async __delete__(); async __delete__();

View File

@ -6,7 +6,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include LayersSurfaces; include LayersSurfaces;
include protocol PTexture;
include protocol PVRLayer; include protocol PVRLayer;
include LayersMessages; include LayersMessages;
include GamepadEventTypes; include GamepadEventTypes;
@ -33,13 +32,9 @@ namespace gfx {
*/ */
sync protocol PVRManager sync protocol PVRManager
{ {
manages PTexture;
manages PVRLayer; manages PVRLayer;
parent: parent:
async PTexture(SurfaceDescriptor aSharedData, LayersBackend aBackend,
TextureFlags aTextureFlags, uint64_t aSerial);
async PVRLayer(uint32_t aDisplayID, uint32_t aGroup); async PVRLayer(uint32_t aDisplayID, uint32_t aGroup);
// (Re)Enumerate VR Displays. An updated list of VR displays will be returned // (Re)Enumerate VR Displays. An updated list of VR displays will be returned

View File

@ -36,7 +36,6 @@ protected:
bool mIPCOpen; bool mIPCOpen;
uint32_t mVRDisplayID; uint32_t mVRDisplayID;
gfx::IntSize mSize;
gfx::Rect mLeftEyeRect; gfx::Rect mLeftEyeRect;
gfx::Rect mRightEyeRect; gfx::Rect mRightEyeRect;
uint32_t mGroup; uint32_t mGroup;

View File

@ -39,8 +39,7 @@ void ReleaseVRManagerParentSingleton() {
} }
VRManagerChild::VRManagerChild() VRManagerChild::VRManagerChild()
: TextureForwarder() : mDisplaysInitialized(false)
, mDisplaysInitialized(false)
, mMessageLoop(MessageLoop::current()) , mMessageLoop(MessageLoop::current())
, mFrameRequestCallbackCounter(0) , mFrameRequestCallbackCounter(0)
, mBackend(layers::LayersBackend::LAYERS_NONE) , mBackend(layers::LayersBackend::LAYERS_NONE)
@ -167,21 +166,6 @@ VRManagerChild::Destroy()
NewRunnableFunction(DeferredDestroy, selfRef)); NewRunnableFunction(DeferredDestroy, selfRef));
} }
layers::PTextureChild*
VRManagerChild::AllocPTextureChild(const SurfaceDescriptor&,
const LayersBackend&,
const TextureFlags&,
const uint64_t&)
{
return TextureClient::CreateIPDLActor();
}
bool
VRManagerChild::DeallocPTextureChild(PTextureChild* actor)
{
return TextureClient::DestroyIPDLActor(actor);
}
PVRLayerChild* PVRLayerChild*
VRManagerChild::AllocPVRLayerChild(const uint32_t& aDisplayID, VRManagerChild::AllocPVRLayerChild(const uint32_t& aDisplayID,
const uint32_t& aGroup) const uint32_t& aGroup)
@ -334,27 +318,6 @@ VRManagerChild::RecvParentAsyncMessages(InfallibleTArray<AsyncParentMessageData>
return IPC_OK(); return IPC_OK();
} }
PTextureChild*
VRManagerChild::CreateTexture(const SurfaceDescriptor& aSharedData,
LayersBackend aLayersBackend,
TextureFlags aFlags,
uint64_t aSerial,
wr::MaybeExternalImageId& aExternalImageId,
nsIEventTarget* aTarget)
{
return SendPTextureConstructor(aSharedData, aLayersBackend, aFlags, aSerial);
}
void
VRManagerChild::CancelWaitForRecycle(uint64_t aTextureId)
{
RefPtr<TextureClient> client = mTexturesWaitingRecycled.Get(aTextureId);
if (!client) {
return;
}
mTexturesWaitingRecycled.Remove(aTextureId);
}
void void
VRManagerChild::NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId) VRManagerChild::NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId)
{ {
@ -365,28 +328,6 @@ VRManagerChild::NotifyNotUsed(uint64_t aTextureId, uint64_t aFwdTransactionId)
mTexturesWaitingRecycled.Remove(aTextureId); mTexturesWaitingRecycled.Remove(aTextureId);
} }
bool
VRManagerChild::AllocShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem)
{
return PVRManagerChild::AllocShmem(aSize, aType, aShmem);
}
bool
VRManagerChild::AllocUnsafeShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem)
{
return PVRManagerChild::AllocUnsafeShmem(aSize, aType, aShmem);
}
bool
VRManagerChild::DeallocShmem(ipc::Shmem& aShmem)
{
return PVRManagerChild::DeallocShmem(aShmem);
}
PVRLayerChild* PVRLayerChild*
VRManagerChild::CreateVRLayer(uint32_t aDisplayID, VRManagerChild::CreateVRLayer(uint32_t aDisplayID,
nsIEventTarget* aTarget, nsIEventTarget* aTarget,

View File

@ -33,14 +33,9 @@ class VRLayerChild;
class VRDisplayClient; class VRDisplayClient;
class VRManagerChild : public PVRManagerChild class VRManagerChild : public PVRManagerChild
, public layers::TextureForwarder
, public layers::KnowsCompositor
{ {
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRManagerChild, override); NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRManagerChild);
TextureForwarder* GetTextureForwarder() override { return this; }
LayersIPCActor* GetLayersIPCActor() override { return this; }
static VRManagerChild* Get(); static VRManagerChild* Get();
@ -64,15 +59,6 @@ public:
static bool IsCreated(); static bool IsCreated();
virtual PTextureChild* CreateTexture(
const SurfaceDescriptor& aSharedData,
layers::LayersBackend aLayersBackend,
TextureFlags aFlags,
uint64_t aSerial,
wr::MaybeExternalImageId& aExternalImageId,
nsIEventTarget* aTarget = nullptr) override;
virtual void CancelWaitForRecycle(uint64_t aTextureId) override;
PVRLayerChild* CreateVRLayer(uint32_t aDisplayID, PVRLayerChild* CreateVRLayer(uint32_t aDisplayID,
nsIEventTarget* aTarget, nsIEventTarget* aTarget,
uint32_t aGroup); uint32_t aGroup);
@ -81,9 +67,6 @@ public:
layers::LayersBackend GetBackendType() const; layers::LayersBackend GetBackendType() const;
layers::SyncObjectClient* GetSyncObject() { return mSyncObject; } layers::SyncObjectClient* GetSyncObject() { return mSyncObject; }
virtual MessageLoop* GetMessageLoop() const override { return mMessageLoop; }
virtual base::ProcessId GetParentPid() const override { return OtherPid(); }
nsresult ScheduleFrameRequestCallback(mozilla::dom::FrameRequestCallback& aCallback, nsresult ScheduleFrameRequestCallback(mozilla::dom::FrameRequestCallback& aCallback,
int32_t *aHandle); int32_t *aHandle);
void CancelFrameRequestCallback(int32_t aHandle); void CancelFrameRequestCallback(int32_t aHandle);
@ -104,12 +87,6 @@ protected:
void Destroy(); void Destroy();
static void DeferredDestroy(RefPtr<VRManagerChild> aVRManagerChild); static void DeferredDestroy(RefPtr<VRManagerChild> aVRManagerChild);
virtual PTextureChild* AllocPTextureChild(const SurfaceDescriptor& aSharedData,
const layers::LayersBackend& aLayersBackend,
const TextureFlags& aFlags,
const uint64_t& aSerial) override;
virtual bool DeallocPTextureChild(PTextureChild* actor) override;
virtual PVRLayerChild* AllocPVRLayerChild(const uint32_t& aDisplayID, virtual PVRLayerChild* AllocPVRLayerChild(const uint32_t& aDisplayID,
const uint32_t& aGroup) override; const uint32_t& aGroup) override;
virtual bool DeallocPVRLayerChild(PVRLayerChild* actor) override; virtual bool DeallocPVRLayerChild(PVRLayerChild* actor) override;
@ -128,26 +105,10 @@ protected:
virtual mozilla::ipc::IPCResult RecvReplyCreateVRServiceTestController(const nsCString& aID, virtual mozilla::ipc::IPCResult RecvReplyCreateVRServiceTestController(const nsCString& aID,
const uint32_t& aPromiseID, const uint32_t& aPromiseID,
const uint32_t& aDeviceID) override; const uint32_t& aDeviceID) override;
bool IsSameProcess() const
// ShmemAllocator
virtual bool AllocShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem) override;
virtual bool AllocUnsafeShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem) override;
virtual bool DeallocShmem(ipc::Shmem& aShmem) override;
virtual bool IsSameProcess() const override
{ {
return OtherPid() == base::GetCurrentProcId(); return OtherPid() == base::GetCurrentProcId();
} }
friend class layers::CompositorBridgeChild;
private: private:
void FireDOMVRDisplayMountedEventInternal(uint32_t aDisplayID); void FireDOMVRDisplayMountedEventInternal(uint32_t aDisplayID);

View File

@ -21,8 +21,7 @@ using namespace layers;
namespace gfx { namespace gfx {
VRManagerParent::VRManagerParent(ProcessId aChildProcessId, bool aIsContentChild) VRManagerParent::VRManagerParent(ProcessId aChildProcessId, bool aIsContentChild)
: HostIPCAllocator() : mDisplayTestID(0)
, mDisplayTestID(0)
, mControllerTestID(0) , mControllerTestID(0)
, mHaveEventListener(false) , mHaveEventListener(false)
, mHaveControllerListener(false) , mHaveControllerListener(false)
@ -41,21 +40,6 @@ VRManagerParent::~VRManagerParent()
MOZ_COUNT_DTOR(VRManagerParent); MOZ_COUNT_DTOR(VRManagerParent);
} }
PTextureParent*
VRManagerParent::AllocPTextureParent(const SurfaceDescriptor& aSharedData,
const LayersBackend& aLayersBackend,
const TextureFlags& aFlags,
const uint64_t& aSerial)
{
return layers::TextureHost::CreateIPDLActor(this, aSharedData, aLayersBackend, aFlags, aSerial, Nothing());
}
bool
VRManagerParent::DeallocPTextureParent(PTextureParent* actor)
{
return layers::TextureHost::DestroyIPDLActor(actor);
}
PVRLayerParent* PVRLayerParent*
VRManagerParent::AllocPVRLayerParent(const uint32_t& aDisplayID, VRManagerParent::AllocPVRLayerParent(const uint32_t& aDisplayID,
const uint32_t& aGroup) const uint32_t& aGroup)
@ -78,52 +62,12 @@ VRManagerParent::DeallocPVRLayerParent(PVRLayerParent* actor)
return true; return true;
} }
bool
VRManagerParent::AllocShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem)
{
return PVRManagerParent::AllocShmem(aSize, aType, aShmem);
}
bool
VRManagerParent::AllocUnsafeShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem)
{
return PVRManagerParent::AllocUnsafeShmem(aSize, aType, aShmem);
}
void
VRManagerParent::DeallocShmem(ipc::Shmem& aShmem)
{
PVRManagerParent::DeallocShmem(aShmem);
}
bool bool
VRManagerParent::IsSameProcess() const VRManagerParent::IsSameProcess() const
{ {
return OtherPid() == base::GetCurrentProcId(); return OtherPid() == base::GetCurrentProcId();
} }
void
VRManagerParent::NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId)
{
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
void
VRManagerParent::SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage)
{
MOZ_ASSERT_UNREACHABLE("unexpected to be called");
}
base::ProcessId
VRManagerParent::GetChildProcessId()
{
return OtherPid();
}
void void
VRManagerParent::RegisterWithManager() VRManagerParent::RegisterWithManager()
{ {

View File

@ -28,9 +28,8 @@ class VRControllerPuppet;
} // namespace impl } // namespace impl
class VRManagerParent final : public PVRManagerParent class VRManagerParent final : public PVRManagerParent
, public HostIPCAllocator
, public ShmemAllocator
{ {
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(VRManagerParent);
public: public:
explicit VRManagerParent(ProcessId aChildProcessId, bool aIsContentChild); explicit VRManagerParent(ProcessId aChildProcessId, bool aIsContentChild);
@ -38,40 +37,15 @@ public:
static bool CreateForGPUProcess(Endpoint<PVRManagerParent>&& aEndpoint); static bool CreateForGPUProcess(Endpoint<PVRManagerParent>&& aEndpoint);
static bool CreateForContent(Endpoint<PVRManagerParent>&& aEndpoint); static bool CreateForContent(Endpoint<PVRManagerParent>&& aEndpoint);
virtual base::ProcessId GetChildProcessId() override; bool IsSameProcess() const;
// ShmemAllocator
virtual ShmemAllocator* AsShmemAllocator() override { return this; }
virtual bool AllocShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem) override;
virtual bool AllocUnsafeShmem(size_t aSize,
ipc::SharedMemory::SharedMemoryType aType,
ipc::Shmem* aShmem) override;
virtual void DeallocShmem(ipc::Shmem& aShmem) override;
virtual bool IsSameProcess() const override;
bool HaveEventListener(); bool HaveEventListener();
bool HaveControllerListener(); bool HaveControllerListener();
virtual void NotifyNotUsed(PTextureParent* aTexture, uint64_t aTransactionId) override;
virtual void SendAsyncMessage(const InfallibleTArray<AsyncParentMessageData>& aMessage) override;
bool SendGamepadUpdate(const GamepadChangeEvent& aGamepadEvent); bool SendGamepadUpdate(const GamepadChangeEvent& aGamepadEvent);
bool SendReplyGamepadVibrateHaptic(const uint32_t& aPromiseID); bool SendReplyGamepadVibrateHaptic(const uint32_t& aPromiseID);
protected: protected:
~VRManagerParent(); ~VRManagerParent();
virtual PTextureParent* AllocPTextureParent(const SurfaceDescriptor& aSharedData,
const LayersBackend& aLayersBackend,
const TextureFlags& aFlags,
const uint64_t& aSerial) override;
virtual bool DeallocPTextureParent(PTextureParent* actor) override;
virtual PVRLayerParent* AllocPVRLayerParent(const uint32_t& aDisplayID, virtual PVRLayerParent* AllocPVRLayerParent(const uint32_t& aDisplayID,
const uint32_t& aGroup) override; const uint32_t& aGroup) override;
virtual bool DeallocPVRLayerParent(PVRLayerParent* actor) override; virtual bool DeallocPVRLayerParent(PVRLayerParent* actor) override;