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

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

Issue 2569763004: [sensors](Linux) Fix tsan data race in sensor reader (Closed)
Patch Set: don't use BindToCurrentLoop, but rather pass a task runner and callbacks Created 4 years 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_PUBLIC_PLATFORM_SENSOR_PROVIDER_LINUX_H_ 5 #ifndef DEVICE_GENERIC_SENSOR_PUBLIC_PLATFORM_SENSOR_PROVIDER_LINUX_H_
6 #define DEVICE_GENERIC_SENSOR_PUBLIC_PLATFORM_SENSOR_PROVIDER_LINUX_H_ 6 #define DEVICE_GENERIC_SENSOR_PUBLIC_PLATFORM_SENSOR_PROVIDER_LINUX_H_
7 7
8 #include "device/generic_sensor/platform_sensor_provider.h" 8 #include "device/generic_sensor/platform_sensor_provider.h"
9 9
10 #include "device/generic_sensor/linux/sensor_device_manager.h" 10 #include "device/generic_sensor/linux/sensor_device_manager.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 50
51 using SensorDeviceMap = 51 using SensorDeviceMap =
52 std::unordered_map<mojom::SensorType, std::unique_ptr<SensorInfoLinux>>; 52 std::unordered_map<mojom::SensorType, std::unique_ptr<SensorInfoLinux>>;
53 53
54 PlatformSensorProviderLinux(); 54 PlatformSensorProviderLinux();
55 55
56 void SensorDeviceFound( 56 void SensorDeviceFound(
57 mojom::SensorType type, 57 mojom::SensorType type,
58 mojo::ScopedSharedBufferMapping mapping, 58 mojo::ScopedSharedBufferMapping mapping,
59 const PlatformSensorProviderBase::CreateSensorCallback& callback, 59 const PlatformSensorProviderBase::CreateSensorCallback& callback,
60 SensorInfoLinux* sensor_device); 60 const SensorInfoLinux* sensor_device);
61 61
62 bool StartPollingThread(); 62 bool StartPollingThread();
63 63
64 // Stops a polling thread if there are no sensors left. Must be called on 64 // Stops a polling thread if there are no sensors left. Must be called on
65 // a different than the polling thread which allows I/O. 65 // a different than the polling thread which allows I/O.
66 void StopPollingThread(); 66 void StopPollingThread();
67 67
68 // Shuts down a service that tracks events from iio subsystem. 68 // Shuts down a service that tracks events from iio subsystem.
69 void Shutdown(); 69 void Shutdown();
70 70
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 // provider to stop a polling thread and passed to a manager that 111 // provider to stop a polling thread and passed to a manager that
112 // runs a linux device monitor service on this task runner. 112 // runs a linux device monitor service on this task runner.
113 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; 113 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_;
114 114
115 DISALLOW_COPY_AND_ASSIGN(PlatformSensorProviderLinux); 115 DISALLOW_COPY_AND_ASSIGN(PlatformSensorProviderLinux);
116 }; 116 };
117 117
118 } // namespace device 118 } // namespace device
119 119
120 #endif // DEVICE_GENERIC_SENSOR_PUBLIC_PLATFORM_SENSOR_PROVIDER_LINUX_H_ 120 #endif // DEVICE_GENERIC_SENSOR_PUBLIC_PLATFORM_SENSOR_PROVIDER_LINUX_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698