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

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

Issue 2420743003: mojo VR interface simplified (Closed)
Patch Set: Address bajones@ comments and some clean up 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 ee60f0e7bd5f76cfb04bbab068ba2b329cd6f268..74fef1f03ff37a4790bd8c0319da266d3027db06 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"
@@ -37,8 +38,10 @@ class WebGLRenderingContextBase;
enum VREye { VREyeNone, VREyeLeft, VREyeRight };
class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
+ public device::blink::VRDisplayService,
public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
+ USING_PRE_FINALIZER(VRDisplay, shutdownMessagePipe);
public:
~VRDisplay();
@@ -62,6 +65,10 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
void setDepthNear(double value) { m_depthNear = value; }
void setDepthFar(double value) { m_depthFar = value; }
+ void setService(device::blink::VRDeviceServicePtr service) {
+ m_service = std::move(service);
+ }
+
VREyeParameters* getEyeParameters(const String&);
int requestAnimationFrame(FrameRequestCallback*);
@@ -95,6 +102,14 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
private:
void onFullscreenCheck(TimerBase*);
+ void RegisterDisplayService();
+ void onPresentComplete(ScriptPromiseResolver*, bool);
+
+ // VRDisplayService
+ void OnDisplayChanged(device::blink::VRDisplayPtr) override;
+ void OnExitPresent() override;
+ void OnDisplayConnected(device::blink::VRDisplayPtr) override;
+ void OnDisplayDisconnected() override;
Member<NavigatorVR> m_navigatorVR;
unsigned m_displayId;
@@ -112,9 +127,16 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
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::blink::VRDeviceServicePtr m_service;
+
+ mojo::Binding<device::blink::VRDisplayService> m_binding;
};
using VRDisplayVector = HeapVector<Member<VRDisplay>>;

Powered by Google App Engine
This is Rietveld 408576698