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/sensor_provider_impl.h" | 5 #include "device/generic_sensor/sensor_provider_impl.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/sensor_impl.h" | 10 #include "device/generic_sensor/sensor_impl.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 } | 82 } |
83 | 83 |
84 auto sensor_impl = base::MakeUnique<SensorImpl>(sensor); | 84 auto sensor_impl = base::MakeUnique<SensorImpl>(sensor); |
85 | 85 |
86 auto init_params = mojom::SensorInitParams::New(); | 86 auto init_params = mojom::SensorInitParams::New(); |
87 init_params->memory = std::move(cloned_handle); | 87 init_params->memory = std::move(cloned_handle); |
88 init_params->buffer_offset = SensorReadingSharedBuffer::GetOffset(type); | 88 init_params->buffer_offset = SensorReadingSharedBuffer::GetOffset(type); |
89 init_params->mode = sensor->GetReportingMode(); | 89 init_params->mode = sensor->GetReportingMode(); |
90 init_params->default_configuration = sensor->GetDefaultConfiguration(); | 90 init_params->default_configuration = sensor->GetDefaultConfiguration(); |
91 | 91 |
92 double maximum_frequency = sensor->GetMaximumSupportedFrequency(); | |
93 DCHECK(maximum_frequency); | |
timvolodine
2016/11/03 17:32:56
>=0?
Mikhail
2016/11/04 21:17:44
The implementation must return a positive value fo
timvolodine
2016/11/09 20:31:52
nit: it could be negative and pass DCHECK?
| |
94 if (maximum_frequency > mojom::SensorConfiguration::kMaxAllowedFrequency) | |
95 maximum_frequency = mojom::SensorConfiguration::kMaxAllowedFrequency; | |
96 | |
97 init_params->maximum_frequency = maximum_frequency; | |
98 | |
92 NotifySensorCreated(std::move(init_params), sensor_impl->GetClient(), | 99 NotifySensorCreated(std::move(init_params), sensor_impl->GetClient(), |
93 callback); | 100 callback); |
94 | 101 |
95 mojo::MakeStrongBinding(std::move(sensor_impl), std::move(sensor_request)); | 102 mojo::MakeStrongBinding(std::move(sensor_impl), std::move(sensor_request)); |
96 } | 103 } |
97 | 104 |
98 } // namespace device | 105 } // namespace device |
OLD | NEW |