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

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

Issue 2453973002: WIP WebVR mojo refactor (Closed)
Patch Set: Fixed crash. VR data doesn't seem to be polling correctly, though. Created 4 years, 1 month 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 #ifndef VRController_h 5 #ifndef VRController_h
6 #define VRController_h 6 #define VRController_h
7 7
8 #include "core/dom/ContextLifecycleObserver.h" 8 #include "core/dom/ContextLifecycleObserver.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "device/vr/vr_service.mojom-blink.h" 10 #include "device/vr/vr_service.mojom-blink.h"
11 #include "modules/vr/VRDisplay.h" 11 #include "modules/vr/VRDisplay.h"
12 #include "mojo/public/cpp/bindings/binding.h" 12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "platform/heap/Handle.h" 13 #include "platform/heap/Handle.h"
14 #include "wtf/Deque.h" 14 #include "wtf/Deque.h"
15 15
16 #include <memory> 16 #include <memory>
17 17
18 namespace blink { 18 namespace blink {
19 19
20 class NavigatorVR; 20 class NavigatorVR;
21 class VRGetDevicesCallback; 21 class VRGetDevicesCallback;
22 22
23 class VRController final : public GarbageCollectedFinalized<VRController>, 23 class VRController final : public GarbageCollectedFinalized<VRController>,
24 public device::blink::VRServiceClient, 24 public device::mojom::blink::VRServiceClient,
25 public ContextLifecycleObserver { 25 public ContextLifecycleObserver {
26 USING_GARBAGE_COLLECTED_MIXIN(VRController); 26 USING_GARBAGE_COLLECTED_MIXIN(VRController);
27 WTF_MAKE_NONCOPYABLE(VRController); 27 WTF_MAKE_NONCOPYABLE(VRController);
28 28
29 public: 29 public:
30 VRController(NavigatorVR*); 30 VRController(NavigatorVR*);
31 virtual ~VRController(); 31 virtual ~VRController();
32 32
33 // VRService.
34 void getDisplays(ScriptPromiseResolver*); 33 void getDisplays(ScriptPromiseResolver*);
35 device::blink::VRPosePtr getPose(unsigned index);
36 void resetPose(unsigned index);
37 void requestPresent(ScriptPromiseResolver*,
38 unsigned index,
39 bool secureOrigin);
40 void exitPresent(unsigned index);
41 void submitFrame(unsigned index, device::blink::VRPosePtr);
42 void updateLayerBounds(unsigned index,
43 device::blink::VRLayerBoundsPtr leftBounds,
44 device::blink::VRLayerBoundsPtr rightBounds);
45 34
46 VRDisplay* createOrUpdateDisplay(const device::blink::VRDisplayPtr&); 35 // void GetDisplayClient(const GetDisplayClientCallback&) override;
47 VRDisplayVector updateDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>); 36 void OnDisplayConnected(device::mojom::blink::VRDisplayPtr,
48 VRDisplay* getDisplayForIndex(unsigned index); 37 device::mojom::blink::VRDisplayInfoPtr) override;
49 38
50 DECLARE_VIRTUAL_TRACE(); 39 DECLARE_VIRTUAL_TRACE();
51 40
52 private: 41 private:
53 // Binding callbacks. 42 void onDisplaysSynced(bool);
54 void onGetDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>);
55 void onPresentComplete(ScriptPromiseResolver*, unsigned index, bool success);
56
57 // VRServiceClient.
58 void OnDisplayChanged(device::blink::VRDisplayPtr) override;
59 void OnExitPresent(unsigned index) override;
60 void OnDisplayConnected(device::blink::VRDisplayPtr) override;
61 void OnDisplayDisconnected(unsigned) override;
62 43
63 // ContextLifecycleObserver. 44 // ContextLifecycleObserver.
64 void contextDestroyed() override; 45 void contextDestroyed() override;
65 46
66 Member<NavigatorVR> m_navigatorVR; 47 Member<NavigatorVR> m_navigatorVR;
67 VRDisplayVector m_displays; 48 VRDisplayVector m_displays;
68 49
50 bool m_displaySynced;
51
69 Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks; 52 Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks;
70 device::blink::VRServicePtr m_service; 53 device::mojom::blink::VRServicePtr m_service;
71 mojo::Binding<device::blink::VRServiceClient> m_binding; 54 mojo::Binding<device::mojom::blink::VRServiceClient> m_binding;
72 }; 55 };
73 56
74 } // namespace blink 57 } // namespace blink
75 58
76 #endif // VRController_h 59 #endif // VRController_h
OLDNEW
« no previous file with comments | « device/vr/vr_service_impl_unittest.cc ('k') | third_party/WebKit/Source/modules/vr/VRController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698