/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* 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"VRManagerParent.h"
#include"ipc/VRLayerParent.h" #include"mozilla/gfx/PVRManagerParent.h" #include"mozilla/ipc/Endpoint.h" #include"mozilla/ipc/ProtocolTypes.h" #include"mozilla/StaticPrefs_dom.h" #include"mozilla/ipc/ProtocolUtils.h"// for IToplevelProtocol #include"mozilla/TimeStamp.h"// for TimeStamp #include"mozilla/Unused.h" #include"VRManager.h" #include"VRThread.h"
using mozilla::dom::GamepadHandle;
namespace mozilla { usingnamespace layers; namespace gfx {
// See VRManagerChild.cpp void ReleaseVRManagerParentSingleton();
/*static*/ void VRManagerParent::Shutdown() {
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(
CompositorThread(), "Shutdown() must gets called before the compositor thread is shutdown");
ReleaseVRManagerParentSingleton();
CompositorThread()->Dispatch(NS_NewRunnableFunction( "VRManagerParent::Shutdown",
[vm = RefPtr<VRManager>(VRManager::MaybeGet())]() -> void { if (!vm) { return;
}
vm->ShutdownVRManagerParents();
}));
}
mozilla::ipc::IPCResult VRManagerParent::RecvDetectRuntimes() { // Detect runtime capabilities. This will return the presense of VR and/or AR // runtime software, without enumerating or activating any hardware devices. // UpdateDisplayInfo will be sent to VRManagerChild with the results of the // detection.
VRManager* vm = VRManager::Get();
vm->DetectRuntimes();
return IPC_OK();
}
mozilla::ipc::IPCResult VRManagerParent::RecvRefreshDisplays() { // This is called to activate the VR runtimes, detecting the // presence and capabilities of XR hardware. // UpdateDisplayInfo will be sent to VRManagerChild with the results of the // enumerated hardware.
VRManager* vm = VRManager::Get();
vm->EnumerateDevices();
mozilla::ipc::IPCResult VRManagerParent::RecvControllerListenerAdded() { // Force update the available controllers for GamepadManager,
VRManager* vm = VRManager::Get();
vm->StopAllHaptics();
mHaveControllerListener = true; return IPC_OK();
}
mozilla::ipc::IPCResult VRManagerParent::RecvRunPuppet( const nsTArray<uint64_t>& aBuffer) { #ifdefined(MOZ_WIDGET_ANDROID) // Not yet implemented for Android / GeckoView // See Bug 1555192
Unused << SendNotifyPuppetCommandBufferCompleted(false); #else
VRManager* vm = VRManager::Get(); if (!vm->RunPuppet(aBuffer, this)) { // We have immediately failed, need to resolve the // promise right away
Unused << SendNotifyPuppetCommandBufferCompleted(false);
} #endif// defined(MOZ_WIDGET_ANDROID) return IPC_OK();
}
mozilla::ipc::IPCResult VRManagerParent::RecvResetPuppet() { #ifdefined(MOZ_WIDGET_ANDROID) // Not yet implemented for Android / GeckoView // See Bug 1555192 #else
VRManager* vm = VRManager::Get();
vm->ResetPuppet(this); #endif// defined(MOZ_WIDGET_ANDROID) return IPC_OK();
}
bool VRManagerParent::SendReplyGamepadVibrateHaptic( const uint32_t& aPromiseID) { // GamepadManager only exists at the content process // or the same process in non-e10s mode. if (mHaveControllerListener && (mIsContentChild || IsSameProcess())) { return PVRManagerParent::SendReplyGamepadVibrateHaptic(aPromiseID);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.