Chromium Code Reviews| Index: third_party/WebKit/Source/modules/sensor/AmbientLightSensor.cpp |
| diff --git a/third_party/WebKit/Source/modules/sensor/AmbientLightSensor.cpp b/third_party/WebKit/Source/modules/sensor/AmbientLightSensor.cpp |
| index d124044da0da34ae8f0c2c8eaf7bbddf38d6fb9a..bb43f119d2be3c6f86c5524ee62560e38c792035 100644 |
| --- a/third_party/WebKit/Source/modules/sensor/AmbientLightSensor.cpp |
| +++ b/third_party/WebKit/Source/modules/sensor/AmbientLightSensor.cpp |
| @@ -40,10 +40,16 @@ SensorReading* AmbientLightSensor::createSensorReading(SensorProxy* proxy) { |
| auto AmbientLightSensor::createSensorConfig( |
| const SensorOptions& options, |
| - const SensorConfiguration& defaultConfig) -> SensorConfigurationPtr { |
| + const SensorConfiguration& defaultConfig, |
| + double maxSupportedFrequency) -> SensorConfigurationPtr { |
| auto result = device::mojom::blink::SensorConfiguration::New(); |
| - result->frequency = |
| + double frequency = |
| options.hasFrequency() ? options.frequency() : defaultConfig.frequency; |
| + |
| + if (maxSupportedFrequency && frequency > maxSupportedFrequency) |
|
shalamov
2016/11/02 14:42:45
Can this be moved to Sensor or another place, so t
|
| + frequency = maxSupportedFrequency; |
| + |
| + result->frequency = frequency; |
| return result; |
| } |