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

Side by Side Diff: device/generic_sensor/platform_sensor_provider_base.h

Issue 2480773002: Reland of [sensors] Ambient light sensor implementation for ChromeOS and Linux. (Closed)
Patch Set: remove parenthesis Created 4 years, 1 month 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 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_PROVIDER_BASE_H_ 5 #ifndef DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_BASE_H_
6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_BASE_H_ 6 #define DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_BASE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 9
10 #include "base/threading/non_thread_safe.h" 10 #include "base/threading/non_thread_safe.h"
(...skipping 17 matching lines...) Expand all
28 // Gets previously created instance of PlatformSensor by sensor type |type|. 28 // Gets previously created instance of PlatformSensor by sensor type |type|.
29 scoped_refptr<PlatformSensor> GetSensor(mojom::SensorType type); 29 scoped_refptr<PlatformSensor> GetSensor(mojom::SensorType type);
30 30
31 // Shared buffer getters. 31 // Shared buffer getters.
32 mojo::ScopedSharedBufferHandle CloneSharedBufferHandle(); 32 mojo::ScopedSharedBufferHandle CloneSharedBufferHandle();
33 33
34 // Returns 'true' if some of sensor instances produced by this provider are 34 // Returns 'true' if some of sensor instances produced by this provider are
35 // alive; 'false' otherwise. 35 // alive; 'false' otherwise.
36 bool HasSensors() const; 36 bool HasSensors() const;
37 37
38 // Implementations might want to override this in order to be able
39 // to read from sensor files. For example, linux does so.
40 virtual void SetFileTaskRunner(
41 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner) {}
42
38 protected: 43 protected:
39 PlatformSensorProviderBase(); 44 PlatformSensorProviderBase();
40 virtual ~PlatformSensorProviderBase(); 45 virtual ~PlatformSensorProviderBase();
41 46
42 // Method that must be implemented by platform specific classes. 47 // Method that must be implemented by platform specific classes.
43 virtual void CreateSensorInternal(mojom::SensorType type, 48 virtual void CreateSensorInternal(mojom::SensorType type,
44 mojo::ScopedSharedBufferMapping mapping, 49 mojo::ScopedSharedBufferMapping mapping,
45 const CreateSensorCallback& callback) = 0; 50 const CreateSensorCallback& callback) = 0;
46 51
47 // Implementations might override this method to free resources when there 52 // Implementations might override this method to free resources when there
(...skipping 14 matching lines...) Expand all
62 std::map<mojom::SensorType, PlatformSensor*> sensor_map_; 67 std::map<mojom::SensorType, PlatformSensor*> sensor_map_;
63 std::map<mojom::SensorType, CallbackQueue> requests_map_; 68 std::map<mojom::SensorType, CallbackQueue> requests_map_;
64 mojo::ScopedSharedBufferHandle shared_buffer_handle_; 69 mojo::ScopedSharedBufferHandle shared_buffer_handle_;
65 70
66 DISALLOW_COPY_AND_ASSIGN(PlatformSensorProviderBase); 71 DISALLOW_COPY_AND_ASSIGN(PlatformSensorProviderBase);
67 }; 72 };
68 73
69 } // namespace device 74 } // namespace device
70 75
71 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_BASE_H_ 76 #endif // DEVICE_GENERIC_SENSOR_PLATFORM_SENSOR_PROVIDER_BASE_H_
OLDNEW
« no previous file with comments | « device/generic_sensor/platform_sensor_provider.cc ('k') | device/generic_sensor/platform_sensor_provider_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698