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 "content/browser/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" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
62 | 62 |
63 void SensorManagerChromeOS::StartFetchingDeviceOrientationData( | 63 void SensorManagerChromeOS::StartFetchingDeviceOrientationData( |
64 DeviceOrientationHardwareBuffer* buffer) { | 64 DeviceOrientationHardwareBuffer* buffer) { |
65 DCHECK(thread_checker_.CalledOnValidThread()); | 65 DCHECK(thread_checker_.CalledOnValidThread()); |
66 DCHECK(!orientation_buffer_); | 66 DCHECK(!orientation_buffer_); |
67 orientation_buffer_ = buffer; | 67 orientation_buffer_ = buffer; |
68 | 68 |
69 // No compass information, so we cannot provide absolute orientation. | 69 // No compass information, so we cannot provide absolute orientation. |
70 orientation_buffer_->seqlock.WriteBegin(); | 70 orientation_buffer_->seqlock.WriteBegin(); |
71 orientation_buffer_->data.absolute = false; | 71 orientation_buffer_->data.absolute = false; |
72 orientation_buffer_->data.hasAbsolute = true; | |
philipj_slow
2016/02/26 03:54:01
At least ChromeOS looks simple.
timvolodine
2016/03/01 22:36:25
;)
| |
73 orientation_buffer_->seqlock.WriteEnd(); | 72 orientation_buffer_->seqlock.WriteEnd(); |
74 | 73 |
75 if (!motion_buffer_) | 74 if (!motion_buffer_) |
76 StartObservingAccelerometer(); | 75 StartObservingAccelerometer(); |
77 } | 76 } |
78 | 77 |
79 bool SensorManagerChromeOS::StopFetchingDeviceOrientationData() { | 78 bool SensorManagerChromeOS::StopFetchingDeviceOrientationData() { |
80 DCHECK(thread_checker_.CalledOnValidThread()); | 79 DCHECK(thread_checker_.CalledOnValidThread()); |
81 if (!orientation_buffer_) | 80 if (!orientation_buffer_) |
82 return false; | 81 return false; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 orientation_buffer_->seqlock.WriteBegin(); | 159 orientation_buffer_->seqlock.WriteBegin(); |
161 orientation_buffer_->data.beta = beta; | 160 orientation_buffer_->data.beta = beta; |
162 orientation_buffer_->data.hasBeta = true; | 161 orientation_buffer_->data.hasBeta = true; |
163 orientation_buffer_->data.gamma = gamma; | 162 orientation_buffer_->data.gamma = gamma; |
164 orientation_buffer_->data.hasGamma = true; | 163 orientation_buffer_->data.hasGamma = true; |
165 orientation_buffer_->data.allAvailableSensorsAreActive = true; | 164 orientation_buffer_->data.allAvailableSensorsAreActive = true; |
166 orientation_buffer_->seqlock.WriteEnd(); | 165 orientation_buffer_->seqlock.WriteEnd(); |
167 } | 166 } |
168 | 167 |
169 } // namespace content | 168 } // namespace content |
OLD | NEW |