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..3f607d2ff920bbad0aebe18b44670f7719698786 |
| --- /dev/null |
| +++ b/content/renderer/device_sensors/device_light_event_pump.h |
| @@ -0,0 +1,54 @@ |
| +// 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" |
| +#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: |
| + 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: |
| + // Methods overriden from base class DeviceSensorEventPump |
| + virtual void FireEvent() OVERRIDE; |
| + virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE; |
| + virtual bool SendStartMessage() OVERRIDE; |
| + virtual bool SendStopMessage() OVERRIDE; |
| + |
| + // Default delay between subsequent firing of DeviceLight events. |
| + static const int kDefaultLightPumpDelayMillis; |
|
jochen (gone - plz use gerrit)
2014/06/25 13:16:11
that value is not used anywhere outside of the .cc
riju_
2014/06/25 15:53:11
Done.
|
| + |
| + blink::WebDeviceLightListener* listener_; |
| + scoped_ptr<DeviceLightSharedMemoryReader> reader_; |
| + double last_seen_data_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(DeviceLightEventPump); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_LIGHT_EVENT_PUMP_H_ |