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 #include "device/generic_sensor/platform_sensor_provider_linux.h" | 5 #include "device/generic_sensor/platform_sensor_provider_linux.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "base/threading/thread.h" | 8 #include "base/threading/thread.h" |
9 #include "device/generic_sensor/linux/sensor_data_linux.h" | 9 #include "device/generic_sensor/linux/sensor_data_linux.h" |
10 #include "device/generic_sensor/platform_sensor_linux.h" | 10 #include "device/generic_sensor/platform_sensor_linux.h" |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 return; | 195 return; |
196 } | 196 } |
197 sensor_devices_by_type_[type] = std::move(sensor_device); | 197 sensor_devices_by_type_[type] = std::move(sensor_device); |
198 } | 198 } |
199 | 199 |
200 void PlatformSensorProviderLinux::OnDeviceRemoved( | 200 void PlatformSensorProviderLinux::OnDeviceRemoved( |
201 mojom::SensorType type, | 201 mojom::SensorType type, |
202 const std::string& device_node) { | 202 const std::string& device_node) { |
203 DCHECK(CalledOnValidThread()); | 203 DCHECK(CalledOnValidThread()); |
204 auto it = sensor_devices_by_type_.find(type); | 204 auto it = sensor_devices_by_type_.find(type); |
205 if (it == sensor_devices_by_type_.end() && | 205 if (it != sensor_devices_by_type_.end() && |
206 it->second->device_node == device_node) | 206 it->second->device_node == device_node) |
207 sensor_devices_by_type_.erase(it); | 207 sensor_devices_by_type_.erase(it); |
208 } | 208 } |
209 | 209 |
210 } // namespace device | 210 } // namespace device |
OLD | NEW |