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 #ifndef CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ | 5 #ifndef CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ |
6 #define CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ | 6 #define CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ |
7 | 7 |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // message and notifies the |delegate_| with the new readings. | 83 // message and notifies the |delegate_| with the new readings. |
84 // Triggers another read from the accelerometer at the current sampling rate. | 84 // Triggers another read from the accelerometer at the current sampling rate. |
85 void OnDataRead(scoped_refptr<Reading> reading, bool success); | 85 void OnDataRead(scoped_refptr<Reading> reading, bool success); |
86 | 86 |
87 // The task runner to use for blocking tasks. | 87 // The task runner to use for blocking tasks. |
88 scoped_refptr<base::TaskRunner> task_runner_; | 88 scoped_refptr<base::TaskRunner> task_runner_; |
89 | 89 |
90 // The last seen accelerometer data. | 90 // The last seen accelerometer data. |
91 AccelerometerUpdate update_; | 91 AccelerometerUpdate update_; |
92 | 92 |
| 93 // True if a valid accelerometer update is available. |
| 94 bool has_update_; |
| 95 |
93 // The accelerometer configuration. | 96 // The accelerometer configuration. |
94 scoped_refptr<Configuration> configuration_; | 97 scoped_refptr<Configuration> configuration_; |
95 | 98 |
96 ObserverList<Observer, true> observers_; | 99 ObserverList<Observer, true> observers_; |
97 | 100 |
98 base::WeakPtrFactory<AccelerometerReader> weak_factory_; | 101 base::WeakPtrFactory<AccelerometerReader> weak_factory_; |
99 | 102 |
100 DISALLOW_COPY_AND_ASSIGN(AccelerometerReader); | 103 DISALLOW_COPY_AND_ASSIGN(AccelerometerReader); |
101 }; | 104 }; |
102 | 105 |
103 } // namespace chromeos | 106 } // namespace chromeos |
104 | 107 |
105 #endif // CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ | 108 #endif // CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ |
OLD | NEW |