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

Unified Diff: device/vr/vr_device_manager.h

Issue 2329893002: Isolate a presenting VR device from pages other than the one presenting. (Closed)
Patch Set: Unit tests Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « device/vr/vr_device.cc ('k') | device/vr/vr_device_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..10bd99ac027b7e2d600cf3b31d4fdbbd959477c2 100644
--- a/device/vr/vr_device_manager.h
+++ b/device/vr/vr_device_manager.h
@@ -32,14 +32,24 @@ class VRDeviceManager : public VRClientDispatcher {
// Returns the VRDeviceManager singleton.
static VRDeviceManager* GetInstance();
+ // Gets a VRDevice instance if the specified service is allowed to access it.
+ DEVICE_VR_EXPORT 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.
+ DEVICE_VR_EXPORT bool RequestPresent(VRServiceImpl* service,
+ unsigned int index);
+ DEVICE_VR_EXPORT 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 +61,8 @@ class VRDeviceManager : public VRClientDispatcher {
DEVICE_VR_EXPORT explicit VRDeviceManager(
std::unique_ptr<VRDeviceProvider> provider);
+ DEVICE_VR_EXPORT VRDevice* GetDevice(unsigned int index);
+
static void SetInstance(VRDeviceManager* service);
static bool HasInstance();
@@ -73,6 +85,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_;
« no previous file with comments | « device/vr/vr_device.cc ('k') | device/vr/vr_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698