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

Unified Diff: content/browser/device_sensors/sensor_manager_chromeos.h

Issue 934843002: Implement DeviceMotionEvent API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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/browser/device_sensors/sensor_manager_chromeos.h
diff --git a/content/browser/device_sensors/sensor_manager_chromeos.h b/content/browser/device_sensors/sensor_manager_chromeos.h
index faeabeb7e69c4f2b7039a667bac9c8f01d92268d..4f8b2a0acb539577dbf208dced7db8cc598491f3 100644
--- a/content/browser/device_sensors/sensor_manager_chromeos.h
+++ b/content/browser/device_sensors/sensor_manager_chromeos.h
@@ -6,10 +6,10 @@
#define CONTENT_BROWSER_DEVICE_SENSORS_SENSOR_MANAGER_CHROMEOS_H_
#include "base/macros.h"
-#include "base/synchronization/lock.h"
#include "chromeos/accelerometer/accelerometer_reader.h"
#include "chromeos/accelerometer/accelerometer_types.h"
#include "content/common/content_export.h"
+#include "content/common/device_sensors/device_motion_hardware_buffer.h"
#include "content/common/device_sensors/device_orientation_hardware_buffer.h"
namespace content {
@@ -22,6 +22,14 @@ class CONTENT_EXPORT SensorManagerChromeOS
SensorManagerChromeOS();
~SensorManagerChromeOS() override;
+ // Begins monitoring of motion events, the shared memory of |buffer| will be
+ // updated upon subsequent events.
+ bool StartFetchingDeviceMotionData(DeviceMotionHardwareBuffer* buffer);
+
+ // Stops monitoring motion events. Returns true if there is an active
+ // |motion_buffer_| and fetching stops. Otherwise returns false.
+ bool StopFetchingDeviceMotionData();
+
// Begins monitoring of orientation events, the shared memory of |buffer| will
// be updated upon subsequent events.
bool StartFetchingDeviceOrientationData(
@@ -33,7 +41,7 @@ class CONTENT_EXPORT SensorManagerChromeOS
// chromeos::AccelerometerReader::Observer:
void OnAccelerometerUpdated(
- const chromeos::AccelerometerUpdate& update) override;
+ scoped_refptr<const chromeos::AccelerometerUpdate> update) override;
protected:
// Begins/ends the observation of accelerometer events.
@@ -41,12 +49,14 @@ class CONTENT_EXPORT SensorManagerChromeOS
virtual void StopObservingAccelerometer();
private:
+ // Updates |motion_buffer_| or |orientation_buffer_| accordingly.
+ void GenerateMotionEvent(double x, double y, double z);
+ void GenerateOrientationEvent(double x, double y, double z);
+
// Shared memory to update.
+ DeviceMotionHardwareBuffer* motion_buffer_;
DeviceOrientationHardwareBuffer* orientation_buffer_;
- // Synchronize orientation_buffer_ across threads.
- base::Lock orientation_buffer_lock_;
-
DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOS);
};

Powered by Google App Engine
This is Rietveld 408576698