| OLD | NEW |
| 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_MANAGER_H | 5 #ifndef DEVICE_VR_VR_DEVICE_MANAGER_H |
| 6 #define DEVICE_VR_VR_DEVICE_MANAGER_H | 6 #define DEVICE_VR_VR_DEVICE_MANAGER_H |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/ref_counted.h" |
| 16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
| 17 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 18 #include "device/vr/vr_device.h" | 18 #include "device/vr/vr_device.h" |
| 19 #include "device/vr/vr_device_provider.h" | 19 #include "device/vr/vr_device_provider.h" |
| 20 #include "device/vr/vr_export.h" | 20 #include "device/vr/vr_export.h" |
| 21 #include "device/vr/vr_service.mojom.h" | 21 #include "device/vr/vr_service.mojom.h" |
| 22 #include "device/vr/vr_service_impl.h" | 22 #include "device/vr/vr_service_impl.h" |
| 23 #include "mojo/public/cpp/bindings/binding_set.h" | 23 #include "mojo/public/cpp/bindings/binding_set.h" |
| 24 | 24 |
| 25 namespace device { | 25 namespace device { |
| (...skipping 27 matching lines...) Expand all Loading... |
| 53 static void SetInstance(VRDeviceManager* service); | 53 static void SetInstance(VRDeviceManager* service); |
| 54 static bool HasInstance(); | 54 static bool HasInstance(); |
| 55 | 55 |
| 56 void InitializeProviders(); | 56 void InitializeProviders(); |
| 57 void RegisterProvider(std::unique_ptr<VRDeviceProvider> provider); | 57 void RegisterProvider(std::unique_ptr<VRDeviceProvider> provider); |
| 58 | 58 |
| 59 void SchedulePollEvents(); | 59 void SchedulePollEvents(); |
| 60 void PollEvents(); | 60 void PollEvents(); |
| 61 void StopSchedulingPollEvents(); | 61 void StopSchedulingPollEvents(); |
| 62 | 62 |
| 63 using ProviderList = std::vector<linked_ptr<VRDeviceProvider>>; | 63 using ProviderList = std::vector<std::unique_ptr<VRDeviceProvider>>; |
| 64 ProviderList providers_; | 64 ProviderList providers_; |
| 65 | 65 |
| 66 // Devices are owned by their providers. | 66 // Devices are owned by their providers. |
| 67 using DeviceMap = std::map<unsigned int, VRDevice*>; | 67 using DeviceMap = std::map<unsigned int, VRDevice*>; |
| 68 DeviceMap devices_; | 68 DeviceMap devices_; |
| 69 | 69 |
| 70 bool vr_initialized_; | 70 bool vr_initialized_; |
| 71 | 71 |
| 72 using ServiceList = std::vector<VRServiceImpl*>; | 72 using ServiceList = std::vector<VRServiceImpl*>; |
| 73 ServiceList services_; | 73 ServiceList services_; |
| 74 | 74 |
| 75 // For testing. If true will not delete self when consumer count reaches 0. | 75 // For testing. If true will not delete self when consumer count reaches 0. |
| 76 bool keep_alive_; | 76 bool keep_alive_; |
| 77 | 77 |
| 78 bool has_scheduled_poll_; | 78 bool has_scheduled_poll_; |
| 79 | 79 |
| 80 base::ThreadChecker thread_checker_; | 80 base::ThreadChecker thread_checker_; |
| 81 | 81 |
| 82 base::RepeatingTimer timer_; | 82 base::RepeatingTimer timer_; |
| 83 | 83 |
| 84 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); | 84 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 } // namespace content | 87 } // namespace content |
| 88 | 88 |
| 89 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H | 89 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H |
| OLD | NEW |