Chromium Code Reviews| Index: content/renderer/device_sensors/device_light_event_pump.h |
| diff --git a/content/renderer/device_sensors/device_light_event_pump.h b/content/renderer/device_sensors/device_light_event_pump.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..40e7bd609e49b22cbf2836a4eb839502f2df2bd0 |
| --- /dev/null |
| +++ b/content/renderer/device_sensors/device_light_event_pump.h |
| @@ -0,0 +1,50 @@ |
| +// Copyright 2014 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_ |
| +#define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_ |
| + |
| +#include "base/memory/scoped_ptr.h" |
| +#include "content/common/device_sensors/device_light_data.h" |
|
timvolodine
2014/06/03 16:08:12
is this include needed? is it possible to forward
riju_
2014/06/05 19:50:00
Forward declaring worked on Linux/Mac. Try Bots co
|
| +#include "content/renderer/device_sensors/device_sensor_event_pump.h" |
| +#include "content/renderer/shared_memory_seqlock_reader.h" |
| + |
| +namespace blink { |
| +class WebDeviceLightListener; |
| +} |
| + |
| +namespace content { |
| + |
| +typedef SharedMemorySeqLockReader<DeviceLightData> |
| + DeviceLightSharedMemoryReader; |
| + |
| +class CONTENT_EXPORT DeviceLightEventPump : public DeviceSensorEventPump { |
| + public: |
| + // Default delay between subsequent firing of DeviceLight events. |
| + static const int kDefaultLightPumpDelayMillis; |
| + |
| + DeviceLightEventPump(); |
| + explicit DeviceLightEventPump(int pump_delay_millis); |
| + virtual ~DeviceLightEventPump(); |
| + |
| + // Sets the listener to receive updates for device light data at |
| + // regular intervals. Returns true if the registration was successful. |
| + bool SetListener(blink::WebDeviceLightListener* listener); |
| + |
| + // RenderProcessObserver implementation. |
| + virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE; |
| + |
| + protected: |
| + virtual void FireEvent() OVERRIDE; |
| + virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE; |
| + virtual bool SendStartMessage() OVERRIDE; |
| + virtual bool SendStopMessage() OVERRIDE; |
| + |
| + blink::WebDeviceLightListener* listener_; |
| + scoped_ptr<DeviceLightSharedMemoryReader> reader_; |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_ |