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

Side by Side Diff: device/sensors/data_fetcher_shared_memory_android.cc

Issue 2819273006: Move //device/sensor impl to be part of the internal implemenation of the Device Service. (Closed)
Patch Set: Move //device/sensor impl to be part of the internal implemenation of the Device Service Created 3 years, 8 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
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "device/sensors/data_fetcher_shared_memory.h"
6
7 #include "base/logging.h"
8 #include "device/sensors/public/cpp/device_light_hardware_buffer.h"
9 #include "device/sensors/public/cpp/device_motion_hardware_buffer.h"
10 #include "device/sensors/public/cpp/device_orientation_hardware_buffer.h"
11 #include "device/sensors/sensor_manager_android.h"
12
13 namespace device {
14
15 DataFetcherSharedMemory::DataFetcherSharedMemory() {}
16
17 DataFetcherSharedMemory::~DataFetcherSharedMemory() {}
18
19 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) {
20 DCHECK(buffer);
21
22 switch (consumer_type) {
23 case CONSUMER_TYPE_MOTION:
24 SensorManagerAndroid::GetInstance()->StartFetchingDeviceMotionData(
25 static_cast<DeviceMotionHardwareBuffer*>(buffer));
26 return true;
27 case CONSUMER_TYPE_ORIENTATION:
28 SensorManagerAndroid::GetInstance()->StartFetchingDeviceOrientationData(
29 static_cast<DeviceOrientationHardwareBuffer*>(buffer));
30 return true;
31 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE:
32 SensorManagerAndroid::GetInstance()
33 ->StartFetchingDeviceOrientationAbsoluteData(
34 static_cast<DeviceOrientationHardwareBuffer*>(buffer));
35 return true;
36 case CONSUMER_TYPE_LIGHT:
37 SensorManagerAndroid::GetInstance()->StartFetchingDeviceLightData(
38 static_cast<DeviceLightHardwareBuffer*>(buffer));
39 return true;
40 default:
41 NOTREACHED();
42 }
43 return false;
44 }
45
46 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) {
47 switch (consumer_type) {
48 case CONSUMER_TYPE_MOTION:
49 SensorManagerAndroid::GetInstance()->StopFetchingDeviceMotionData();
50 return true;
51 case CONSUMER_TYPE_ORIENTATION:
52 SensorManagerAndroid::GetInstance()->StopFetchingDeviceOrientationData();
53 return true;
54 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE:
55 SensorManagerAndroid::GetInstance()
56 ->StopFetchingDeviceOrientationAbsoluteData();
57 return true;
58 case CONSUMER_TYPE_LIGHT:
59 SensorManagerAndroid::GetInstance()->StopFetchingDeviceLightData();
60 return true;
61 default:
62 NOTREACHED();
63 }
64 return false;
65 }
66
67 void DataFetcherSharedMemory::Shutdown() {
68 DataFetcherSharedMemoryBase::Shutdown();
69 SensorManagerAndroid::GetInstance()->Shutdown();
70 }
71
72 } // namespace device
OLDNEW
« no previous file with comments | « device/sensors/data_fetcher_shared_memory.h ('k') | device/sensors/data_fetcher_shared_memory_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698