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

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: Rebase and added further page isolation logic 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
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_;

Powered by Google App Engine
This is Rietveld 408576698