OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "device/sensors/data_fetcher_shared_memory.h" | 5 #include "device/sensors/data_fetcher_shared_memory.h" |
6 | 6 |
7 #include "device/sensors/sensor_manager_chromeos.h" | 7 #include "device/sensors/sensor_manager_chromeos.h" |
8 | 8 |
9 namespace device { | 9 namespace device { |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 static_cast<DeviceOrientationHardwareBuffer*>(buffer); | 31 static_cast<DeviceOrientationHardwareBuffer*>(buffer); |
32 // Absolute device orientation not available on Chrome OS, let the | 32 // Absolute device orientation not available on Chrome OS, let the |
33 // implementation fire an all-null event to signal this to blink. | 33 // implementation fire an all-null event to signal this to blink. |
34 orientation_absolute_buffer_->seqlock.WriteBegin(); | 34 orientation_absolute_buffer_->seqlock.WriteBegin(); |
35 orientation_absolute_buffer_->data.absolute = true; | 35 orientation_absolute_buffer_->data.absolute = true; |
36 orientation_absolute_buffer_->data.all_available_sensors_are_active = | 36 orientation_absolute_buffer_->data.all_available_sensors_are_active = |
37 true; | 37 true; |
38 orientation_absolute_buffer_->seqlock.WriteEnd(); | 38 orientation_absolute_buffer_->seqlock.WriteEnd(); |
39 return false; | 39 return false; |
40 } | 40 } |
41 case CONSUMER_TYPE_LIGHT: | |
42 NOTIMPLEMENTED(); | |
43 return false; | |
44 } | 41 } |
45 NOTREACHED(); | 42 NOTREACHED(); |
46 return false; | 43 return false; |
47 } | 44 } |
48 | 45 |
49 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { | 46 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { |
50 switch (consumer_type) { | 47 switch (consumer_type) { |
51 case CONSUMER_TYPE_MOTION: | 48 case CONSUMER_TYPE_MOTION: |
52 return sensor_manager_->StopFetchingDeviceMotionData(); | 49 return sensor_manager_->StopFetchingDeviceMotionData(); |
53 case CONSUMER_TYPE_ORIENTATION: | 50 case CONSUMER_TYPE_ORIENTATION: |
54 return sensor_manager_->StopFetchingDeviceOrientationData(); | 51 return sensor_manager_->StopFetchingDeviceOrientationData(); |
55 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: | 52 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: |
56 if (orientation_absolute_buffer_) { | 53 if (orientation_absolute_buffer_) { |
57 orientation_absolute_buffer_->seqlock.WriteBegin(); | 54 orientation_absolute_buffer_->seqlock.WriteBegin(); |
58 orientation_absolute_buffer_->data.all_available_sensors_are_active = | 55 orientation_absolute_buffer_->data.all_available_sensors_are_active = |
59 false; | 56 false; |
60 orientation_absolute_buffer_->seqlock.WriteEnd(); | 57 orientation_absolute_buffer_->seqlock.WriteEnd(); |
61 orientation_absolute_buffer_ = nullptr; | 58 orientation_absolute_buffer_ = nullptr; |
62 } | 59 } |
63 return true; | 60 return true; |
64 case CONSUMER_TYPE_LIGHT: | |
65 NOTIMPLEMENTED(); | |
66 return false; | |
67 } | 61 } |
68 NOTREACHED(); | 62 NOTREACHED(); |
69 return false; | 63 return false; |
70 } | 64 } |
71 | 65 |
72 } // namespace device | 66 } // namespace device |
OLD | NEW |