Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(997)

Unified Diff: content/renderer/device_sensors/device_light_event_pump.h

Issue 286793002: [DeviceLight] Add renderer+common parts (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: jochen's comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/device_sensors/device_light_event_pump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..a998adffb3232554c72e0beb05c15e4d02e69e51
--- /dev/null
+++ b/content/renderer/device_sensors/device_light_event_pump.h
@@ -0,0 +1,51 @@
+// 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;
+
+ 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_
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/device_sensors/device_light_event_pump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698