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

Unified Diff: third_party/WebKit/Source/platform/vr/vr_dispatcher.h

Issue 1808203005: [OnionSoup] Moving VR service from content to Blink (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Reworked as per comments! Created 4 years, 9 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/platform/vr/vr_dispatcher.h
diff --git a/third_party/WebKit/Source/platform/vr/vr_dispatcher.h b/third_party/WebKit/Source/platform/vr/vr_dispatcher.h
new file mode 100644
index 0000000000000000000000000000000000000000..1b11f9d7cf6f8a1d792cb847b45e2ab3a6780429
--- /dev/null
+++ b/third_party/WebKit/Source/platform/vr/vr_dispatcher.h
@@ -0,0 +1,59 @@
+// Copyright 2015 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 BLINK_PLATFORM_VR_VR_DISPATCHER_H_
+#define BLINK_PLATFORM_VR_VR_DISPATCHER_H_
+
+#include "platform/PlatformExport.h"
+#include "public/platform/modules/vr/vr_service.mojom.h"
+#include "public/platform/modules/vr/WebVRClient.h"
+#include "wtf/Noncopyable.h"
+
+namespace blink {
+
+class VRGetDevicesRequest {
+ WTF_MAKE_NONCOPYABLE(VRGetDevicesRequest);
haraken 2016/03/22 02:39:20 Add USING_FAST_MALLOC().
RaviKasibhatla 2016/03/23 15:20:50 Done.
+public:
+ explicit VRGetDevicesRequest(WebVRGetDevicesCallback* callback);
+ ~VRGetDevicesRequest();
+ WebVRGetDevicesCallback* get_devices_callback() const;
+
+private:
+ WebVRGetDevicesCallback* get_devices_callback_;
haraken 2016/03/22 02:39:20 How is it guaranteed that the WebVRGetDevicesCallb
RaviKasibhatla 2016/03/23 15:20:50 The original web caller actually transfers the res
+};
+
+class PLATFORM_EXPORT VRDispatcher : public GarbageCollectedFinalized<VRDispatcher>, public WebVRClient {
+ WTF_MAKE_NONCOPYABLE(VRDispatcher);
+ public:
+ static WebVRClient* create();
+ ~VRDispatcher() override;
+
+ // WebVRClient implementation.
+ void getDevices(WebVRGetDevicesCallback* callback) override;
+
+ void getSensorState(unsigned int index,
+ WebHMDSensorState& state) override;
+
+ void resetSensor(unsigned int index) override;
+
+ DEFINE_INLINE_TRACE() { }
+
+ private:
+ VRDispatcher();
+
+ // Helper method that returns an initialized PermissionServicePtr.
+ mojom::VRServicePtr& GetVRServicePtr();
+
+ // Callback handlers
+ void OnGetDevices(VRGetDevicesRequest* device_request,//int* request_id,
haraken 2016/03/22 02:39:20 Remove the comment and add a TODO?
RaviKasibhatla 2016/03/23 15:20:51 Done.
+ const mojo::Array<mojom::VRDeviceInfoPtr>& devices);
+ void OnGetSensorState(WebHMDSensorState* state,
+ const mojom::VRSensorStatePtr& mojo_state);
+
+ mojom::VRServicePtr vr_service_;
+};
+
+} // namespace blink
+
+#endif // BLINK_PLATFORM_VR_VR_DISPATCHER_H_

Powered by Google App Engine
This is Rietveld 408576698