| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_ | 5 #ifndef CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_ |
| 6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_ | 6 #define CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "content/renderer/device_sensors/device_sensor_event_pump.h" | 11 #include "content/renderer/device_sensors/device_sensor_event_pump.h" |
| 12 #include "content/renderer/shared_memory_seqlock_reader.h" | 12 #include "content/renderer/shared_memory_seqlock_reader.h" |
| 13 #include "device/sensors/public/interfaces/motion.mojom.h" |
| 13 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionData.h" | 14 #include "third_party/WebKit/public/platform/modules/device_orientation/WebDevic
eMotionData.h" |
| 14 | 15 |
| 15 namespace blink { | 16 namespace blink { |
| 16 class WebDeviceMotionListener; | 17 class WebDeviceMotionListener; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 typedef SharedMemorySeqLockReader<blink::WebDeviceMotionData> | 22 typedef SharedMemorySeqLockReader<blink::WebDeviceMotionData> |
| 22 DeviceMotionSharedMemoryReader; | 23 DeviceMotionSharedMemoryReader; |
| 23 | 24 |
| 24 class CONTENT_EXPORT DeviceMotionEventPump | 25 class CONTENT_EXPORT DeviceMotionEventPump |
| 25 : public DeviceSensorEventPump<blink::WebDeviceMotionListener> { | 26 : public DeviceSensorMojoClientMixin< |
| 27 DeviceSensorEventPump<blink::WebDeviceMotionListener>, |
| 28 device::mojom::MotionSensor> { |
| 26 public: | 29 public: |
| 27 explicit DeviceMotionEventPump(RenderThread* thread); | 30 explicit DeviceMotionEventPump(RenderThread* thread); |
| 28 ~DeviceMotionEventPump() override; | 31 ~DeviceMotionEventPump() override; |
| 29 | 32 |
| 30 // // PlatformEventObserver. | 33 // PlatformEventObserver. |
| 31 bool OnControlMessageReceived(const IPC::Message& message) override; | |
| 32 void SendFakeDataForTesting(void* fake_data) override; | 34 void SendFakeDataForTesting(void* fake_data) override; |
| 33 | 35 |
| 34 protected: | 36 protected: |
| 35 void FireEvent() override; | 37 void FireEvent() override; |
| 36 bool InitializeReader(base::SharedMemoryHandle handle) override; | 38 bool InitializeReader(base::SharedMemoryHandle handle) override; |
| 37 | 39 |
| 38 // PlatformEventObserver. | |
| 39 void SendStartMessage() override; | |
| 40 void SendStopMessage() override; | |
| 41 | |
| 42 std::unique_ptr<DeviceMotionSharedMemoryReader> reader_; | 40 std::unique_ptr<DeviceMotionSharedMemoryReader> reader_; |
| 43 | 41 |
| 44 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPump); | 42 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPump); |
| 45 }; | 43 }; |
| 46 | 44 |
| 47 } // namespace content | 45 } // namespace content |
| 48 | 46 |
| 49 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_ | 47 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_ |
| OLD | NEW |