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 "platform/RuntimeEnabledFeatures.h" | 8 #include "platform/RuntimeEnabledFeatures.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 VRController::~VRController() | 12 VRController::~VRController() |
13 { | 13 { |
14 } | 14 } |
15 | 15 |
16 void VRController::provideTo(LocalFrame& frame, WebVRClient* client) | 16 void VRController::provideTo(LocalFrame& frame, WebVRClient* client) |
17 { | 17 { |
18 ASSERT(RuntimeEnabledFeatures::webVREnabled()); | 18 ASSERT(RuntimeEnabledFeatures::webVREnabled()); |
19 | 19 |
20 VRController* controller = new VRController(frame, client); | 20 VRController* controller = new VRController(frame, client); |
21 HeapSupplement<LocalFrame>::provideTo(frame, supplementName(), controller); | 21 Supplement<LocalFrame>::provideTo(frame, supplementName(), controller); |
22 } | 22 } |
23 | 23 |
24 VRController* VRController::from(LocalFrame& frame) | 24 VRController* VRController::from(LocalFrame& frame) |
25 { | 25 { |
26 return static_cast<VRController*>(HeapSupplement<LocalFrame>::from(frame, su
pplementName())); | 26 return static_cast<VRController*>(Supplement<LocalFrame>::from(frame, supple
mentName())); |
27 } | 27 } |
28 | 28 |
29 VRController::VRController(LocalFrame& frame, WebVRClient* client) | 29 VRController::VRController(LocalFrame& frame, WebVRClient* client) |
30 : LocalFrameLifecycleObserver(&frame) | 30 : LocalFrameLifecycleObserver(&frame) |
31 , m_client(client) | 31 , m_client(client) |
32 { | 32 { |
33 } | 33 } |
34 | 34 |
35 const char* VRController::supplementName() | 35 const char* VRController::supplementName() |
36 { | 36 { |
(...skipping 29 matching lines...) Expand all Loading... |
66 m_client->resetSensor(index); | 66 m_client->resetSensor(index); |
67 } | 67 } |
68 | 68 |
69 void VRController::willDetachFrameHost() | 69 void VRController::willDetachFrameHost() |
70 { | 70 { |
71 m_client = nullptr; | 71 m_client = nullptr; |
72 } | 72 } |
73 | 73 |
74 DEFINE_TRACE(VRController) | 74 DEFINE_TRACE(VRController) |
75 { | 75 { |
76 HeapSupplement<LocalFrame>::trace(visitor); | 76 Supplement<LocalFrame>::trace(visitor); |
77 LocalFrameLifecycleObserver::trace(visitor); | 77 LocalFrameLifecycleObserver::trace(visitor); |
78 } | 78 } |
79 | 79 |
80 } // namespace blink | 80 } // namespace blink |
OLD | NEW |