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 OnDataRead has been called with success == true, and observers can | |
flackr
2015/02/06 20:18:20
nit: Observers can be notified is implementation d
jonross
2015/02/09 14:54:48
Done.
| |
94 // be notified. | |
95 bool successful_reading_; | |
96 | |
93 // The accelerometer configuration. | 97 // The accelerometer configuration. |
94 scoped_refptr<Configuration> configuration_; | 98 scoped_refptr<Configuration> configuration_; |
95 | 99 |
96 ObserverList<Observer, true> observers_; | 100 ObserverList<Observer, true> observers_; |
97 | 101 |
98 base::WeakPtrFactory<AccelerometerReader> weak_factory_; | 102 base::WeakPtrFactory<AccelerometerReader> weak_factory_; |
99 | 103 |
100 DISALLOW_COPY_AND_ASSIGN(AccelerometerReader); | 104 DISALLOW_COPY_AND_ASSIGN(AccelerometerReader); |
101 }; | 105 }; |
102 | 106 |
103 } // namespace chromeos | 107 } // namespace chromeos |
104 | 108 |
105 #endif // CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ | 109 #endif // CHROMEOS_ACCELEROMETER_ACCELEROMETER_READER_H_ |
OLD | NEW |