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 "config.h" | 5 #include "config.h" |
6 #include "modules/vr/VRController.h" | 6 #include "modules/vr/VRController.h" |
7 | 7 |
8 #include "core/frame/LocalFrame.h" | 8 #include "core/frame/LocalFrame.h" |
9 #include "platform/RuntimeEnabledFeatures.h" | 9 #include "platform/RuntimeEnabledFeatures.h" |
10 | 10 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 if (!m_client) { | 44 if (!m_client) { |
45 callback->onError(); | 45 callback->onError(); |
46 delete callback; | 46 delete callback; |
47 return; | 47 return; |
48 } | 48 } |
49 | 49 |
50 // Client is expected to take ownership of the callback | 50 // Client is expected to take ownership of the callback |
51 m_client->getDevices(callback); | 51 m_client->getDevices(callback); |
52 } | 52 } |
53 | 53 |
54 void VRController::getSensorState(unsigned index, blink::WebHMDSensorState& into
) | 54 void VRController::getSensorState(unsigned index, WebHMDSensorState& into) |
55 { | 55 { |
56 // When detached, the client is no longer valid. | 56 // When detached, the client is no longer valid. |
57 if (!m_client) | 57 if (!m_client) |
58 return; | 58 return; |
59 m_client->getSensorState(index, into); | 59 m_client->getSensorState(index, into); |
60 } | 60 } |
61 | 61 |
62 void VRController::resetSensor(unsigned index) | 62 void VRController::resetSensor(unsigned index) |
63 { | 63 { |
64 // When detached, the client is no longer valid. | 64 // When detached, the client is no longer valid. |
65 if (!m_client) | 65 if (!m_client) |
66 return; | 66 return; |
67 m_client->resetSensor(index); | 67 m_client->resetSensor(index); |
68 } | 68 } |
69 | 69 |
70 void VRController::willDetachFrameHost() | 70 void VRController::willDetachFrameHost() |
71 { | 71 { |
72 m_client = nullptr; | 72 m_client = nullptr; |
73 } | 73 } |
74 | 74 |
75 DEFINE_TRACE(VRController) | 75 DEFINE_TRACE(VRController) |
76 { | 76 { |
77 WillBeHeapSupplement<LocalFrame>::trace(visitor); | 77 WillBeHeapSupplement<LocalFrame>::trace(visitor); |
78 LocalFrameLifecycleObserver::trace(visitor); | 78 LocalFrameLifecycleObserver::trace(visitor); |
79 } | 79 } |
80 | 80 |
81 } // namespace blink | 81 } // namespace blink |
OLD | NEW |