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/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" | 8 #include "device/device_sensors/device_light_hardware_buffer.h" |
9 #include "content/common/device_sensors/device_light_hardware_buffer.h" | 9 #include "device/device_sensors/device_motion_hardware_buffer.h" |
10 #include "content/common/device_sensors/device_motion_hardware_buffer.h" | 10 #include "device/device_sensors/device_orientation_hardware_buffer.h" |
11 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" | 11 #include "device/device_sensors/sensor_manager_android.h" |
12 | 12 |
13 namespace content { | 13 namespace content { |
14 | 14 |
15 DataFetcherSharedMemory::DataFetcherSharedMemory() { | 15 DataFetcherSharedMemory::DataFetcherSharedMemory() { |
16 } | 16 } |
17 | 17 |
18 DataFetcherSharedMemory::~DataFetcherSharedMemory() { | 18 DataFetcherSharedMemory::~DataFetcherSharedMemory() { |
19 } | 19 } |
20 | 20 |
21 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { | 21 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { |
22 DCHECK(buffer); | 22 DCHECK(buffer); |
23 | 23 |
24 switch (consumer_type) { | 24 switch (consumer_type) { |
25 case CONSUMER_TYPE_MOTION: | 25 case CONSUMER_TYPE_MOTION: |
26 return SensorManagerAndroid::GetInstance()-> | 26 return SensorManagerAndroid::GetInstance()->StartFetchingDeviceMotionData( |
27 StartFetchingDeviceMotionData( | 27 static_cast<DeviceMotionHardwareBuffer*>(buffer)); |
28 static_cast<DeviceMotionHardwareBuffer*>(buffer)); | |
29 case CONSUMER_TYPE_ORIENTATION: | 28 case CONSUMER_TYPE_ORIENTATION: |
30 return SensorManagerAndroid::GetInstance()-> | 29 return SensorManagerAndroid::GetInstance() |
31 StartFetchingDeviceOrientationData( | 30 ->StartFetchingDeviceOrientationData( |
32 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); | 31 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); |
33 case CONSUMER_TYPE_LIGHT: | 32 case CONSUMER_TYPE_LIGHT: |
34 return SensorManagerAndroid::GetInstance()->StartFetchingDeviceLightData( | 33 return SensorManagerAndroid::GetInstance()->StartFetchingDeviceLightData( |
35 static_cast<DeviceLightHardwareBuffer*>(buffer)); | 34 static_cast<DeviceLightHardwareBuffer*>(buffer)); |
36 default: | 35 default: |
37 NOTREACHED(); | 36 NOTREACHED(); |
38 } | 37 } |
39 return false; | 38 return false; |
40 } | 39 } |
41 | 40 |
(...skipping 13 matching lines...) Expand all Loading... |
55 } | 54 } |
56 return false; | 55 return false; |
57 } | 56 } |
58 | 57 |
59 void DataFetcherSharedMemory::Shutdown() { | 58 void DataFetcherSharedMemory::Shutdown() { |
60 DataFetcherSharedMemoryBase::Shutdown(); | 59 DataFetcherSharedMemoryBase::Shutdown(); |
61 SensorManagerAndroid::GetInstance()->Shutdown(); | 60 SensorManagerAndroid::GetInstance()->Shutdown(); |
62 } | 61 } |
63 | 62 |
64 } // namespace content | 63 } // namespace content |
OLD | NEW |