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

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

Issue 1967633002: Updated VRService to match the latest Blink WebVR interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: And we're back to removing all the array size checks Created 4 years, 7 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 "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 21 matching lines...) Expand all
32 { 32 {
33 ASSERT(!m_service.is_bound()); 33 ASSERT(!m_service.is_bound());
34 registry->connectToRemoteService(mojo::GetProxy(&m_service)); 34 registry->connectToRemoteService(mojo::GetProxy(&m_service));
35 } 35 }
36 36
37 const char* VRController::supplementName() 37 const char* VRController::supplementName()
38 { 38 {
39 return "VRController"; 39 return "VRController";
40 } 40 }
41 41
42 void VRController::getDevices(std::unique_ptr<VRGetDevicesCallback> callback) 42 void VRController::getDisplays(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(createBaseCallback(bind<mojo::WTFArray<mojom::blink::V RDeviceInfoPtr>>(&VRController::OnGetDevices, this))); 50 m_service->GetDisplays(createBaseCallback(bind<mojo::WTFArray<mojom::blink:: VRDisplayPtr>>(&VRController::onGetDisplays, this)));
51 } 51 }
52 52
53 mojom::blink::VRSensorStatePtr VRController::getSensorState(unsigned index) 53 mojom::blink::VRPosePtr VRController::getPose(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::VRPosePtr pose;
59 m_service->GetSensorState(index, &state); 59 m_service->GetPose(index, &pose);
60 return state; 60 return pose;
61 } 61 }
62 62
63 void VRController::resetSensor(unsigned index) 63 void VRController::resetPose(unsigned index)
64 { 64 {
65 if (!m_service) 65 if (!m_service)
66 return; 66 return;
67 m_service->ResetSensor(index); 67 m_service->ResetPose(index);
68 } 68 }
69 69
70 void VRController::willDetachFrameHost() 70 void VRController::willDetachFrameHost()
71 { 71 {
72 // TODO(kphanee): Detach from the mojo service connection. 72 // TODO(kphanee): Detach from the mojo service connection.
73 } 73 }
74 74
75 void VRController::OnGetDevices(mojo::WTFArray<mojom::blink::VRDeviceInfoPtr> de vices) 75 void VRController::onGetDisplays(mojo::WTFArray<mojom::blink::VRDisplayPtr> disp lays)
76 { 76 {
77 std::unique_ptr<VRGetDevicesCallback> callback = m_pendingGetDevicesCallback s.takeFirst(); 77 std::unique_ptr<VRGetDevicesCallback> callback = m_pendingGetDevicesCallback s.takeFirst();
78 if (!callback) 78 if (!callback)
79 return; 79 return;
80 80
81 callback->onSuccess(std::move(devices)); 81 callback->onSuccess(std::move(displays));
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
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRController.h ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698