diff options
Diffstat (limited to 'dom/base/Navigator.cpp')
-rw-r--r-- | dom/base/Navigator.cpp | 78 |
1 files changed, 0 insertions, 78 deletions
diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 1bc4f82f4..286cd0e79 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -44,7 +44,6 @@ #include "mozilla/dom/ServiceWorkerContainer.h" #include "mozilla/dom/StorageManager.h" #include "mozilla/dom/TCPSocket.h" -#include "mozilla/dom/VRDisplay.h" #include "mozilla/dom/workers/RuntimeService.h" #include "mozilla/Hal.h" #include "nsISiteSpecificUserAgent.h" @@ -1471,83 +1470,6 @@ Navigator::RequestGamepadServiceTest() } #endif -already_AddRefed<Promise> -Navigator::GetVRDisplays(ErrorResult& aRv) -{ - if (!mWindow || !mWindow->GetDocShell()) { - aRv.Throw(NS_ERROR_UNEXPECTED); - return nullptr; - } - - nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow); - win->NotifyVREventListenerAdded(); - - nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow); - RefPtr<Promise> p = Promise::Create(go, aRv); - if (aRv.Failed()) { - return nullptr; - } - - // We pass mWindow's id to RefreshVRDisplays, so NotifyVRDisplaysUpdated will - // be called asynchronously, resolving the promises in mVRGetDisplaysPromises. - if (!VRDisplay::RefreshVRDisplays(win->WindowID())) { - p->MaybeReject(NS_ERROR_FAILURE); - return p.forget(); - } - - mVRGetDisplaysPromises.AppendElement(p); - return p.forget(); -} - -void -Navigator::GetActiveVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDisplays) const -{ - /** - * Get only the active VR displays. - * Callers do not wish to VRDisplay::RefreshVRDisplays, as the enumeration may - * activate hardware that is not yet intended to be used. - */ - if (!mWindow || !mWindow->GetDocShell()) { - return; - } - nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow); - win->NotifyVREventListenerAdded(); - nsTArray<RefPtr<VRDisplay>> displays; - if (win->UpdateVRDisplays(displays)) { - for (auto display : displays) { - if (display->IsPresenting()) { - aDisplays.AppendElement(display); - } - } - } -} - -void -Navigator::NotifyVRDisplaysUpdated() -{ - // Synchronize the VR devices and resolve the promises in - // mVRGetDisplaysPromises - nsGlobalWindow* win = nsGlobalWindow::Cast(mWindow); - - nsTArray<RefPtr<VRDisplay>> vrDisplays; - if (win->UpdateVRDisplays(vrDisplays)) { - for (auto p : mVRGetDisplaysPromises) { - p->MaybeResolve(vrDisplays); - } - } else { - for (auto p : mVRGetDisplaysPromises) { - p->MaybeReject(NS_ERROR_FAILURE); - } - } - mVRGetDisplaysPromises.Clear(); -} - -void -Navigator::NotifyActiveVRDisplaysChanged() -{ - NavigatorBinding::ClearCachedActiveVRDisplaysValue(this); -} - //***************************************************************************** // Navigator::nsIMozNavigatorNetwork //***************************************************************************** |