Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(933)

Side by Side Diff: third_party/WebKit/Source/modules/vr/VRController.cpp

Issue 1808203005: [OnionSoup] Moving VR service from content to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked as per comments! Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 {
(...skipping 10 matching lines...) Expand all
21 WillBeHeapSupplement<LocalFrame>::provideTo(frame, supplementName(), adoptPt rWillBeNoop(controller)); 21 WillBeHeapSupplement<LocalFrame>::provideTo(frame, supplementName(), adoptPt rWillBeNoop(controller));
22 } 22 }
23 23
24 VRController* VRController::from(LocalFrame& frame) 24 VRController* VRController::from(LocalFrame& frame)
25 { 25 {
26 return static_cast<VRController*>(WillBeHeapSupplement<LocalFrame>::from(fra me, supplementName())); 26 return static_cast<VRController*>(WillBeHeapSupplement<LocalFrame>::from(fra me, supplementName()));
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(static_cast<VRDispatcher*>(client))
32 { 32 {
33 } 33 }
34 34
35 const char* VRController::supplementName() 35 const char* VRController::supplementName()
36 { 36 {
37 return "VRController"; 37 return "VRController";
38 } 38 }
39 39
40 void VRController::getDevices(WebVRGetDevicesCallback* callback) 40 void VRController::getDevices(WebVRGetDevicesCallback* callback)
41 { 41 {
(...skipping 19 matching lines...) Expand all
61 void VRController::resetSensor(unsigned index) 61 void VRController::resetSensor(unsigned index)
62 { 62 {
63 // When detached, the client is no longer valid. 63 // When detached, the client is no longer valid.
64 if (!m_client) 64 if (!m_client)
65 return; 65 return;
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;
haraken 2016/03/22 02:39:20 Not related to this CL, can we add ASSERT(!m_clien
RaviKasibhatla 2016/03/23 15:20:50 Done.
72 } 72 }
73 73
74 DEFINE_TRACE(VRController) 74 DEFINE_TRACE(VRController)
75 { 75 {
76 WillBeHeapSupplement<LocalFrame>::trace(visitor); 76 WillBeHeapSupplement<LocalFrame>::trace(visitor);
77 LocalFrameLifecycleObserver::trace(visitor); 77 LocalFrameLifecycleObserver::trace(visitor);
78 visitor->trace(m_client);
78 } 79 }
79 80
80 } // namespace blink 81 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698