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

Unified Diff: content/renderer/device_orientation/device_motion_event_pump.h

Issue 20707002: Implement Device Orientation using shared memory in content/renderer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: excluded orientation pump tests on win bots Created 7 years, 4 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_orientation/device_motion_event_pump.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/device_orientation/device_motion_event_pump.h
diff --git a/content/renderer/device_orientation/device_motion_event_pump.h b/content/renderer/device_orientation/device_motion_event_pump.h
index f2c3474725a9ed89827791702242b49fef4c26f8..4fa453de819ab7fe24dcaadc333f0a0d416329fc 100644
--- a/content/renderer/device_orientation/device_motion_event_pump.h
+++ b/content/renderer/device_orientation/device_motion_event_pump.h
@@ -6,9 +6,7 @@
#define CONTENT_RENDERER_DEVICE_MOTION_EVENT_PUMP_H_
#include "base/memory/scoped_ptr.h"
-#include "base/memory/shared_memory.h"
-#include "base/timer/timer.h"
-#include "content/public/renderer/render_process_observer.h"
+#include "content/renderer/device_orientation/device_sensor_event_pump.h"
#include "content/renderer/shared_memory_seqlock_reader.h"
#include "third_party/WebKit/public/platform/WebDeviceMotionData.h"
@@ -17,54 +15,31 @@ class WebDeviceMotionListener;
}
namespace content {
-class RenderThread;
typedef SharedMemorySeqLockReader<WebKit::WebDeviceMotionData>
DeviceMotionSharedMemoryReader;
-class CONTENT_EXPORT DeviceMotionEventPump : public RenderProcessObserver {
+class CONTENT_EXPORT DeviceMotionEventPump : public DeviceSensorEventPump {
public:
DeviceMotionEventPump();
+ explicit DeviceMotionEventPump(int pump_delay_millis);
virtual ~DeviceMotionEventPump();
- static double GetDelayMillis();
-
// Sets the listener to receive updates for device motion data at
- // regular intervals.
- // Returns true if the registration was successful.
- bool SetListener(WebKit::WebDeviceMotionListener*);
-
- void SetDeviceMotionReader(scoped_ptr<DeviceMotionSharedMemoryReader>);
-
- void Attach(RenderThread* thread);
+ // regular intervals. Returns true if the registration was successful.
+ bool SetListener(WebKit::WebDeviceMotionListener* listener);
// RenderProcessObserver implementation.
virtual bool OnControlMessageReceived(const IPC::Message& message) OVERRIDE;
protected:
- // Delay between subsequent firing of events.
- static const double kPumpDelayMillis;
-
- // The pump is a tri-state automaton with allowed transitions as follows:
- // STOPPED -> PENDING_START
- // PENDING_START -> RUNNING
- // PENDING_START -> STOPPED
- // RUNNING -> STOPPED
- enum PumpState {
- STOPPED,
- RUNNING,
- PENDING_START
- };
-
- bool StartFetchingDeviceMotion();
- bool StopFetchingDeviceMotion();
- void OnDidStartDeviceMotion(base::SharedMemoryHandle renderer_handle);
- void FireEvent();
+ virtual void FireEvent() OVERRIDE;
+ virtual bool InitializeReader(base::SharedMemoryHandle handle) OVERRIDE;
+ virtual bool SendStartMessage() OVERRIDE;
+ virtual bool SendStopMessage() OVERRIDE;
WebKit::WebDeviceMotionListener* listener_;
scoped_ptr<DeviceMotionSharedMemoryReader> reader_;
- base::RepeatingTimer<DeviceMotionEventPump> timer_;
- PumpState state_;
};
} // namespace content
« no previous file with comments | « content/content_tests.gypi ('k') | content/renderer/device_orientation/device_motion_event_pump.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698