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

Side by Side Diff: device/vr/vr_service_impl.h

Issue 2420743003: mojo VR interface simplified (Closed)
Patch Set: Address bajones@ comments and some clean up Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 DEVICE_VR_VR_SERVICE_IMPL_H 5 #ifndef DEVICE_VR_VR_SERVICE_IMPL_H
6 #define DEVICE_VR_VR_SERVICE_IMPL_H 6 #define DEVICE_VR_VR_SERVICE_IMPL_H
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 11
12 #include "device/vr/vr_device.h"
13 #include "device/vr/vr_device_service_impl.h"
12 #include "device/vr/vr_export.h" 14 #include "device/vr/vr_export.h"
13 #include "device/vr/vr_service.mojom.h" 15 #include "device/vr/vr_service.mojom.h"
14 #include "mojo/public/cpp/bindings/binding.h" 16 #include "mojo/public/cpp/bindings/binding.h"
15 17
16 namespace device { 18 namespace device {
17 19
18 class VRServiceImpl : public VRService { 20 class VRServiceImpl : public VRService {
19 public: 21 public:
20 DEVICE_VR_EXPORT ~VRServiceImpl() override; 22 DEVICE_VR_EXPORT ~VRServiceImpl() override;
21 23
22 DEVICE_VR_EXPORT static void BindRequest( 24 DEVICE_VR_EXPORT static void BindRequest(
23 mojo::InterfaceRequest<VRService> request); 25 mojo::InterfaceRequest<VRService> request);
24 26
25 VRServiceClientPtr& client() { return client_; } 27 VRDeviceServicePtr GetDeviceServicePtr(VRDevice* device);
26 28
27 private: 29 private:
28 friend class VRServiceTestBinding; 30 friend class VRServiceTestBinding;
31 friend class VRDeviceServiceImpl;
29 32
30 DEVICE_VR_EXPORT VRServiceImpl(); 33 DEVICE_VR_EXPORT VRServiceImpl();
31 34
32 // Mojo connection handling. 35 // Mojo connection handling.
33 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<VRService> request); 36 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<VRService> request);
34 void RemoveFromDeviceManager(); 37 void RemoveFromDeviceManager();
38 void RemoveDeviceServiceImpl(VRDevice* device);
35 39
36 // mojom::VRService implementation 40 // mojom::VRService implementation
37 void SetClient(VRServiceClientPtr client) override;
38 void GetDisplays(const GetDisplaysCallback& callback) override; 41 void GetDisplays(const GetDisplaysCallback& callback) override;
39 void GetPose(uint32_t index, const GetPoseCallback& callback) override;
40 void ResetPose(uint32_t index) override;
41 42
42 void RequestPresent(uint32_t index, 43 using DeviceServiceMap =
43 bool secureOrigin, 44 std::map<VRDevice*, std::unique_ptr<VRDeviceServiceImpl>>;
44 const RequestPresentCallback& callback) override; 45 DeviceServiceMap device_service_impl_;
45 void ExitPresent(uint32_t index) override; 46
46 void SubmitFrame(uint32_t index, VRPosePtr pose) override; 47 using DeviceServicePtrMap = std::map<VRDevice*, VRDeviceServicePtr>;
47 void UpdateLayerBounds(uint32_t index, 48 DeviceServicePtrMap device_services_;
48 VRLayerBoundsPtr leftBounds,
49 VRLayerBoundsPtr rightBounds) override;
50 49
51 std::unique_ptr<mojo::Binding<VRService>> binding_; 50 std::unique_ptr<mojo::Binding<VRService>> binding_;
52 VRServiceClientPtr client_;
53 51
54 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); 52 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl);
55 }; 53 };
56 54
57 } // namespace device 55 } // namespace device
58 56
59 #endif // DEVICE_VR_VR_SERVICE_IMPL_H 57 #endif // DEVICE_VR_VR_SERVICE_IMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698