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

Unified Diff: content/renderer/device_sensors/device_light_event_pump.cc

Issue 292693004: [DeviceLight] Browser+java part (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: change frequency in sensor_consts Created 6 years, 3 months 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: content/renderer/device_sensors/device_light_event_pump.cc
diff --git a/content/renderer/device_sensors/device_light_event_pump.cc b/content/renderer/device_sensors/device_light_event_pump.cc
index a20919d968d9f3637afe8fb3e1435255d98890ce..3d928de891ff9bdc53434394ebbaa564f7b53b8f 100644
--- a/content/renderer/device_sensors/device_light_event_pump.cc
+++ b/content/renderer/device_sensors/device_light_event_pump.cc
@@ -10,7 +10,7 @@
namespace {
// Default delay between subsequent firing of DeviceLight events.
-const int kDefaultLightPumpDelayMillis = 200;
+const int kDefaultLightPumpDelayMillis = 199;
timvolodine 2014/09/04 17:16:58 why not 200?
} // namespace
namespace content {
@@ -38,7 +38,10 @@ void DeviceLightEventPump::FireEvent() {
DCHECK(listener());
DeviceLightData data;
bool did_return_light_data = reader_->GetLatestData(&data);
- if (did_return_light_data && data.value != last_seen_data_) {
+ // It seems that we need to fire multiple times to blink to get 1 NULL
timvolodine 2014/09/04 17:16:58 remove comment
riju_ 2014/09/08 09:26:18 Done.
+ // event. +inf = no sensors
+ if ((did_return_light_data && data.value != last_seen_data_) ||
+ data.value == std::numeric_limits<double>::infinity()) {
timvolodine 2014/09/04 17:16:58 this does not look right. you could do reader_->Ge
timvolodine 2014/09/04 17:16:58 also I am not sure if negative values could be fir
riju_ 2014/09/08 09:26:18 Done.
last_seen_data_ = data.value;
listener()->didChangeDeviceLight(data.value);
}

Powered by Google App Engine
This is Rietveld 408576698