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

Side by Side Diff: content/browser/device_sensors/sensor_manager_android.h

Issue 2410123002: Remove content::BrowserThread knowledge from Device Sensors (Closed)
Patch Set: Rebase, avoid object creation on startup 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ 5 #ifndef CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_
6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ 6 #define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h"
13 #include "base/sequenced_task_runner.h"
12 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
13 #include "content/browser/device_sensors/device_sensors_consts.h" 15 #include "content/browser/device_sensors/device_sensors_consts.h"
14 #include "content/common/content_export.h" 16 #include "content/common/content_export.h"
15 #include "device/sensors/public/cpp/device_light_hardware_buffer.h" 17 #include "device/sensors/public/cpp/device_light_hardware_buffer.h"
16 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" 18 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h"
17 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" 19 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h"
18 20
19 namespace base { 21 namespace base {
20 template <typename T> 22 template <typename T>
21 struct DefaultSingletonTraits; 23 struct DefaultSingletonTraits;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 void StopFetchingDeviceMotionData(); 77 void StopFetchingDeviceMotionData();
76 78
77 void StartFetchingDeviceOrientationData( 79 void StartFetchingDeviceOrientationData(
78 DeviceOrientationHardwareBuffer* buffer); 80 DeviceOrientationHardwareBuffer* buffer);
79 void StopFetchingDeviceOrientationData(); 81 void StopFetchingDeviceOrientationData();
80 82
81 void StartFetchingDeviceOrientationAbsoluteData( 83 void StartFetchingDeviceOrientationAbsoluteData(
82 DeviceOrientationHardwareBuffer* buffer); 84 DeviceOrientationHardwareBuffer* buffer);
83 void StopFetchingDeviceOrientationAbsoluteData(); 85 void StopFetchingDeviceOrientationAbsoluteData();
84 86
85 void Shutdown(); 87 void SetUITaskRunner(scoped_refptr<base::SequencedTaskRunner> ui_task_runner);
88 void ShutDownOnUIThread();
86 89
87 // A Java counterpart will be generated for this enum. 90 // A Java counterpart will be generated for this enum.
88 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser 91 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content.browser
89 // When adding new constants don't modify the order as they are used for UMA. 92 // When adding new constants don't modify the order as they are used for UMA.
90 enum OrientationSensorType { 93 enum OrientationSensorType {
91 NOT_AVAILABLE = 0, 94 NOT_AVAILABLE = 0,
92 ROTATION_VECTOR = 1, 95 ROTATION_VECTOR = 1,
93 ACCELEROMETER_MAGNETIC = 2, 96 ACCELEROMETER_MAGNETIC = 2,
94 GAME_ROTATION_VECTOR = 3, 97 GAME_ROTATION_VECTOR = 3,
95 ORIENTATION_SENSOR_MAX = 4, 98 ORIENTATION_SENSOR_MAX = 4,
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 156
154 bool motion_buffer_initialized_; 157 bool motion_buffer_initialized_;
155 bool orientation_buffer_initialized_; 158 bool orientation_buffer_initialized_;
156 bool orientation_absolute_buffer_initialized_; 159 bool orientation_absolute_buffer_initialized_;
157 160
158 base::Lock light_buffer_lock_; 161 base::Lock light_buffer_lock_;
159 base::Lock motion_buffer_lock_; 162 base::Lock motion_buffer_lock_;
160 base::Lock orientation_buffer_lock_; 163 base::Lock orientation_buffer_lock_;
161 base::Lock orientation_absolute_buffer_lock_; 164 base::Lock orientation_absolute_buffer_lock_;
162 165
166 scoped_refptr<base::SequencedTaskRunner> ui_task_runner_;
167
163 bool is_shutdown_; 168 bool is_shutdown_;
164 169
165 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid); 170 DISALLOW_COPY_AND_ASSIGN(SensorManagerAndroid);
166 }; 171 };
167 172
168 } // namespace content 173 } // namespace content
169 174
170 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_ 175 #endif // CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_ANDROID_H_
OLDNEW
« no previous file with comments | « content/browser/device_sensors/device_sensor_service.cc ('k') | content/browser/device_sensors/sensor_manager_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698