Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / renderer / device_sensors / device_light_event_pump.h
blob13b22b1b37e760970d36de86f81a7b9ff28b114e
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_LIGHT_EVENT_PUMP_H_
6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "content/common/device_sensors/device_light_data.h"
10 #include "content/renderer/device_sensors/device_sensor_event_pump.h"
11 #include "content/renderer/shared_memory_seqlock_reader.h"
13 namespace blink {
14 class WebDeviceLightListener;
17 namespace content {
19 typedef SharedMemorySeqLockReader<DeviceLightData>
20 DeviceLightSharedMemoryReader;
22 class CONTENT_EXPORT DeviceLightEventPump
23 : public DeviceSensorEventPump<blink::WebDeviceLightListener> {
24 public:
25 explicit DeviceLightEventPump(RenderThread* thread);
26 virtual ~DeviceLightEventPump();
28 // Sets the listener to receive updates for device light data at
29 // regular intervals. Returns true if the registration was successful.
30 bool SetListener(blink::WebDeviceLightListener* listener);
32 // PlatformEventObserver implementation.
33 virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
34 virtual void SendFakeDataForTesting(void* data) OVERRIDE;
36 protected:
37 // Methods overriden from base class DeviceSensorEventPump
38 virtual void FireEvent() OVERRIDE;
39 virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE;
41 // PlatformEventObserver implementation.
42 virtual void SendStartMessage() OVERRIDE;
43 virtual void SendStopMessage() OVERRIDE;
45 scoped_ptr<DeviceLightSharedMemoryReader> reader_;
46 double last_seen_data_;
48 DISALLOW_COPY_AND_ASSIGN(DeviceLightEventPump);
51 } // namespace content
53 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_