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

Unified Diff: device/vr/openvr/openvr_device.h

Issue 2834843002: Add event listening function to openvr device (Closed)
Patch Set: Created 3 years, 8 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 | « no previous file | device/vr/openvr/openvr_device.cc » ('j') | device/vr/openvr/openvr_device.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: device/vr/openvr/openvr_device.h
diff --git a/device/vr/openvr/openvr_device.h b/device/vr/openvr/openvr_device.h
index 136f5667fd226c7e650e489d3e7491d0fbee37cc..7be1d815290cf42e62d6a63add1c6236a5f7b706 100644
--- a/device/vr/openvr/openvr_device.h
+++ b/device/vr/openvr/openvr_device.h
@@ -18,6 +18,8 @@ namespace device {
class OpenVRDevice : public VRDevice {
public:
+ enum VREvent { CONNECTED = 0, DISCONNECTED = 1, CHANGED = 2 };
nhu 2017/04/24 01:47:06 No need to define general vr events in OpenVRDevic
+
OpenVRDevice();
~OpenVRDevice() override;
@@ -39,16 +41,26 @@ class OpenVRDevice : public VRDevice {
int16_t source_height) override;
void GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) override;
+ void OnPollingEvent(OpenVRDevice::VREvent event);
nhu 2017/04/24 01:47:06 VRDevice already defines OnXXX functions for event
shaobo.yan 2017/04/24 02:27:27 Due to the current class relationship, I think Ope
+
private:
class OpenVRRenderLoop : public base::SimpleThread,
device::mojom::VRVSyncProvider {
public:
OpenVRRenderLoop(vr::IVRSystem* vr);
+ void RegistPollingEventCallback(
+ const base::Callback<void(OpenVRDevice::VREvent)>& onPollingVREvent);
nhu 2017/04/24 01:47:06 Can we use a VRDevice reference to OpenVRDevice in
shaobo.yan 2017/04/24 02:27:27 Yes, I think this is the base question need to dis
+
+ void UnregistPollingEventCallback();
+
void Bind(mojom::VRVSyncProviderRequest request);
mojom::VRPosePtr getPose();
+ // OpenVR need invoke pollNextEvent to query system event.
+ void PollEvent();
nhu 2017/04/24 01:47:06 naming: PollEvent -> PollEvents?
shaobo.yan 2017/04/24 02:27:28 That's a better name !
+
private:
void Run() override;
@@ -56,6 +68,7 @@ class OpenVRDevice : public VRDevice {
callback) override;
scoped_refptr<base::SingleThreadTaskRunner> main_thread_task_runner_;
+ base::Callback<void(OpenVRDevice::VREvent)> on_polling_event_;
vr::IVRSystem* vr_system_;
mojo::Binding<device::mojom::VRVSyncProvider> binding_;
};
@@ -68,6 +81,8 @@ class OpenVRDevice : public VRDevice {
mojom::VRSubmitFrameClientPtr submit_client_;
+ base::WeakPtrFactory<OpenVRDevice> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(OpenVRDevice);
};
« no previous file with comments | « no previous file | device/vr/openvr/openvr_device.cc » ('j') | device/vr/openvr/openvr_device.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698