| 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 "content/browser/device_sensors/sensor_manager_chromeos.h" | 5 #include "device/sensors/sensor_manager_chromeos.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "chromeos/accelerometer/accelerometer_reader.h" | 9 #include "chromeos/accelerometer/accelerometer_reader.h" |
| 10 #include "chromeos/accelerometer/accelerometer_types.h" | 10 #include "chromeos/accelerometer/accelerometer_types.h" |
| 11 #include "content/browser/device_sensors/device_sensors_consts.h" | 11 #include "device/sensors/device_sensors_consts.h" |
| 12 #include "ui/gfx/geometry/vector3d_f.h" | 12 #include "ui/gfx/geometry/vector3d_f.h" |
| 13 | 13 |
| 14 namespace { | 14 namespace { |
| 15 // Conversion ratio from radians to degrees. | 15 // Conversion ratio from radians to degrees. |
| 16 const double kRad2deg = 180.0 / M_PI; | 16 const double kRad2deg = 180.0 / M_PI; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace content { | 19 namespace device { |
| 20 | 20 |
| 21 SensorManagerChromeOS::SensorManagerChromeOS() | 21 SensorManagerChromeOS::SensorManagerChromeOS() |
| 22 : motion_buffer_(nullptr), orientation_buffer_(nullptr) { | 22 : motion_buffer_(nullptr), orientation_buffer_(nullptr) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 SensorManagerChromeOS::~SensorManagerChromeOS() { | 25 SensorManagerChromeOS::~SensorManagerChromeOS() { |
| 26 } | 26 } |
| 27 | 27 |
| 28 void SensorManagerChromeOS::StartFetchingDeviceMotionData( | 28 void SensorManagerChromeOS::StartFetchingDeviceMotionData( |
| 29 DeviceMotionHardwareBuffer* buffer) { | 29 DeviceMotionHardwareBuffer* buffer) { |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 gamma = -90.0f; | 158 gamma = -90.0f; |
| 159 orientation_buffer_->seqlock.WriteBegin(); | 159 orientation_buffer_->seqlock.WriteBegin(); |
| 160 orientation_buffer_->data.beta = beta; | 160 orientation_buffer_->data.beta = beta; |
| 161 orientation_buffer_->data.hasBeta = true; | 161 orientation_buffer_->data.hasBeta = true; |
| 162 orientation_buffer_->data.gamma = gamma; | 162 orientation_buffer_->data.gamma = gamma; |
| 163 orientation_buffer_->data.hasGamma = true; | 163 orientation_buffer_->data.hasGamma = true; |
| 164 orientation_buffer_->data.allAvailableSensorsAreActive = true; | 164 orientation_buffer_->data.allAvailableSensorsAreActive = true; |
| 165 orientation_buffer_->seqlock.WriteEnd(); | 165 orientation_buffer_->seqlock.WriteEnd(); |
| 166 } | 166 } |
| 167 | 167 |
| 168 } // namespace content | 168 } // namespace device |
| OLD | NEW |