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.h" | 5 #include "device/generic_sensor/platform_sensor.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "device/generic_sensor/platform_sensor_provider.h" | 9 #include "device/generic_sensor/platform_sensor_provider.h" |
10 #include "device/generic_sensor/public/cpp/platform_sensor_configuration.h" | 10 #include "device/generic_sensor/public/cpp/platform_sensor_configuration.h" |
11 | 11 |
12 namespace device { | 12 namespace device { |
13 | 13 |
14 PlatformSensor::PlatformSensor(mojom::SensorType type, | 14 PlatformSensor::PlatformSensor(mojom::SensorType type, |
15 mojo::ScopedSharedBufferMapping mapping, | 15 mojo::ScopedSharedBufferMapping mapping, |
16 PlatformSensorProvider* provider) | 16 PlatformSensorProvider* provider) |
17 : shared_buffer_mapping_(std::move(mapping)), | 17 : shared_buffer_mapping_(std::move(mapping)), |
| 18 provider_(provider), |
18 type_(type), | 19 type_(type), |
19 provider_(provider), | |
20 weak_factory_(this) {} | 20 weak_factory_(this) {} |
21 | 21 |
22 PlatformSensor::~PlatformSensor() { | 22 PlatformSensor::~PlatformSensor() { |
23 provider_->RemoveSensor(GetType()); | 23 provider_->RemoveSensor(GetType()); |
24 } | 24 } |
25 | 25 |
26 mojom::SensorType PlatformSensor::GetType() const { | 26 mojom::SensorType PlatformSensor::GetType() const { |
27 return type_; | 27 return type_; |
28 } | 28 } |
29 | 29 |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 if (!client->IsNotificationSuspended()) | 88 if (!client->IsNotificationSuspended()) |
89 client->OnSensorReadingChanged(); | 89 client->OnSensorReadingChanged(); |
90 } | 90 } |
91 } | 91 } |
92 | 92 |
93 void PlatformSensor::NotifySensorError() { | 93 void PlatformSensor::NotifySensorError() { |
94 FOR_EACH_OBSERVER(Client, clients_, OnSensorError()); | 94 FOR_EACH_OBSERVER(Client, clients_, OnSensorError()); |
95 } | 95 } |
96 | 96 |
97 } // namespace device | 97 } // namespace device |
OLD | NEW |