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

Unified Diff: third_party/WebKit/Source/modules/vr/VRDisplay.h

Issue 2420743003: mojo VR interface simplified (Closed)
Patch Set: address leon@ comments about name 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/vr/VRDisplay.h
diff --git a/third_party/WebKit/Source/modules/vr/VRDisplay.h b/third_party/WebKit/Source/modules/vr/VRDisplay.h
index 6eebc631884e67f64116ea6762f15e940893ea67..c424f778aeb3a3cb874fe35e78cd10c773351e1b 100644
--- a/third_party/WebKit/Source/modules/vr/VRDisplay.h
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.h
@@ -11,6 +11,7 @@
#include "device/vr/vr_service.mojom-blink.h"
#include "modules/vr/VRDisplayCapabilities.h"
#include "modules/vr/VRLayer.h"
+#include "mojo/public/cpp/bindings/binding.h"
#include "platform/Timer.h"
#include "platform/heap/Handle.h"
#include "public/platform/WebGraphicsContext3DProvider.h"
@@ -36,9 +37,13 @@ class WebGLRenderingContextBase;
enum VREye { VREyeNone, VREyeLeft, VREyeRight };
+const unsigned MAX = 0xFFFFFFFF;
+
class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
+ public device::mojom::blink::VRDisplayClient,
public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
+ USING_PRE_FINALIZER(VRDisplay, shutdownMessagePipe);
public:
~VRDisplay();
@@ -62,6 +67,10 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
void setDepthNear(double value) { m_depthNear = value; }
void setDepthFar(double value) { m_depthFar = value; }
+ void setDevice(device::mojom::blink::VRDevicePtr client) {
+ m_device = std::move(client);
+ }
+
VREyeParameters* getEyeParameters(const String&);
int requestAnimationFrame(FrameRequestCallback*);
@@ -81,7 +90,7 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
VRDisplay(NavigatorVR*);
- void update(const device::blink::VRDisplayPtr&);
+ void update(const device::mojom::blink::VRDisplayPtr&);
void updatePose();
@@ -95,6 +104,16 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
private:
void onFullscreenCheck(TimerBase*);
+ device::mojom::blink::VRDisplayClientPtr BindClient();
+ void onPresentComplete(ScriptPromiseResolver*, bool);
+
+ // VRDisplayClient
+ void RegisterDevice(device::mojom::blink::VRDevicePtr) override;
+ void UpdateDisplayInfo(device::mojom::blink::VRDisplayPtr) override;
+ void OnDisplayChanged(device::mojom::blink::VRDisplayPtr) override;
+ void OnExitPresent() override;
+ void OnDisplayConnected(device::mojom::blink::VRDisplayPtr) override;
+ void OnDisplayDisconnected() override;
Member<NavigatorVR> m_navigatorVR;
unsigned m_displayId;
@@ -107,14 +126,23 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
Member<VRStageParameters> m_stageParameters;
Member<VREyeParameters> m_eyeParametersLeft;
Member<VREyeParameters> m_eyeParametersRight;
- device::blink::VRPosePtr m_framePose;
+ device::mojom::blink::VRPosePtr m_framePose;
VRLayer m_layer;
double m_depthNear;
double m_depthFar;
+ // Help VRController shutdown message pipe.
+ void shutdownMessagePipe();
+
Timer<VRDisplay> m_fullscreenCheckTimer;
gpu::gles2::GLES2Interface* m_contextGL;
Member<WebGLRenderingContextBase> m_renderingContext;
+
+ device::mojom::blink::VRDevicePtr m_device;
+
+ static unsigned nextId;
+
+ mojo::Binding<device::mojom::blink::VRDisplayClient> m_binding;
};
using VRDisplayVector = HeapVector<Member<VRDisplay>>;

Powered by Google App Engine
This is Rietveld 408576698