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

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

Issue 2317483002: Add support of vrdisplayconnect and vrdisplaydisconnect event (Closed)
Patch Set: Fix typo of Event reason Created 4 years, 3 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/NavigatorVR.h
diff --git a/third_party/WebKit/Source/modules/vr/NavigatorVR.h b/third_party/WebKit/Source/modules/vr/NavigatorVR.h
index 4a4b2a3e8d64dfeeb5a4d6bbd9d50ad63cab8297..e888bbc812a9eee03b2102e63b98cf0b9901212e 100644
--- a/third_party/WebKit/Source/modules/vr/NavigatorVR.h
+++ b/third_party/WebKit/Source/modules/vr/NavigatorVR.h
@@ -10,6 +10,7 @@
#include "modules/ModulesExport.h"
#include "modules/vr/VRDisplay.h"
#include "modules/vr/VRDisplayEvent.h"
+#include "platform/AsyncMethodRunner.h"
#include "platform/Supplementable.h"
#include "platform/heap/Handle.h"
#include "public/platform/WebVector.h"
@@ -21,7 +22,7 @@ class Document;
class Navigator;
class VRController;
-class MODULES_EXPORT NavigatorVR final : public GarbageCollectedFinalized<NavigatorVR>, public Supplement<Navigator>, public DOMWindowProperty {
+class MODULES_EXPORT NavigatorVR final : public GarbageCollectedFinalized<NavigatorVR>, public Supplement<Navigator>, public DOMWindowProperty, public LocalDOMWindow::EventListenerObserver {
USING_GARBAGE_COLLECTED_MIXIN(NavigatorVR);
WTF_MAKE_NONCOPYABLE(NavigatorVR);
public:
@@ -35,6 +36,8 @@ public:
VRController* controller();
Document* document();
+ void fireVREvent(VRDisplayEvent*);
+
DECLARE_VIRTUAL_TRACE();
private:
@@ -47,7 +50,20 @@ private:
void fireVRDisplayPresentChange(VRDisplay*);
+ void dispatchOneEvent();
+
+ // LocalDOMWindow::EventListenerObserver
+ void didAddEventListener(LocalDOMWindow*, const AtomicString&) override;
+ void didRemoveEventListener(LocalDOMWindow*, const AtomicString&) override;
+ void didRemoveAllEventListeners(LocalDOMWindow*) override;
+ void didRemoveVREventListeners();
+
+ bool isVREvent(const AtomicString&);
+
Member<VRController> m_controller;
+ bool m_hasEventListener;
+ HeapDeque<Member<VRDisplayEvent>> m_pendingEvents;
+ Member<AsyncMethodRunner<NavigatorVR>> m_dispatchOneEventRunner;
};
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698