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

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

Issue 2420743003: mojo VR interface simplified (Closed)
Patch Set: update binding process and update some unittest 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..f96d703603173a44706b883971aced35135e8483 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::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 setService(device::blink::VRDeviceClientPtr client) {
+ m_client = std::move(client);
+ }
+
VREyeParameters* getEyeParameters(const String&);
int requestAnimationFrame(FrameRequestCallback*);
@@ -95,6 +104,16 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
private:
void onFullscreenCheck(TimerBase*);
+ device::blink::VRDisplayClientPtr BindClient();
+ void onPresentComplete(ScriptPromiseResolver*, bool);
+
+ // VRDisplayClient
+ void RegisterDeviceClient(device::blink::VRDeviceClientPtr) override;
+ void UpdateDisplayInfo(device::blink::VRDisplayPtr) override;
+ 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 +131,18 @@ 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::VRDeviceClientPtr m_client;
+
+ static unsigned nextId;
+
+ mojo::Binding<device::blink::VRDisplayClient> m_binding;
};
using VRDisplayVector = HeapVector<Member<VRDisplay>>;

Powered by Google App Engine
This is Rietveld 408576698