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 "content/browser/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 "content/browser/device_sensors/sensor_manager_android.h" |
9 #include "content/common/device_sensors/device_motion_hardware_buffer.h" | 9 #include "content/common/device_sensors/device_motion_hardware_buffer.h" |
10 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" | 10 #include "content/common/device_sensors/device_orientation_hardware_buffer.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 DataFetcherSharedMemory::DataFetcherSharedMemory() { | 14 DataFetcherSharedMemory::DataFetcherSharedMemory() { |
15 } | 15 } |
16 | 16 |
17 DataFetcherSharedMemory::~DataFetcherSharedMemory() { | 17 DataFetcherSharedMemory::~DataFetcherSharedMemory() { |
| 18 StopFetchingAllDeviceData(); |
18 } | 19 } |
19 | 20 |
20 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { | 21 bool DataFetcherSharedMemory::Start(ConsumerType consumer_type, void* buffer) { |
21 DCHECK(buffer); | 22 DCHECK(buffer); |
22 | 23 |
23 switch (consumer_type) { | 24 switch (consumer_type) { |
24 case CONSUMER_TYPE_MOTION: | 25 case CONSUMER_TYPE_MOTION: |
25 return SensorManagerAndroid::GetInstance()-> | 26 return SensorManagerAndroid::GetInstance()-> |
26 StartFetchingDeviceMotionData( | 27 StartFetchingDeviceMotionData( |
27 static_cast<DeviceMotionHardwareBuffer*>(buffer)); | 28 static_cast<DeviceMotionHardwareBuffer*>(buffer)); |
(...skipping 15 matching lines...) Expand all Loading... |
43 case CONSUMER_TYPE_ORIENTATION: | 44 case CONSUMER_TYPE_ORIENTATION: |
44 SensorManagerAndroid::GetInstance()->StopFetchingDeviceOrientationData(); | 45 SensorManagerAndroid::GetInstance()->StopFetchingDeviceOrientationData(); |
45 return true; | 46 return true; |
46 default: | 47 default: |
47 NOTREACHED(); | 48 NOTREACHED(); |
48 } | 49 } |
49 return false; | 50 return false; |
50 } | 51 } |
51 | 52 |
52 } // namespace content | 53 } // namespace content |
OLD | NEW |