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

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

Issue 2885203004: Refactor content/renderer/device_sensors to use device/generic_sensor instead of device/sensors (Closed)
Patch Set: updated content/renderer/BUILD.gn Created 3 years, 7 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
Index: content/renderer/device_sensors/device_orientation_event_pump.h
diff --git a/content/renderer/device_sensors/device_orientation_event_pump.h b/content/renderer/device_sensors/device_orientation_event_pump.h
index 8c3ef14935b6511270d8da5faae93c9a974e2da9..9e724c6fba2bf76d50a73d1b4fa786274009a325 100644
--- a/content/renderer/device_sensors/device_orientation_event_pump.h
+++ b/content/renderer/device_sensors/device_orientation_event_pump.h
@@ -5,13 +5,9 @@
#ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_EVENT_PUMP_H_
#define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_ORIENTATION_EVENT_PUMP_H_
-#include <memory>
-
#include "base/macros.h"
#include "content/renderer/device_sensors/device_sensor_event_pump.h"
-#include "content/renderer/shared_memory_seqlock_reader.h"
-#include "device/sensors/public/cpp/orientation_data.h"
-#include "device/sensors/public/interfaces/orientation.mojom.h"
+#include "third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.h"
namespace blink {
class WebDeviceOrientationListener;
@@ -19,41 +15,30 @@ class WebDeviceOrientationListener;
namespace content {
-typedef SharedMemorySeqLockReader<device::OrientationData>
- DeviceOrientationSharedMemoryReader;
-
-class CONTENT_EXPORT DeviceOrientationEventPumpBase
+class CONTENT_EXPORT DeviceOrientationEventPump
: public DeviceSensorEventPump<blink::WebDeviceOrientationListener> {
public:
- // Angle threshold beyond which two orientation events are considered
- // sufficiently different.
- static const double kOrientationThreshold;
-
- explicit DeviceOrientationEventPumpBase(RenderThread* thread);
- ~DeviceOrientationEventPumpBase() override;
+ explicit DeviceOrientationEventPump(RenderThread* thread);
+ ~DeviceOrientationEventPump() override;
- // PlatformEventObserver.
- void SendFakeDataForTesting(void* data) override;
+ // PlatformEventObserver:
+ void SendStartMessage() override;
+ void SendFakeDataForTesting(void* fake_data) override;
protected:
+ // DeviceSensorEventPump:
void FireEvent() override;
- bool InitializeReader(base::SharedMemoryHandle handle) override;
- bool ShouldFireEvent(const device::OrientationData& data) const;
+ virtual bool GetDataFromSharedMemory(blink::WebDeviceOrientationData* data);
- device::OrientationData data_;
- std::unique_ptr<DeviceOrientationSharedMemoryReader> reader_;
+ private:
+ // DeviceSensorEventPump:
+ bool CanStart() const override;
- DISALLOW_COPY_AND_ASSIGN(DeviceOrientationEventPumpBase);
-};
-
-using DeviceOrientationEventPump =
- DeviceSensorMojoClientMixin<DeviceOrientationEventPumpBase,
- device::mojom::OrientationSensor>;
+ blink::WebDeviceOrientationData data_;
-using DeviceOrientationAbsoluteEventPump =
- DeviceSensorMojoClientMixin<DeviceOrientationEventPumpBase,
- device::mojom::OrientationAbsoluteSensor>;
+ DISALLOW_COPY_AND_ASSIGN(DeviceOrientationEventPump);
+};
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698