| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 sudden_motion_sensor_.get() != nullptr; | 187 sudden_motion_sensor_.get() != nullptr; |
| 188 | 188 |
| 189 orientation_buffer_ = | 189 orientation_buffer_ = |
| 190 static_cast<DeviceOrientationHardwareBuffer*>(buffer); | 190 static_cast<DeviceOrientationHardwareBuffer*>(buffer); |
| 191 UMA_HISTOGRAM_BOOLEAN("InertialSensor.OrientationMacAvailable", | 191 UMA_HISTOGRAM_BOOLEAN("InertialSensor.OrientationMacAvailable", |
| 192 sudden_motion_sensor_available); | 192 sudden_motion_sensor_available); |
| 193 if (sudden_motion_sensor_available) { | 193 if (sudden_motion_sensor_available) { |
| 194 // On Mac we cannot provide absolute orientation. | 194 // On Mac we cannot provide absolute orientation. |
| 195 orientation_buffer_->seqlock.WriteBegin(); | 195 orientation_buffer_->seqlock.WriteBegin(); |
| 196 orientation_buffer_->data.absolute = false; | 196 orientation_buffer_->data.absolute = false; |
| 197 orientation_buffer_->data.hasAbsolute = true; | |
| 198 orientation_buffer_->seqlock.WriteEnd(); | 197 orientation_buffer_->seqlock.WriteEnd(); |
| 199 } else { | 198 } else { |
| 200 // No motion sensor available, fire an all-null event. | 199 // No motion sensor available, fire an all-null event. |
| 201 orientation_buffer_->seqlock.WriteBegin(); | 200 orientation_buffer_->seqlock.WriteBegin(); |
| 202 orientation_buffer_->data.allAvailableSensorsAreActive = true; | 201 orientation_buffer_->data.allAvailableSensorsAreActive = true; |
| 203 orientation_buffer_->seqlock.WriteEnd(); | 202 orientation_buffer_->seqlock.WriteEnd(); |
| 204 } | 203 } |
| 205 return sudden_motion_sensor_available; | 204 return sudden_motion_sensor_available; |
| 206 } | 205 } |
| 207 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: { | 206 case CONSUMER_TYPE_ORIENTATION_ABSOLUTE: { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 light_buffer_ = nullptr; | 258 light_buffer_ = nullptr; |
| 260 } | 259 } |
| 261 return true; | 260 return true; |
| 262 default: | 261 default: |
| 263 NOTREACHED(); | 262 NOTREACHED(); |
| 264 } | 263 } |
| 265 return false; | 264 return false; |
| 266 } | 265 } |
| 267 | 266 |
| 268 } // namespace content | 267 } // namespace content |
| OLD | NEW |