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

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

Issue 2453973002: WIP WebVR mojo refactor (Closed)
Patch Set: Fixed crash. VR data doesn't seem to be polling correctly, though. 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 9b12cfecda8be5b9be99b98cad360617536d2b87..1dc2b5ddd9fc88c9b6b05a58ba94a47e229153db 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"
@@ -38,8 +39,10 @@ class WebGLRenderingContextBase;
enum VREye { VREyeNone, VREyeLeft, VREyeRight };
class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
+ public device::mojom::blink::VRDisplayClient,
public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();
+ USING_PRE_FINALIZER(VRDisplay, shutdownMessagePipe);
public:
~VRDisplay();
@@ -63,6 +66,10 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
void setDepthNear(double value) { m_depthNear = value; }
void setDepthFar(double value) { m_depthFar = value; }
+ void setDisplayPtr(device::mojom::blink::VRDisplayPtr display) {
+ m_display = std::move(display);
+ }
+
VREyeParameters* getEyeParameters(const String&);
int requestAnimationFrame(FrameRequestCallback*);
@@ -81,9 +88,9 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
protected:
friend class VRController;
- VRDisplay(NavigatorVR*);
+ VRDisplay(NavigatorVR*, device::mojom::blink::VRDisplayPtr);
- void update(const device::blink::VRDisplayPtr&);
+ void update(const device::mojom::blink::VRDisplayInfoPtr&);
void updatePose();
@@ -97,6 +104,14 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
private:
void onFullscreenCheck(TimerBase*);
+ void onPresentComplete(ScriptPromiseResolver*, bool);
+
+ void onDisplayConnected();
+ void onDisplayDisconnected();
+
+ // VRDisplayClient
+ void OnDisplayChanged(device::mojom::blink::VRDisplayInfoPtr) override;
+ void OnExitPresent() override;
ScriptedAnimationController& ensureScriptedAnimationController(Document*);
@@ -111,11 +126,14 @@ 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;
@@ -123,6 +141,12 @@ class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>,
Member<ScriptedAnimationController> m_scriptedAnimationController;
bool m_animationCallbackRequested;
bool m_inAnimationFrame;
+
+ device::mojom::blink::VRDisplayPtr m_display;
+
+ static unsigned nextId;
+
+ mojo::Binding<device::mojom::blink::VRDisplayClient> m_binding;
};
using VRDisplayVector = HeapVector<Member<VRDisplay>>;
« no previous file with comments | « third_party/WebKit/Source/modules/vr/VRController.cpp ('k') | third_party/WebKit/Source/modules/vr/VRDisplay.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698