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

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

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