2016-02-25 02:54:50 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
|
|
|
|
#include "VRLayerParent.h"
|
2016-08-23 07:09:32 +03:00
|
|
|
#include "mozilla/Unused.h"
|
2016-02-25 02:54:50 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace gfx {
|
|
|
|
|
2017-05-09 02:01:36 +03:00
|
|
|
VRLayerParent::VRLayerParent(uint32_t aVRDisplayID, const Rect& aLeftEyeRect, const Rect& aRightEyeRect, const uint32_t aGroup)
|
2016-02-25 02:54:50 +03:00
|
|
|
: mIPCOpen(true)
|
|
|
|
, mVRDisplayID(aVRDisplayID)
|
|
|
|
, mLeftEyeRect(aLeftEyeRect)
|
|
|
|
, mRightEyeRect(aRightEyeRect)
|
2017-05-09 02:01:36 +03:00
|
|
|
, mGroup(aGroup)
|
2016-02-25 02:54:50 +03:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
VRLayerParent::~VRLayerParent()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(VRLayerParent);
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2016-02-25 02:54:50 +03:00
|
|
|
VRLayerParent::RecvDestroy()
|
|
|
|
{
|
|
|
|
Destroy();
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-02-25 02:54:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VRLayerParent::ActorDestroy(ActorDestroyReason aWhy)
|
|
|
|
{
|
|
|
|
mIPCOpen = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
VRLayerParent::Destroy()
|
|
|
|
{
|
2017-07-04 23:28:27 +03:00
|
|
|
if (mVRDisplayID) {
|
|
|
|
VRManager* vm = VRManager::Get();
|
|
|
|
RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(mVRDisplayID);
|
|
|
|
if (display) {
|
|
|
|
display->RemoveLayer(this);
|
|
|
|
}
|
|
|
|
// 0 will never be a valid VRDisplayID; we can use it to indicate that
|
|
|
|
// we are destroyed and no longer associated with a display.
|
|
|
|
mVRDisplayID = 0;
|
|
|
|
}
|
|
|
|
|
2016-02-25 02:54:50 +03:00
|
|
|
if (mIPCOpen) {
|
|
|
|
Unused << PVRLayerParent::Send__delete__(this);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult
|
2017-09-01 02:29:14 +03:00
|
|
|
VRLayerParent::RecvSubmitFrame(PTextureParent* texture,
|
|
|
|
const uint64_t& aFrameId)
|
2016-02-25 02:54:50 +03:00
|
|
|
{
|
2017-07-04 23:28:27 +03:00
|
|
|
if (mVRDisplayID) {
|
|
|
|
VRManager* vm = VRManager::Get();
|
2017-09-01 02:29:14 +03:00
|
|
|
vm->SubmitFrame(this, texture, aFrameId, mLeftEyeRect, mRightEyeRect);
|
2017-07-04 23:28:27 +03:00
|
|
|
}
|
2016-02-25 02:54:50 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
return IPC_OK();
|
2016-02-25 02:54:50 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} // namespace gfx
|
|
|
|
} // namespace mozilla
|