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

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

Issue 2167643003: Refactored VRService interaction and added VRServiceClient (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Liberal sprinkling of 'u's Created 4 years, 5 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/VRController.h
diff --git a/third_party/WebKit/Source/modules/vr/VRController.h b/third_party/WebKit/Source/modules/vr/VRController.h
index 3e01a2fc715e5f48db600b1766a1c9725eb23e24..f74dd8f2d1b0469634c6668bcc7a64aea19f5b93 100644
--- a/third_party/WebKit/Source/modules/vr/VRController.h
+++ b/third_party/WebKit/Source/modules/vr/VRController.h
@@ -5,47 +5,59 @@
#ifndef VRController_h
#define VRController_h
-#include "core/frame/LocalFrame.h"
+#include "core/dom/ContextLifecycleObserver.h"
+#include "core/dom/Document.h"
#include "device/vr/vr_service.mojom-blink.h"
-#include "modules/ModulesExport.h"
-#include "platform/Supplementable.h"
+#include "modules/vr/VRDisplay.h"
+#include "mojo/public/cpp/bindings/binding.h"
+#include "platform/heap/Handle.h"
#include "wtf/Deque.h"
#include <memory>
namespace blink {
+class NavigatorVR;
class ServiceRegistry;
class VRGetDevicesCallback;
-class MODULES_EXPORT VRController final
+class VRController final
: public GarbageCollectedFinalized<VRController>
- , public Supplement<LocalFrame> {
+ , public device::blink::VRServiceClient
+ , public ContextLifecycleObserver {
USING_GARBAGE_COLLECTED_MIXIN(VRController);
WTF_MAKE_NONCOPYABLE(VRController);
public:
+ VRController(NavigatorVR*);
virtual ~VRController();
- void getDisplays(std::unique_ptr<VRGetDevicesCallback>);
-
+ // VRService.
+ void getDisplays(ScriptPromiseResolver*);
device::blink::VRPosePtr getPose(unsigned index);
-
void resetPose(unsigned index);
- static void provideTo(LocalFrame&, ServiceRegistry*);
- static VRController* from(LocalFrame&);
- static const char* supplementName();
+ VRDisplay* createOrUpdateDisplay(const device::blink::VRDisplayPtr&);
+ VRDisplayVector updateDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>);
+ VRDisplay* getDisplayForIndex(unsigned index);
DECLARE_VIRTUAL_TRACE();
private:
- VRController(LocalFrame&, ServiceRegistry*);
-
// Binding callbacks.
void onGetDisplays(mojo::WTFArray<device::blink::VRDisplayPtr>);
+ // VRServiceClient.
+ void OnDisplayChanged(device::blink::VRDisplayPtr) override;
+
+ // ContextLifecycleObserver.
+ void contextDestroyed() override;
+
+ Member<NavigatorVR> m_navigatorVR;
+ VRDisplayVector m_displays;
+
Deque<std::unique_ptr<VRGetDevicesCallback>> m_pendingGetDevicesCallbacks;
device::blink::VRServicePtr m_service;
+ mojo::Binding<device::blink::VRServiceClient> m_binding;
};
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/vr/NavigatorVR.cpp ('k') | third_party/WebKit/Source/modules/vr/VRController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698