| 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 "core/frame/LocalFrame.h" | 7 #include "core/frame/LocalFrame.h" |
| 8 #include "modules/vr/VRGetDevicesCallback.h" | 8 #include "modules/vr/VRGetDevicesCallback.h" |
| 9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
| 10 #include "platform/mojo/MojoHelper.h" | 10 #include "platform/mojo/MojoHelper.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 } | 40 } |
| 41 | 41 |
| 42 void VRController::getDevices(std::unique_ptr<VRGetDevicesCallback> callback) | 42 void VRController::getDevices(std::unique_ptr<VRGetDevicesCallback> callback) |
| 43 { | 43 { |
| 44 if (!m_service) { | 44 if (!m_service) { |
| 45 callback->onError(); | 45 callback->onError(); |
| 46 return; | 46 return; |
| 47 } | 47 } |
| 48 | 48 |
| 49 m_pendingGetDevicesCallbacks.append(std::move(callback)); | 49 m_pendingGetDevicesCallbacks.append(std::move(callback)); |
| 50 m_service->GetDevices(sameThreadBindForMojo(&VRController::OnGetDevices, thi
s)); | 50 m_service->GetDevices(createBaseCallback(bind<mojo::WTFArray<mojom::blink::V
RDeviceInfoPtr>>(&VRController::OnGetDevices, this))); |
| 51 } | 51 } |
| 52 | 52 |
| 53 mojom::blink::VRSensorStatePtr VRController::getSensorState(unsigned index) | 53 mojom::blink::VRSensorStatePtr VRController::getSensorState(unsigned index) |
| 54 { | 54 { |
| 55 if (!m_service) | 55 if (!m_service) |
| 56 return nullptr; | 56 return nullptr; |
| 57 | 57 |
| 58 mojom::blink::VRSensorStatePtr state; | 58 mojom::blink::VRSensorStatePtr state; |
| 59 m_service->GetSensorState(index, &state); | 59 m_service->GetSensorState(index, &state); |
| 60 return state; | 60 return state; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 81 callback->onSuccess(std::move(devices)); | 81 callback->onSuccess(std::move(devices)); |
| 82 } | 82 } |
| 83 | 83 |
| 84 DEFINE_TRACE(VRController) | 84 DEFINE_TRACE(VRController) |
| 85 { | 85 { |
| 86 Supplement<LocalFrame>::trace(visitor); | 86 Supplement<LocalFrame>::trace(visitor); |
| 87 LocalFrameLifecycleObserver::trace(visitor); | 87 LocalFrameLifecycleObserver::trace(visitor); |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // namespace blink | 90 } // namespace blink |
| OLD | NEW |