| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_LINUX_H_ | 5 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_LINUX_H_ |
| 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_LINUX_H_ | 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_LINUX_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 SensorReader(base::WeakPtr<PlatformSensorLinux> sensor, | 47 SensorReader(base::WeakPtr<PlatformSensorLinux> sensor, |
| 48 scoped_refptr<base::SingleThreadTaskRunner> task_runner); | 48 scoped_refptr<base::SingleThreadTaskRunner> task_runner); |
| 49 | 49 |
| 50 // Notifies |sensor_| about an error. | 50 // Notifies |sensor_| about an error. |
| 51 void NotifyReadError(); | 51 void NotifyReadError(); |
| 52 | 52 |
| 53 // In builds with DCHECK enabled checks that methods of this | 53 // In builds with DCHECK enabled checks that methods of this |
| 54 // and derived classes are called on a right thread. | 54 // and derived classes are called on a right thread. |
| 55 base::ThreadChecker thread_checker_; | 55 THREAD_CHECKER(thread_checker_); |
| 56 | 56 |
| 57 // A sensor that this reader is owned by and notifies about errors and | 57 // A sensor that this reader is owned by and notifies about errors and |
| 58 // readings to. | 58 // readings to. |
| 59 base::WeakPtr<PlatformSensorLinux> sensor_; | 59 base::WeakPtr<PlatformSensorLinux> sensor_; |
| 60 | 60 |
| 61 // A task runner that is used to report about new readings and errors | 61 // A task runner that is used to report about new readings and errors |
| 62 // to a |sensor_|. | 62 // to a |sensor_|. |
| 63 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 63 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
| 64 | 64 |
| 65 // Indicates if reading is active. | 65 // Indicates if reading is active. |
| 66 bool is_reading_active_; | 66 bool is_reading_active_; |
| 67 | 67 |
| 68 DISALLOW_COPY_AND_ASSIGN(SensorReader); | 68 DISALLOW_COPY_AND_ASSIGN(SensorReader); |
| 69 }; | 69 }; |
| 70 | 70 |
| 71 } // namespace device | 71 } // namespace device |
| 72 | 72 |
| 73 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_LINUX_H_ | 73 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_READER_LINUX_H_ |
| OLD | NEW |