Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / renderer / device_sensors / device_motion_event_pump.h
blob61b046d2f6d0c01196f8aa0188433ce783a922f9
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/modules/device_orientation/WebDeviceMotionData.h"
13 namespace blink {
14 class WebDeviceMotionListener;
17 namespace content {
19 typedef SharedMemorySeqLockReader<blink::WebDeviceMotionData>
20 DeviceMotionSharedMemoryReader;
22 class CONTENT_EXPORT DeviceMotionEventPump
23 : public DeviceSensorEventPump<blink::WebDeviceMotionListener> {
24 public:
25 explicit DeviceMotionEventPump(RenderThread* thread);
26 ~DeviceMotionEventPump() override;
28 // // PlatformEventObserver.
29 bool OnControlMessageReceived(const IPC::Message& message) override;
30 void SendFakeDataForTesting(void* fake_data) override;
32 protected:
33 void FireEvent() override;
34 bool InitializeReader(base::SharedMemoryHandle handle) override;
36 // PlatformEventObserver.
37 void SendStartMessage() override;
38 void SendStopMessage() override;
40 scoped_ptr<DeviceMotionSharedMemoryReader> reader_;
42 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPump);
45 } // namespace content
47 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_