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

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

Issue 2266793002: Add SchedulePollEvents and PollEvents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add StopSchedulingPollEvents Created 4 years, 3 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 | « AUTHORS ('k') | device/vr/vr_device_manager.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_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/linked_ptr.h"
16 #include "base/threading/thread_checker.h" 16 #include "base/threading/thread_checker.h"
17 #include "base/timer/timer.h"
17 #include "device/vr/vr_client_dispatcher.h" 18 #include "device/vr/vr_client_dispatcher.h"
18 #include "device/vr/vr_device.h" 19 #include "device/vr/vr_device.h"
19 #include "device/vr/vr_device_provider.h" 20 #include "device/vr/vr_device_provider.h"
20 #include "device/vr/vr_export.h" 21 #include "device/vr/vr_export.h"
21 #include "device/vr/vr_service.mojom.h" 22 #include "device/vr/vr_service.mojom.h"
22 #include "device/vr/vr_service_impl.h" 23 #include "device/vr/vr_service_impl.h"
23 #include "mojo/public/cpp/bindings/binding_set.h" 24 #include "mojo/public/cpp/bindings/binding_set.h"
24 25
25 namespace device { 26 namespace device {
26 27
(...skipping 22 matching lines...) Expand all
49 // Constructor for testing. 50 // Constructor for testing.
50 DEVICE_VR_EXPORT explicit VRDeviceManager( 51 DEVICE_VR_EXPORT explicit VRDeviceManager(
51 std::unique_ptr<VRDeviceProvider> provider); 52 std::unique_ptr<VRDeviceProvider> provider);
52 53
53 static void SetInstance(VRDeviceManager* service); 54 static void SetInstance(VRDeviceManager* service);
54 static bool HasInstance(); 55 static bool HasInstance();
55 56
56 void InitializeProviders(); 57 void InitializeProviders();
57 void RegisterProvider(std::unique_ptr<VRDeviceProvider> provider); 58 void RegisterProvider(std::unique_ptr<VRDeviceProvider> provider);
58 59
60 void SchedulePollEvents();
61 void PollEvents();
62 void StopSchedulingPollEvents();
63
59 using ProviderList = std::vector<linked_ptr<VRDeviceProvider>>; 64 using ProviderList = std::vector<linked_ptr<VRDeviceProvider>>;
60 ProviderList providers_; 65 ProviderList providers_;
61 66
62 // Devices are owned by their providers. 67 // Devices are owned by their providers.
63 using DeviceMap = std::map<unsigned int, VRDevice*>; 68 using DeviceMap = std::map<unsigned int, VRDevice*>;
64 DeviceMap devices_; 69 DeviceMap devices_;
65 70
66 bool vr_initialized_; 71 bool vr_initialized_;
67 72
68 using ServiceList = std::vector<VRServiceImpl*>; 73 using ServiceList = std::vector<VRServiceImpl*>;
69 ServiceList services_; 74 ServiceList services_;
70 75
71 // For testing. If true will not delete self when consumer count reaches 0. 76 // For testing. If true will not delete self when consumer count reaches 0.
72 bool keep_alive_; 77 bool keep_alive_;
73 78
79 bool has_scheduled_poll_;
80
74 base::ThreadChecker thread_checker_; 81 base::ThreadChecker thread_checker_;
75 82
83 base::RepeatingTimer timer_;
84
76 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager); 85 DISALLOW_COPY_AND_ASSIGN(VRDeviceManager);
77 }; 86 };
78 87
79 } // namespace content 88 } // namespace content
80 89
81 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H 90 #endif // CONTENT_BROWSER_VR_VR_DEVICE_MANAGER_H
OLDNEW
« no previous file with comments | « AUTHORS ('k') | device/vr/vr_device_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698