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

Unified Diff: device/generic_sensor/platform_sensor_win.cc

Issue 2465363004: [Sensors] Consider maximum supported frequency (Closed)
Patch Set: Comments from Alex Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: device/generic_sensor/platform_sensor_win.cc
diff --git a/device/generic_sensor/platform_sensor_win.cc b/device/generic_sensor/platform_sensor_win.cc
index cb4cecff851822c760c6a7c2bd66b83e93e0d801..1638da94b9a2d05dc132288fa32507324f5ac797 100644
--- a/device/generic_sensor/platform_sensor_win.cc
+++ b/device/generic_sensor/platform_sensor_win.cc
@@ -32,6 +32,14 @@ mojom::ReportingMode PlatformSensorWin::GetReportingMode() {
return sensor_reader_->GetReportingMode();
}
+double PlatformSensorWin::GetMaximumSupportedFrequency() {
+ double minimal_reporting_interval_ms =
+ sensor_reader_->GetMinimalReportingIntervalMs();
+ if (!minimal_reporting_interval_ms)
+ return kDefaultSensorReportingFrequency;
+ return base::Time::kMillisecondsPerSecond / minimal_reporting_interval_ms;
+}
+
void PlatformSensorWin::OnReadingUpdated(const SensorReading& reading) {
UpdateSensorReading(reading,
GetReportingMode() == mojom::ReportingMode::ON_CHANGE);
@@ -61,9 +69,9 @@ bool PlatformSensorWin::CheckSensorConfiguration(
sensor_reader_->GetMinimalReportingIntervalMs();
if (minimal_reporting_interval_ms == 0)
return true;
- double min_frequency =
+ double max_frequency =
base::Time::kMillisecondsPerSecond / minimal_reporting_interval_ms;
- return configuration.frequency() <= min_frequency;
+ return configuration.frequency() <= max_frequency;
}
PlatformSensorWin::~PlatformSensorWin() {

Powered by Google App Engine
This is Rietveld 408576698