Ejemplo n.º 1
0
mozilla::ipc::IPCResult
VRManagerParent::RecvCreateVRServiceTestDisplay(const nsCString& aID, const uint32_t& aPromiseID)
{
  nsTArray<VRDisplayInfo> displayInfoArray;
  impl::VRDisplayPuppet* displayPuppet = nullptr;
  VRManager* vm = VRManager::Get();
  vm->RefreshVRDisplays();

  // Get VRDisplayPuppet from VRManager
  vm->GetVRDisplayInfo(displayInfoArray);
  for (auto& displayInfo : displayInfoArray) {
    if (displayInfo.GetType() == VRDeviceType::Puppet) {
        displayPuppet = static_cast<impl::VRDisplayPuppet*>(
                        vm->GetDisplay(displayInfo.GetDisplayID()).get());
        break;
    }
  }

  MOZ_ASSERT(displayPuppet);
  MOZ_ASSERT(!mDisplayTestID); // We have only one display in VRSystemManagerPuppet.

  if (!mVRDisplayTests.Get(mDisplayTestID, nullptr)) {
    mVRDisplayTests.Put(mDisplayTestID, displayPuppet);
  }

  if (SendReplyCreateVRServiceTestDisplay(aID, aPromiseID, mDisplayTestID)) {
    return IPC_OK();
  }

  return IPC_FAIL(this, "SendReplyCreateVRServiceTestController fail");
}
Ejemplo n.º 2
0
bool
VRManagerParent::RecvGetImmediateSensorState(const uint32_t& aDisplayID, VRHMDSensorState* aState)
{
  VRManager* vm = VRManager::Get();
  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
  if (display != nullptr) {
    *aState = display->GetImmediateSensorState();
  }
  return true;
}
Ejemplo n.º 3
0
mozilla::ipc::IPCResult
VRManagerParent::RecvSetGroupMask(const uint32_t& aDisplayID, const uint32_t& aGroupMask)
{
  VRManager* vm = VRManager::Get();
  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
  if (display != nullptr) {
    display->SetGroupMask(aGroupMask);
  }
  return IPC_OK();
}
Ejemplo n.º 4
0
mozilla::ipc::IPCResult
VRManagerParent::RecvGetSensorState(const uint32_t& aDisplayID, VRHMDSensorState* aState)
{
  VRManager* vm = VRManager::Get();
  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
  if (display != nullptr) {
    *aState = display->GetSensorState();
  }
  return IPC_OK();
}
Ejemplo n.º 5
0
bool
VRManagerParent::RecvResetSensor(const uint32_t& aDisplayID)
{
  VRManager* vm = VRManager::Get();
  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
  if (display != nullptr) {
    display->ZeroSensor();
  }

  return true;
}
Ejemplo n.º 6
0
mozilla::ipc::IPCResult
VRManagerParent::RecvResetSensor(const uint32_t& aDisplayID)
{
  VRManager* vm = VRManager::Get();
  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
  if (display != nullptr) {
    display->ZeroSensor();
  }

  return IPC_OK();
}
Ejemplo n.º 7
0
bool
VRManagerParent::DeallocPVRLayerParent(PVRLayerParent* actor)
{
  gfx::VRLayerParent* layer = static_cast<gfx::VRLayerParent*>(actor);

  VRManager* vm = VRManager::Get();
  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(layer->GetDisplayID());
  if (display) {
    display->RemoveLayer(layer);
  }

  delete actor;
  return true;
}
Ejemplo n.º 8
0
PVRLayerParent*
VRManagerParent::AllocPVRLayerParent(const uint32_t& aDisplayID,
                                     const uint32_t& aGroup)
{
  RefPtr<VRLayerParent> layer;
  layer = new VRLayerParent(aDisplayID,
                            aGroup);
  VRManager* vm = VRManager::Get();
  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
  if (display) {
    display->AddLayer(layer);
  }
  return layer.forget().take();
}
Ejemplo n.º 9
0
void
VRLayerParent::Destroy()
{
  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;
  }

  if (mIPCOpen) {
    Unused << PVRLayerParent::Send__delete__(this);
  }
}
Ejemplo n.º 10
0
PVRLayerParent*
VRManagerParent::AllocPVRLayerParent(const uint32_t& aDisplayID,
                                     const float& aLeftEyeX,
                                     const float& aLeftEyeY,
                                     const float& aLeftEyeWidth,
                                     const float& aLeftEyeHeight,
                                     const float& aRightEyeX,
                                     const float& aRightEyeY,
                                     const float& aRightEyeWidth,
                                     const float& aRightEyeHeight)
{
  RefPtr<VRLayerParent> layer;
  layer = new VRLayerParent(aDisplayID,
                            Rect(aLeftEyeX, aLeftEyeY, aLeftEyeWidth, aLeftEyeHeight),
                            Rect(aRightEyeX, aRightEyeY, aRightEyeWidth, aRightEyeHeight));
  VRManager* vm = VRManager::Get();
  RefPtr<gfx::VRDisplayHost> display = vm->GetDisplay(aDisplayID);
  if (display) {
    display->AddLayer(layer);
  }
  return layer.forget().take();
}