| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "modules/vr/VRController.h" | 5 #include "modules/vr/VRController.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/ScriptPromiseResolver.h" | 7 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| 8 #include "core/dom/DOMException.h" | 8 #include "core/dom/DOMException.h" |
| 9 #include "core/dom/Document.h" | 9 #include "core/dom/Document.h" |
| 10 #include "core/frame/LocalFrame.h" | 10 #include "core/frame/LocalFrame.h" |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 // If we've previously synced the VRDisplays or no longer have a valid service | 37 // If we've previously synced the VRDisplays or no longer have a valid service |
| 38 // connection just return the current list. In the case of the service being | 38 // connection just return the current list. In the case of the service being |
| 39 // disconnected this will be an empty array. | 39 // disconnected this will be an empty array. |
| 40 if (!m_service || m_displaySynced) { | 40 if (!m_service || m_displaySynced) { |
| 41 resolver->resolve(m_displays); | 41 resolver->resolve(m_displays); |
| 42 return; | 42 return; |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Otherwise we're still waiting for the full list of displays to be populated | 45 // Otherwise we're still waiting for the full list of displays to be populated |
| 46 // so queue up the promise for resolution when onDisplaysSynced is called. | 46 // so queue up the promise for resolution when onDisplaysSynced is called. |
| 47 m_pendingGetDevicesCallbacks.append( | 47 m_pendingGetDevicesCallbacks.push_back( |
| 48 WTF::makeUnique<VRGetDevicesCallback>(resolver)); | 48 WTF::makeUnique<VRGetDevicesCallback>(resolver)); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void VRController::setListeningForActivate(bool listening) { | 51 void VRController::setListeningForActivate(bool listening) { |
| 52 if (m_service) | 52 if (m_service) |
| 53 m_service->SetListeningForActivate(listening); | 53 m_service->SetListeningForActivate(listening); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Each time a new VRDisplay is connected we'll recieve a VRDisplayPtr for it | 56 // Each time a new VRDisplay is connected we'll recieve a VRDisplayPtr for it |
| 57 // here. Upon calling SetClient in the constructor we should receive one call | 57 // here. Upon calling SetClient in the constructor we should receive one call |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 } | 117 } |
| 118 | 118 |
| 119 DEFINE_TRACE(VRController) { | 119 DEFINE_TRACE(VRController) { |
| 120 visitor->trace(m_navigatorVR); | 120 visitor->trace(m_navigatorVR); |
| 121 visitor->trace(m_displays); | 121 visitor->trace(m_displays); |
| 122 | 122 |
| 123 ContextLifecycleObserver::trace(visitor); | 123 ContextLifecycleObserver::trace(visitor); |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace blink | 126 } // namespace blink |
| OLD | NEW |