| Index: content/renderer/device_orientation/device_motion_event_pump.h
|
| diff --git a/content/renderer/device_orientation/device_motion_event_pump.h b/content/renderer/device_orientation/device_motion_event_pump.h
|
| index f2c3474725a9ed89827791702242b49fef4c26f8..4fa453de819ab7fe24dcaadc333f0a0d416329fc 100644
|
| --- a/content/renderer/device_orientation/device_motion_event_pump.h
|
| +++ b/content/renderer/device_orientation/device_motion_event_pump.h
|
| @@ -6,9 +6,7 @@
|
| #define CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_
|
|
|
| #include "base/memory/scoped_ptr.h"
|
| -#include "base/memory/shared_memory.h"
|
| -#include "base/timer/timer.h"
|
| -#include "content/public/renderer/render_process_observer.h"
|
| +#include "content/renderer/device_orientation/device_sensor_event_pump.h"
|
| #include "content/renderer/shared_memory_seqlock_reader.h"
|
| #include "third_party/WebKit/public/platform/WebDeviceMotionData.h"
|
|
|
| @@ -17,54 +15,31 @@ class WebDeviceMotionListener;
|
| }
|
|
|
| namespace content {
|
| -class RenderThread;
|
|
|
| typedef SharedMemorySeqLockReader<WebKit::WebDeviceMotionData>
|
| DeviceMotionSharedMemoryReader;
|
|
|
| -class CONTENT_EXPORT DeviceMotionEventPump : public RenderProcessObserver {
|
| +class CONTENT_EXPORT DeviceMotionEventPump : public DeviceSensorEventPump {
|
| public:
|
| DeviceMotionEventPump();
|
| + explicit DeviceMotionEventPump(int pump_delay_millis);
|
| virtual ~DeviceMotionEventPump();
|
|
|
| - static double GetDelayMillis();
|
| -
|
| // Sets the listener to receive updates for device motion data at
|
| - // regular intervals.
|
| - // Returns true if the registration was successful.
|
| - bool SetListener(WebKit::WebDeviceMotionListener*);
|
| -
|
| - void SetDeviceMotionReader(scoped_ptr<DeviceMotionSharedMemoryReader>);
|
| -
|
| - void Attach(RenderThread* thread);
|
| + // regular intervals. Returns true if the registration was successful.
|
| + bool SetListener(WebKit::WebDeviceMotionListener* listener);
|
|
|
| // RenderProcessObserver implementation.
|
| virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
|
|
|
| protected:
|
| - // Delay between subsequent firing of events.
|
| - static const double kPumpDelayMillis;
|
| -
|
| - // The pump is a tri-state automaton with allowed transitions as follows:
|
| - // STOPPED -> PENDING_START
|
| - // PENDING_START -> RUNNING
|
| - // PENDING_START -> STOPPED
|
| - // RUNNING -> STOPPED
|
| - enum PumpState {
|
| - STOPPED,
|
| - RUNNING,
|
| - PENDING_START
|
| - };
|
| -
|
| - bool StartFetchingDeviceMotion();
|
| - bool StopFetchingDeviceMotion();
|
| - void OnDidStartDeviceMotion(base::SharedMemoryHandle renderer_handle);
|
| - void FireEvent();
|
| + virtual void FireEvent() OVERRIDE;
|
| + virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE;
|
| + virtual bool SendStartMessage() OVERRIDE;
|
| + virtual bool SendStopMessage() OVERRIDE;
|
|
|
| WebKit::WebDeviceMotionListener* listener_;
|
| scoped_ptr<DeviceMotionSharedMemoryReader> reader_;
|
| - base::RepeatingTimer<DeviceMotionEventPump> timer_;
|
| - PumpState state_;
|
| };
|
|
|
| } // namespace content
|
|
|