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

Side by Side Diff: content/renderer/device_sensors/device_motion_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 unified diff | Download patch
OLDNEW
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>
9
10 #include "base/macros.h" 8 #include "base/macros.h"
11 #include "content/renderer/device_sensors/device_sensor_event_pump.h" 9 #include "content/renderer/device_sensors/device_sensor_event_pump.h"
12 #include "content/renderer/shared_memory_seqlock_reader.h"
13 #include "device/sensors/public/cpp/motion_data.h"
14 #include "device/sensors/public/interfaces/motion.mojom.h"
15 10
16 namespace blink { 11 namespace blink {
12 class WebDeviceMotionData;
17 class WebDeviceMotionListener; 13 class WebDeviceMotionListener;
18 } 14 }
19 15
20 namespace content { 16 namespace content {
21 17
22 typedef SharedMemorySeqLockReader<device::MotionData>
23 DeviceMotionSharedMemoryReader;
24
25 class CONTENT_EXPORT DeviceMotionEventPump 18 class CONTENT_EXPORT DeviceMotionEventPump
26 : public DeviceSensorMojoClientMixin< 19 : public DeviceSensorEventPump<blink::WebDeviceMotionListener> {
27 DeviceSensorEventPump<blink::WebDeviceMotionListener>,
28 device::mojom::MotionSensor> {
29 public: 20 public:
30 explicit DeviceMotionEventPump(RenderThread* thread); 21 explicit DeviceMotionEventPump(RenderThread* thread);
31 ~DeviceMotionEventPump() override; 22 ~DeviceMotionEventPump() override;
32 23
33 // PlatformEventObserver. 24 // PlatformEventObserver:
25 void SendStartMessage() override;
34 void SendFakeDataForTesting(void* fake_data) override; 26 void SendFakeDataForTesting(void* fake_data) override;
35 27
36 protected: 28 protected:
29 // DeviceSensorEventPump:
37 void FireEvent() override; 30 void FireEvent() override;
38 bool InitializeReader(base::SharedMemoryHandle handle) override;
39 31
40 std::unique_ptr<DeviceMotionSharedMemoryReader> reader_; 32 private:
33 // DeviceSensorEventPump:
34 bool CanStart() const override;
35
36 bool AllAvailableSensorsAreActive() const;
37 bool GetDataFromSharedMemory(blink::WebDeviceMotionData* data);
41 38
42 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPump); 39 DISALLOW_COPY_AND_ASSIGN(DeviceMotionEventPump);
43 }; 40 };
44 41
45 } // namespace content 42 } // namespace content
46 43
47 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_ 44 #endif // CONTENT_RENDERER_DEVICE_SENSORS_DEVICE_MOTION_EVENT_PUMP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698