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

Unified Diff: content/renderer/device_sensors/device_sensor_event_pump.h

Issue 604483003: Increase device orientation event frequency to 60 Hz. Change constants (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sync 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
« no previous file with comments | « content/renderer/device_sensors/device_light_event_pump.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/device_sensors/device_sensor_event_pump.h
diff --git a/content/renderer/device_sensors/device_sensor_event_pump.h b/content/renderer/device_sensors/device_sensor_event_pump.h
index f36992871a3313eb8886676585a71af0c15ea77a..c77db34c42a15d2f0c8426a3979cf9e86d420d2e 100644
--- a/content/renderer/device_sensors/device_sensor_event_pump.h
+++ b/content/renderer/device_sensors/device_sensor_event_pump.h
@@ -6,6 +6,7 @@
#define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_SENSOR_EVENT_PUMP_H_
#include "base/memory/shared_memory.h"
+#include "base/time/time.h"
#include "base/timer/timer.h"
#include "content/public/renderer/platform_event_observer.h"
@@ -15,8 +16,10 @@ template <typename ListenerType>
class CONTENT_EXPORT DeviceSensorEventPump
: NON_EXPORTED_BASE(public PlatformEventObserver<ListenerType>) {
public:
- // Default delay between subsequent firing of events.
- static const int kDefaultPumpDelayMillis = 50;
+ // Default rate for firing events.
+ static const int kDefaultPumpFrequencyHz = 60;
+ static const int kDefaultPumpDelayMicroseconds =
+ base::Time::kMicrosecondsPerSecond / kDefaultPumpFrequencyHz;
// PlatformEventObserver
virtual void Start(blink::WebPlatformEventListener* listener) OVERRIDE {
@@ -49,9 +52,8 @@ class CONTENT_EXPORT DeviceSensorEventPump
protected:
explicit DeviceSensorEventPump(RenderThread* thread)
: PlatformEventObserver<ListenerType>(thread),
- pump_delay_millis_(kDefaultPumpDelayMillis),
- state_(STOPPED) {
- }
+ pump_delay_microseconds_(kDefaultPumpDelayMicroseconds),
+ state_(STOPPED) {}
virtual ~DeviceSensorEventPump() {
}
@@ -77,8 +79,9 @@ class CONTENT_EXPORT DeviceSensorEventPump
if (InitializeReader(handle)) {
timer_.Start(FROM_HERE,
- base::TimeDelta::FromMilliseconds(pump_delay_millis_),
- this, &DeviceSensorEventPump::FireEvent);
+ base::TimeDelta::FromMicroseconds(pump_delay_microseconds_),
+ this,
+ &DeviceSensorEventPump::FireEvent);
state_ = RUNNING;
}
}
@@ -86,7 +89,7 @@ class CONTENT_EXPORT DeviceSensorEventPump
virtual void FireEvent() = 0;
virtual bool InitializeReader(base::SharedMemoryHandle handle) = 0;
- int pump_delay_millis_;
+ int pump_delay_microseconds_;
PumpState state_;
base::RepeatingTimer<DeviceSensorEventPump> timer_;
« no previous file with comments | « content/renderer/device_sensors/device_light_event_pump.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698