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

Side by Side Diff: services/device/generic_sensor/platform_sensor_accelerometer_mac.cc

Issue 2865263002: Move //device/generic_sensor to be part of the internal implementation of the Device Service. (Closed)
Patch Set: code rebase Created 3 years, 7 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 "device/generic_sensor/platform_sensor_accelerometer_mac.h" 5 #include "services/device/generic_sensor/platform_sensor_accelerometer_mac.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <cmath> 9 #include <cmath>
10 10
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "device/base/synchronization/shared_memory_seqlock_buffer.h" 12 #include "device/base/synchronization/shared_memory_seqlock_buffer.h"
13 #include "device/generic_sensor/generic_sensor_consts.h" 13 #include "services/device/generic_sensor/generic_sensor_consts.h"
14 #include "device/generic_sensor/platform_sensor_provider_mac.h" 14 #include "services/device/generic_sensor/platform_sensor_provider_mac.h"
15 #include "third_party/sudden_motion_sensor/sudden_motion_sensor_mac.h" 15 #include "third_party/sudden_motion_sensor/sudden_motion_sensor_mac.h"
16 16
17 namespace { 17 namespace {
18 18
19 constexpr double kMeanGravity = 9.80665; 19 constexpr double kMeanGravity = 9.80665;
20 20
21 constexpr double kGravityThreshold = kMeanGravity * 0.01; 21 constexpr double kGravityThreshold = kMeanGravity * 0.01;
22 22
23 bool IsSignificantlyDifferent(const device::SensorReading& reading1, 23 bool IsSignificantlyDifferent(const device::SensorReading& reading1,
24 const device::SensorReading& reading2) { 24 const device::SensorReading& reading2) {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 reading.values[1] = axis_value[1] * kMeanGravity; 94 reading.values[1] = axis_value[1] * kMeanGravity;
95 reading.values[2] = axis_value[2] * kMeanGravity; 95 reading.values[2] = axis_value[2] * kMeanGravity;
96 96
97 if (IsSignificantlyDifferent(reading_, reading)) { 97 if (IsSignificantlyDifferent(reading_, reading)) {
98 reading_ = reading; 98 reading_ = reading;
99 UpdateSensorReading(reading, true); 99 UpdateSensorReading(reading, true);
100 } 100 }
101 } 101 }
102 102
103 } // namespace device 103 } // namespace device
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698