Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(56)

Side by Side Diff: content/browser/device_sensors/sensor_manager_chromeos.cc

Issue 1737443002: Make DeviceOrientationEvent.prototype.absolute non-nullable (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address feedback Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698