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

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..085c71360bc46fadbf5d20b38718b2f68fe6588e 100644
--- a/content/browser/device_sensors/sensor_manager_chromeos.h
+++ b/content/browser/device_sensors/sensor_manager_chromeos.h
@@ -10,7 +10,9 @@
#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"
+#include "ui/gfx/geometry/vector3d_f.h"
namespace content {
@@ -22,6 +24,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(
@@ -41,12 +51,21 @@ class CONTENT_EXPORT SensorManagerChromeOS
virtual void StopObservingAccelerometer();
private:
+ // Process accelerometer data and update according buffers.
flackr 2015/02/18 22:34:09 Comment is a bit confusing, Perhaps "Updates |moti
jonross 2015/02/25 00:09:56 Done.
+ 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.
flackr 2015/02/18 22:34:09 nit: Two comments or convert into a single comment
jonross 2015/02/25 00:09:56 StartFetchingDeviceMotionData is called from the I
+ base::Lock motion_buffer_lock_;
base::Lock orientation_buffer_lock_;
+ // The current component of accelerometer data associated to gravity.
+ gfx::Vector3dF gravity_;
+
DISALLOW_COPY_AND_ASSIGN(SensorManagerChromeOS);
};

Powered by Google App Engine
This is Rietveld 408576698