Rename Animate as Begin(Main)Frame
[chromium-blink-merge.git] / content / renderer / device_sensors / device_motion_event_pump.h
blobc02f814142bc2e13cfa94cc7a75a841c0fd1d1e6
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_
6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/renderer/device_sensors/device_sensor_event_pump.h"
10 #include "content/renderer/shared_memory_seqlock_reader.h"
11 #include "third_party/WebKit/public/platform/WebDeviceMotionData.h"
13 namespace blink {
14 class WebDeviceMotionListener;
17 namespace content {
19 typedef SharedMemorySeqLockReader<blink::WebDeviceMotionData>
20 DeviceMotionSharedMemoryReader;
22 class CONTENT_EXPORT DeviceMotionEventPump : public DeviceSensorEventPump {
23 public:
24 DeviceMotionEventPump();
25 explicit DeviceMotionEventPump(int pump_delay_millis);
26 virtual ~DeviceMotionEventPump();
28 // Sets the listener to receive updates for device motion data at
29 // regular intervals. Returns true if the registration was successful.
30 bool SetListener(blink::WebDeviceMotionListener* listener);
32 // RenderProcessObserver implementation.
33 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
35 protected:
36 virtual void FireEvent() OVERRIDE;
37 virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE;
38 virtual bool SendStartMessage() OVERRIDE;
39 virtual bool SendStopMessage() OVERRIDE;
41 blink::WebDeviceMotionListener* listener_;
42 scoped_ptr<DeviceMotionSharedMemoryReader> reader_;
45 } // namespace content
47 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_