| 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 15 matching lines...) Expand all Loading... |
| 26 sensor_manager_->StartFetchingDeviceOrientationData( | 26 sensor_manager_->StartFetchingDeviceOrientationData( |
| 27 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); | 27 static_cast<DeviceOrientationHardwareBuffer*>(buffer)); |
| 28 return true; | 28 return true; |
| 29 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: { | 29 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: { |
| 30 orientation_absolute_buffer_ = | 30 orientation_absolute_buffer_ = |
| 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.allAvailableSensorsAreActive = true; | 36 orientation_absolute_buffer_->data.all_available_sensors_are_active = |
| 37 true; |
| 37 orientation_absolute_buffer_->seqlock.WriteEnd(); | 38 orientation_absolute_buffer_->seqlock.WriteEnd(); |
| 38 return false; | 39 return false; |
| 39 } | 40 } |
| 40 case CONSUMER_TYPE_LIGHT: | 41 case CONSUMER_TYPE_LIGHT: |
| 41 NOTIMPLEMENTED(); | 42 NOTIMPLEMENTED(); |
| 42 return false; | 43 return false; |
| 43 } | 44 } |
| 44 NOTREACHED(); | 45 NOTREACHED(); |
| 45 return false; | 46 return false; |
| 46 } | 47 } |
| 47 | 48 |
| 48 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { | 49 bool DataFetcherSharedMemory::Stop(ConsumerType consumer_type) { |
| 49 switch (consumer_type) { | 50 switch (consumer_type) { |
| 50 case CONSUMER_TYPE_MOTION: | 51 case CONSUMER_TYPE_MOTION: |
| 51 return sensor_manager_->StopFetchingDeviceMotionData(); | 52 return sensor_manager_->StopFetchingDeviceMotionData(); |
| 52 case CONSUMER_TYPE_ORIENTATION: | 53 case CONSUMER_TYPE_ORIENTATION: |
| 53 return sensor_manager_->StopFetchingDeviceOrientationData(); | 54 return sensor_manager_->StopFetchingDeviceOrientationData(); |
| 54 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: | 55 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: |
| 55 if (orientation_absolute_buffer_) { | 56 if (orientation_absolute_buffer_) { |
| 56 orientation_absolute_buffer_->seqlock.WriteBegin(); | 57 orientation_absolute_buffer_->seqlock.WriteBegin(); |
| 57 orientation_absolute_buffer_->data.allAvailableSensorsAreActive = false; | 58 orientation_absolute_buffer_->data.all_available_sensors_are_active = |
| 59 false; |
| 58 orientation_absolute_buffer_->seqlock.WriteEnd(); | 60 orientation_absolute_buffer_->seqlock.WriteEnd(); |
| 59 orientation_absolute_buffer_ = nullptr; | 61 orientation_absolute_buffer_ = nullptr; |
| 60 } | 62 } |
| 61 return true; | 63 return true; |
| 62 case CONSUMER_TYPE_LIGHT: | 64 case CONSUMER_TYPE_LIGHT: |
| 63 NOTIMPLEMENTED(); | 65 NOTIMPLEMENTED(); |
| 64 return false; | 66 return false; |
| 65 } | 67 } |
| 66 NOTREACHED(); | 68 NOTREACHED(); |
| 67 return false; | 69 return false; |
| 68 } | 70 } |
| 69 | 71 |
| 70 } // namespace device | 72 } // namespace device |
| OLD | NEW |