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

Side by Side Diff: device/vr/vr_display_impl.h

Issue 2510873003: Clean up WebVR RequestPresent and make callback asynchronous. (Closed)
Patch Set: Created 4 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_VR_VR_DISPLAY_IMPL_H 5 #ifndef DEVICE_VR_VR_DISPLAY_IMPL_H
6 #define DEVICE_VR_VR_DISPLAY_IMPL_H 6 #define DEVICE_VR_VR_DISPLAY_IMPL_H
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 11 #include "base/memory/weak_ptr.h"
12 #include "device/vr/vr_device.h" 12 #include "device/vr/vr_device.h"
13 #include "device/vr/vr_export.h" 13 #include "device/vr/vr_export.h"
14 #include "device/vr/vr_service.mojom.h" 14 #include "device/vr/vr_service.mojom.h"
15 #include "mojo/public/cpp/bindings/binding.h" 15 #include "mojo/public/cpp/bindings/binding.h"
16 16
17 namespace device { 17 namespace device {
18 18
19 class VRDisplayImpl : public mojom::VRDisplay { 19 class VRDisplayImpl : public mojom::VRDisplay {
20 public: 20 public:
21 VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service); 21 VRDisplayImpl(device::VRDevice* device, VRServiceImpl* service);
22 ~VRDisplayImpl() override; 22 ~VRDisplayImpl() override;
23 23
24 mojom::VRDisplayClient* client() { return client_.get(); } 24 mojom::VRDisplayClient* client() { return client_.get(); }
25 25
26 private: 26 private:
27 friend class VRServiceImpl; 27 friend class VRServiceImpl;
28 28
29 void GetPose(const GetPoseCallback& callback) override; 29 void GetPose(const GetPoseCallback& callback) override;
30 void ResetPose() override; 30 void ResetPose() override;
31 31
32 void RequestPresent(bool secureOrigin, 32 void RequestPresent(bool secure_origin,
33 const RequestPresentCallback& callback) override; 33 const RequestPresentCallback& callback) override;
34 void ExitPresent() override; 34 void ExitPresent() override;
35 void SubmitFrame(mojom::VRPosePtr pose) override; 35 void SubmitFrame(mojom::VRPosePtr pose) override;
36 36
37 void UpdateLayerBounds(mojom::VRLayerBoundsPtr left_bounds, 37 void UpdateLayerBounds(mojom::VRLayerBoundsPtr left_bounds,
38 mojom::VRLayerBoundsPtr right_bounds) override; 38 mojom::VRLayerBoundsPtr right_bounds) override;
39 39
40 void RequestPresentResult(const RequestPresentCallback& callback,
41 bool secure_origin,
42 bool success);
43
40 mojo::Binding<mojom::VRDisplay> binding_; 44 mojo::Binding<mojom::VRDisplay> binding_;
41 mojom::VRDisplayClientPtr client_; 45 mojom::VRDisplayClientPtr client_;
42 device::VRDevice* device_; 46 device::VRDevice* device_;
43 VRServiceImpl* service_; 47 VRServiceImpl* service_;
48
49 base::WeakPtrFactory<VRDisplayImpl> weak_ptr_factory_;
44 }; 50 };
45 51
46 } // namespace device 52 } // namespace device
47 53
48 #endif // DEVICE_VR_VR_DISPLAY_IMPL_H 54 #endif // DEVICE_VR_VR_DISPLAY_IMPL_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698