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 |
new file mode 100644 |
index 0000000000000000000000000000000000000000..dd68e033557d1097e2e67ac54512cfe90ad9dc95 |
--- /dev/null |
+++ b/third_party/WebKit/Source/modules/vr/VRDisplay.h |
@@ -0,0 +1,106 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef VRDisplay_h |
+#define VRDisplay_h |
+ |
+#include "bindings/core/v8/ScriptWrappable.h" |
+#include "core/dom/Document.h" |
+#include "core/dom/FrameRequestCallback.h" |
+#include "modules/vr/VRDisplayCapabilities.h" |
+#include "modules/vr/VRLayer.h" |
+#include "platform/heap/Handle.h" |
+#include "public/platform/WebGraphicsContext3DProvider.h" |
+#include "public/platform/WebThread.h" |
+#include "public/platform/modules/vr/WebVR.h" |
+#include "wtf/Forward.h" |
+#include "wtf/text/WTFString.h" |
+ |
+namespace gpu { |
+namespace gles2 { |
+class GLES2Interface; |
+} |
+} |
+ |
+namespace blink { |
+ |
+class NavigatorVR; |
+class VRController; |
+class VREyeParameters; |
+class VRStageParameters; |
+class VRPose; |
+ |
+class WebGLRenderingContextBase; |
+ |
+enum VREye { |
+ VREyeNone, |
+ VREyeLeft, |
+ VREyeRight |
+}; |
+ |
+class VRDisplay final : public GarbageCollectedFinalized<VRDisplay>, public ScriptWrappable, public WebThread::TaskObserver { |
+ DEFINE_WRAPPERTYPEINFO(); |
+public: |
+ ~VRDisplay(); |
+ |
+ unsigned displayId() const { return m_displayId; } |
+ const String& displayName() const { return m_displayName; } |
+ |
+ VRDisplayCapabilities* capabilities() const { return m_capabilities; } |
+ VRStageParameters* stageParameters() const { return m_stageParameters; } |
+ |
+ bool isConnected() const { return m_isConnected; } |
+ bool isPresenting() const { return m_isPresenting; } |
+ |
+ VRPose* getPose(); |
+ VRPose* getImmediatePose(); |
+ void resetPose(); |
+ |
+ VREyeParameters* getEyeParameters(const String&); |
+ |
+ int requestAnimationFrame(FrameRequestCallback*); |
+ void cancelAnimationFrame(int id); |
+ |
+ ScriptPromise requestPresent(ScriptState*, const HeapVector<VRLayer>& layers); |
+ ScriptPromise exitPresent(ScriptState*); |
+ |
+ HeapVector<VRLayer> getLayers(); |
+ |
+ void submitFrame(VRPose*); |
+ |
+ DECLARE_VIRTUAL_TRACE(); |
+ |
+protected: |
+ friend class VRDisplayCollection; |
+ |
+ VRDisplay(NavigatorVR*); |
+ |
+ void updateFromWebVRDevice(const WebVRDevice&); |
+ |
+ VRController* controller(); |
+ |
+private: |
+ // TaskObserver implementation. |
+ void didProcessTask() override; |
+ void willProcessTask() override { } |
+ |
+ Member<NavigatorVR> m_navigatorVR; |
+ unsigned m_displayId; |
+ String m_displayName; |
+ bool m_isConnected; |
+ bool m_isPresenting; |
+ bool m_canUpdateFramePose; |
+ unsigned m_compositorHandle; |
+ Member<VRDisplayCapabilities> m_capabilities; |
+ Member<VRStageParameters> m_stageParameters; |
+ Member<VREyeParameters> m_eyeParametersLeft; |
+ Member<VREyeParameters> m_eyeParametersRight; |
+ Member<VRPose> m_framePose; |
+}; |
+ |
+using VRDisplayVector = HeapVector<Member<VRDisplay>>; |
+ |
+} // namespace blink |
+ |
+#endif // VRDisplay_h |