| Index: device/vr/vr_device_manager.h
|
| diff --git a/device/vr/vr_device_manager.h b/device/vr/vr_device_manager.h
|
| index 15e6bc4ae25e6b1fc14fadc94607fe0e35b6735c..8c8e14c4fe49b161a4e83eac88e8e53210f7291a 100644
|
| --- a/device/vr/vr_device_manager.h
|
| +++ b/device/vr/vr_device_manager.h
|
| @@ -32,14 +32,22 @@ class VRDeviceManager : public VRClientDispatcher {
|
| // Returns the VRDeviceManager singleton.
|
| static VRDeviceManager* GetInstance();
|
|
|
| + // Gets a VRDevice instance if the specified service is allowed to access it.
|
| + static VRDevice* GetAllowedDevice(VRServiceImpl* service, unsigned int index);
|
| +
|
| // Adds a listener for device manager events. VRDeviceManager does not own
|
| // this object.
|
| void AddService(VRServiceImpl* service);
|
| void RemoveService(VRServiceImpl* service);
|
|
|
| DEVICE_VR_EXPORT mojo::Array<VRDisplayPtr> GetVRDevices();
|
| - DEVICE_VR_EXPORT VRDevice* GetDevice(unsigned int index);
|
|
|
| + // Manage presentation to only allow a single service and device at a time.
|
| + bool RequestPresent(VRServiceImpl* service, unsigned int index);
|
| + void ExitPresent(VRServiceImpl* service, unsigned int index);
|
| + void SubmitFrame(VRServiceImpl* service, unsigned int index, VRPosePtr pose);
|
| +
|
| + // VRClientDispatcher implementation
|
| void OnDeviceChanged(VRDisplayPtr device) override;
|
|
|
| private:
|
| @@ -51,6 +59,8 @@ class VRDeviceManager : public VRClientDispatcher {
|
| DEVICE_VR_EXPORT explicit VRDeviceManager(
|
| std::unique_ptr<VRDeviceProvider> provider);
|
|
|
| + VRDevice* GetDevice(unsigned int index);
|
| +
|
| static void SetInstance(VRDeviceManager* service);
|
| static bool HasInstance();
|
|
|
| @@ -73,6 +83,10 @@ class VRDeviceManager : public VRClientDispatcher {
|
| using ServiceList = std::vector<VRServiceImpl*>;
|
| ServiceList services_;
|
|
|
| + // Only one service and device is allowed to present at a time.
|
| + VRServiceImpl* presenting_service_;
|
| + VRDevice* presenting_device_;
|
| +
|
| // For testing. If true will not delete self when consumer count reaches 0.
|
| bool keep_alive_;
|
|
|
|
|