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

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

Issue 2494733002: Reland of mojo VR interface simpified. (Closed)
Patch Set: Fix Werror 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 USING_PRE_FINALIZER(VRController, dispose);
28 29
29 public: 30 public:
30 VRController(NavigatorVR*); 31 VRController(NavigatorVR*);
31 virtual ~VRController(); 32 virtual ~VRController();
32 33
33 // VRService.
34 void getDisplays(ScriptPromiseResolver*); 34 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 35
46 VRDisplay* createOrUpdateDisplay(const device::blink::VRDisplayPtr&); 36 void OnDisplayConnected(device::mojom::blink::VRDisplayPtr,
47 VRDisplayVector updateDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>); 37 device::mojom::blink::VRDisplayClientRequest,
48 VRDisplay* getDisplayForIndex(unsigned index); 38 device::mojom::blink::VRDisplayInfoPtr) override;
49 39
50 DECLARE_VIRTUAL_TRACE(); 40 DECLARE_VIRTUAL_TRACE();
51 41
52 private: 42 private:
53 // Binding callbacks. 43 void onDisplaysSynced(unsigned);
54 void onGetDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>); 44 void onGetDisplays();
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 45
63 // ContextLifecycleObserver. 46 // ContextLifecycleObserver.
64 void contextDestroyed() override; 47 void contextDestroyed() override;
48 void dispose();
65 49
66 Member<NavigatorVR> m_navigatorVR; 50 Member<NavigatorVR> m_navigatorVR;
67 VRDisplayVector m_displays; 51 VRDisplayVector m_displays;
68 52
53 bool m_displaySynced;
54 unsigned m_numberOfSyncedDisplays;
55
69 Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks; 56 Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks;
70 device::blink::VRServicePtr m_service; 57 device::mojom::blink::VRServicePtr m_service;
71 mojo::Binding<device::blink::VRServiceClient> m_binding; 58 mojo::Binding<device::mojom::blink::VRServiceClient> m_binding;
72 }; 59 };
73 60
74 } // namespace blink 61 } // namespace blink
75 62
76 #endif // VRController_h 63 #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