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

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

Issue 2420743003: mojo VR interface simplified (Closed)
Patch Set: update binding process and update some unittest 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_client_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 VRDeviceClientPtr GetDeviceServicePtr(VRDevice* device);
28 VRDisplayClientPtr GetDisplayClient();
26 29
27 private: 30 private:
28 friend class VRServiceTestBinding; 31 friend class VRServiceTestBinding;
32 friend class VRDeviceManagerTest;
33 friend class VRDeviceClientImpl;
29 34
30 DEVICE_VR_EXPORT VRServiceImpl(); 35 DEVICE_VR_EXPORT VRServiceImpl();
31 36
32 // Mojo connection handling. 37 // Mojo connection handling.
33 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<VRService> request); 38 DEVICE_VR_EXPORT void Bind(mojo::InterfaceRequest<VRService> request);
34 void RemoveFromDeviceManager(); 39 void RemoveFromDeviceManager();
40 void RemoveDeviceClientImpl(VRDevice* device);
35 41
36 // mojom::VRService implementation 42 // mojom::VRService implementation
43 void GetDisplays(const GetDisplaysCallback& callback) override;
37 void SetClient(VRServiceClientPtr client) override; 44 void SetClient(VRServiceClientPtr client) override;
38 void GetDisplays(const GetDisplaysCallback& callback) override;
39 void GetPose(uint32_t index, const GetPoseCallback& callback) override;
40 void ResetPose(uint32_t index) override;
41 45
42 void RequestPresent(uint32_t index, 46 using DeviceClientMap =
43 bool secureOrigin, 47 std::map<VRDevice*, std::unique_ptr<VRDeviceClientImpl>>;
44 const RequestPresentCallback& callback) override; 48 DeviceClientMap device_client_impl_;
45 void ExitPresent(uint32_t index) override; 49
46 void SubmitFrame(uint32_t index, VRPosePtr pose) override; 50 VRServiceClientPtr client_;
47 void UpdateLayerBounds(uint32_t index,
48 VRLayerBoundsPtr leftBounds,
49 VRLayerBoundsPtr rightBounds) override;
50 51
51 std::unique_ptr<mojo::Binding<VRService>> binding_; 52 std::unique_ptr<mojo::Binding<VRService>> binding_;
52 VRServiceClientPtr client_;
53 53
54 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl); 54 DISALLOW_COPY_AND_ASSIGN(VRServiceImpl);
55 }; 55 };
56 56
57 } // namespace device 57 } // namespace device
58 58
59 #endif // DEVICE_VR_VR_SERVICE_IMPL_H 59 #endif // DEVICE_VR_VR_SERVICE_IMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698