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

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

Issue 2658643003: Refactor GvrDelegate ownership into GvrDelegateProvider and fix more threading violations. (Closed)
Patch Set: Address comments Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « device/vr/test/fake_vr_device.cc ('k') | device/vr/vr_device.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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_DEVICE_H 5 #ifndef DEVICE_VR_VR_DEVICE_H
6 #define DEVICE_VR_VR_DEVICE_H 6 #define DEVICE_VR_VR_DEVICE_H
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "device/vr/vr_export.h" 10 #include "device/vr/vr_export.h"
11 #include "device/vr/vr_service.mojom.h" 11 #include "device/vr/vr_service.mojom.h"
12 12
13 namespace device { 13 namespace device {
14 14
15 class VRDisplayImpl; 15 class VRDisplayImpl;
16 16
17 const unsigned int VR_DEVICE_LAST_ID = 0xFFFFFFFF; 17 const unsigned int VR_DEVICE_LAST_ID = 0xFFFFFFFF;
18 18
19 class DEVICE_VR_EXPORT VRDevice { 19 class DEVICE_VR_EXPORT VRDevice {
20 public: 20 public:
21 VRDevice(); 21 VRDevice();
22 virtual ~VRDevice(); 22 virtual ~VRDevice();
23 23
24 unsigned int id() const { return id_; } 24 unsigned int id() const { return id_; }
25 25
26 virtual mojom::VRDisplayInfoPtr GetVRDevice() = 0; 26 virtual void GetVRDevice(
27 const base::Callback<void(mojom::VRDisplayInfoPtr)>& callback) = 0;
27 virtual void ResetPose() = 0; 28 virtual void ResetPose() = 0;
28 29
29 virtual void RequestPresent(const base::Callback<void(bool)>& callback) = 0; 30 virtual void RequestPresent(const base::Callback<void(bool)>& callback) = 0;
30 virtual void SetSecureOrigin(bool secure_origin) = 0; 31 virtual void SetSecureOrigin(bool secure_origin) = 0;
31 virtual void ExitPresent() = 0; 32 virtual void ExitPresent() = 0;
32 virtual void SubmitFrame(mojom::VRPosePtr pose) = 0; 33 virtual void SubmitFrame(mojom::VRPosePtr pose) = 0;
33 virtual void UpdateLayerBounds(int16_t frame_index, 34 virtual void UpdateLayerBounds(int16_t frame_index,
34 mojom::VRLayerBoundsPtr left_bounds, 35 mojom::VRLayerBoundsPtr left_bounds,
35 mojom::VRLayerBoundsPtr right_bounds) = 0; 36 mojom::VRLayerBoundsPtr right_bounds) = 0;
36 virtual void GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) = 0; 37 virtual void GetVRVSyncProvider(mojom::VRVSyncProviderRequest request) = 0;
(...skipping 11 matching lines...) Expand all
48 virtual void OnActivate(mojom::VRDisplayEventReason reason); 49 virtual void OnActivate(mojom::VRDisplayEventReason reason);
49 virtual void OnDeactivate(mojom::VRDisplayEventReason reason); 50 virtual void OnDeactivate(mojom::VRDisplayEventReason reason);
50 51
51 protected: 52 protected:
52 friend class VRDisplayImpl; 53 friend class VRDisplayImpl;
53 friend class VRDisplayImplTest; 54 friend class VRDisplayImplTest;
54 55
55 void SetPresentingDisplay(VRDisplayImpl* display); 56 void SetPresentingDisplay(VRDisplayImpl* display);
56 57
57 private: 58 private:
59 void OnVRDisplayInfoCreated(mojom::VRDisplayInfoPtr vr_device_info);
60
58 std::set<VRDisplayImpl*> displays_; 61 std::set<VRDisplayImpl*> displays_;
59 62
60 VRDisplayImpl* presenting_display_; 63 VRDisplayImpl* presenting_display_;
61 64
62 unsigned int id_; 65 unsigned int id_;
63 66
64 static unsigned int next_id_; 67 static unsigned int next_id_;
65 68
69 base::WeakPtrFactory<VRDevice> weak_ptr_factory_;
70
66 DISALLOW_COPY_AND_ASSIGN(VRDevice); 71 DISALLOW_COPY_AND_ASSIGN(VRDevice);
67 }; 72 };
68 73
69 } // namespace device 74 } // namespace device
70 75
71 #endif // DEVICE_VR_VR_DEVICE_H 76 #endif // DEVICE_VR_VR_DEVICE_H
OLDNEW
« no previous file with comments | « device/vr/test/fake_vr_device.cc ('k') | device/vr/vr_device.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698