OLD | NEW |
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 #include "content/browser/device_sensors/data_fetcher_shared_memory.h" | 5 #include "device/sensors/data_fetcher_shared_memory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "content/browser/device_sensors/sensor_manager_android.h" | |
9 #include "device/sensors/public/cpp/device_light_hardware_buffer.h" | 8 #include "device/sensors/public/cpp/device_light_hardware_buffer.h" |
10 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" | 9 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h" |
11 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" | 10 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h" |
| 11 #include "device/sensors/sensor_manager_android.h" |
12 | 12 |
13 namespace content { | 13 namespace device { |
14 | 14 |
15 DataFetcherSharedMemory::DataFetcherSharedMemory() { | 15 DataFetcherSharedMemory::DataFetcherSharedMemory() {} |
16 } | |
17 | 16 |
18 DataFetcherSharedMemory::~DataFetcherSharedMemory() { | 17 DataFetcherSharedMemory::~DataFetcherSharedMemory() {} |
19 } | |
20 | 18 |
21 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { | 19 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { |
22 DCHECK(buffer); | 20 DCHECK(buffer); |
23 | 21 |
24 switch (consumer_type) { | 22 switch (consumer_type) { |
25 case CONSUMER_TYPE_MOTION: | 23 case CONSUMER_TYPE_MOTION: |
26 SensorManagerAndroid::GetInstance()->StartFetchingDeviceMotionData( | 24 SensorManagerAndroid::GetInstance()->StartFetchingDeviceMotionData( |
27 static_cast<DeviceMotionHardwareBuffer*>(buffer)); | 25 static_cast<DeviceMotionHardwareBuffer*>(buffer)); |
28 return true; | 26 return true; |
29 case CONSUMER_TYPE_ORIENTATION: | 27 case CONSUMER_TYPE_ORIENTATION: |
30 SensorManagerAndroid::GetInstance()->StartFetchingDeviceOrientationData( | 28 SensorManagerAndroid::GetInstance()->StartFetchingDeviceOrientationData( |
31 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); | 29 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); |
32 return true; | 30 return true; |
33 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: | 31 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: |
34 SensorManagerAndroid::GetInstance()-> | 32 SensorManagerAndroid::GetInstance() |
35 StartFetchingDeviceOrientationAbsoluteData( | 33 ->StartFetchingDeviceOrientationAbsoluteData( |
36 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); | 34 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); |
37 return true; | 35 return true; |
38 case CONSUMER_TYPE_LIGHT: | 36 case CONSUMER_TYPE_LIGHT: |
39 SensorManagerAndroid::GetInstance()->StartFetchingDeviceLightData( | 37 SensorManagerAndroid::GetInstance()->StartFetchingDeviceLightData( |
40 static_cast<DeviceLightHardwareBuffer*>(buffer)); | 38 static_cast<DeviceLightHardwareBuffer*>(buffer)); |
41 return true; | 39 return true; |
42 default: | 40 default: |
43 NOTREACHED(); | 41 NOTREACHED(); |
44 } | 42 } |
45 return false; | 43 return false; |
(...skipping 18 matching lines...) Expand all Loading... |
64 NOTREACHED(); | 62 NOTREACHED(); |
65 } | 63 } |
66 return false; | 64 return false; |
67 } | 65 } |
68 | 66 |
69 void DataFetcherSharedMemory::Shutdown() { | 67 void DataFetcherSharedMemory::Shutdown() { |
70 DataFetcherSharedMemoryBase::Shutdown(); | 68 DataFetcherSharedMemoryBase::Shutdown(); |
71 SensorManagerAndroid::GetInstance()->Shutdown(); | 69 SensorManagerAndroid::GetInstance()->Shutdown(); |
72 } | 70 } |
73 | 71 |
74 } // namespace content | 72 } // namespace device |
OLD | NEW |