| 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 <GuidDef.h> | 7 #include <GuidDef.h> |
| 8 #include <InitGuid.h> | 8 #include <InitGuid.h> |
| 9 #include <PortableDeviceTypes.h> | 9 #include <PortableDeviceTypes.h> |
| 10 #include <Sensors.h> | 10 #include <Sensors.h> |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 explicit SensorEventSinkOrientation( | 107 explicit SensorEventSinkOrientation( |
| 108 DeviceOrientationHardwareBuffer* const buffer) : buffer_(buffer) {} | 108 DeviceOrientationHardwareBuffer* const buffer) : buffer_(buffer) {} |
| 109 ~SensorEventSinkOrientation() override {} | 109 ~SensorEventSinkOrientation() override {} |
| 110 | 110 |
| 111 protected: | 111 protected: |
| 112 bool UpdateSharedMemoryBuffer( | 112 bool UpdateSharedMemoryBuffer( |
| 113 ISensor* sensor, ISensorDataReport* new_data) override { | 113 ISensor* sensor, ISensorDataReport* new_data) override { |
| 114 double alpha, beta, gamma; | 114 double alpha, beta, gamma; |
| 115 bool has_alpha, has_beta, has_gamma; | 115 bool has_alpha, has_beta, has_gamma; |
| 116 | 116 |
| 117 GetSensorValue(SENSOR_DATA_TYPE_TILT_X_DEGREES, new_data, &alpha, | 117 GetSensorValue(SENSOR_DATA_TYPE_TILT_X_DEGREES, new_data, &beta, |
| 118 &has_beta); |
| 119 GetSensorValue(SENSOR_DATA_TYPE_TILT_Y_DEGREES, new_data, &gamma, |
| 120 &has_gamma); |
| 121 GetSensorValue(SENSOR_DATA_TYPE_TILT_Z_DEGREES, new_data, &alpha, |
| 118 &has_alpha); | 122 &has_alpha); |
| 119 GetSensorValue(SENSOR_DATA_TYPE_TILT_Y_DEGREES, new_data, &beta, | |
| 120 &has_beta); | |
| 121 GetSensorValue(SENSOR_DATA_TYPE_TILT_Z_DEGREES, new_data, &gamma, | |
| 122 &has_gamma); | |
| 123 | 123 |
| 124 if (buffer_) { | 124 if (buffer_) { |
| 125 buffer_->seqlock.WriteBegin(); | 125 buffer_->seqlock.WriteBegin(); |
| 126 buffer_->data.alpha = alpha; | 126 buffer_->data.alpha = alpha; |
| 127 buffer_->data.hasAlpha = has_alpha; | 127 buffer_->data.hasAlpha = has_alpha; |
| 128 buffer_->data.beta = beta; | 128 buffer_->data.beta = beta; |
| 129 buffer_->data.hasBeta = has_beta; | 129 buffer_->data.hasBeta = has_beta; |
| 130 buffer_->data.gamma = gamma; | 130 buffer_->data.gamma = gamma; |
| 131 buffer_->data.hasGamma = has_gamma; | 131 buffer_->data.hasGamma = has_gamma; |
| 132 buffer_->data.absolute = has_alpha || has_beta || has_gamma; | 132 buffer_->data.absolute = has_alpha || has_beta || has_gamma; |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 motion_buffer_->data.allAvailableSensorsAreActive = enabled; | 465 motion_buffer_->data.allAvailableSensorsAreActive = enabled; |
| 466 motion_buffer_->seqlock.WriteEnd(); | 466 motion_buffer_->seqlock.WriteEnd(); |
| 467 } | 467 } |
| 468 break; | 468 break; |
| 469 default: | 469 default: |
| 470 NOTREACHED(); | 470 NOTREACHED(); |
| 471 } | 471 } |
| 472 } | 472 } |
| 473 | 473 |
| 474 } // namespace content | 474 } // namespace content |
| OLD | NEW |