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

Unified Diff: third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h

Issue 2896583005: Reland: Refactor DeviceMotionEventPump to use //device/generic_sensor instead of //device/sensors (Closed)
Patch Set: updated test code 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: third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h
diff --git a/third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.h b/third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h
similarity index 50%
copy from third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.h
copy to third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h
index 97b0f61fae8dde69e4fe428c28d509cde0463be5..263d7bf05189828d368f1dd69586ed5ed4f9b87e 100644
--- a/third_party/WebKit/Source/modules/device_orientation/DeviceMotionDispatcher.h
+++ b/third_party/WebKit/public/platform/modules/device_orientation/WebDeviceMotionData.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2013 Google Inc. All rights reserved.
+ * Copyright (C) 2017 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -28,53 +28,63 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef DeviceMotionDispatcher_h
-#define DeviceMotionDispatcher_h
+#ifndef WebDeviceMotionData_h
+#define WebDeviceMotionData_h
-#include "core/frame/PlatformEventDispatcher.h"
-#include "platform/heap/Handle.h"
-#include "platform/wtf/RefPtr.h"
-#include "public/platform/modules/device_orientation/WebDeviceMotionListener.h"
-
-namespace device {
-class MotionData;
-}
+#include <string.h>
namespace blink {
-class DeviceMotionData;
-
-// This class listens to device motion data and notifies all registered
-// controllers.
-class DeviceMotionDispatcher final
- : public GarbageCollectedFinalized<DeviceMotionDispatcher>,
- public PlatformEventDispatcher,
- public WebDeviceMotionListener {
- USING_GARBAGE_COLLECTED_MIXIN(DeviceMotionDispatcher);
+#pragma pack(push, 1)
+class WebDeviceMotionData {
public:
- static DeviceMotionDispatcher& Instance();
- ~DeviceMotionDispatcher() override;
+ WebDeviceMotionData()
+ : has_acceleration_x(false),
+ has_acceleration_y(false),
+ has_acceleration_z(false),
+ has_acceleration_including_gravity_x(false),
+ has_acceleration_including_gravity_y(false),
+ has_acceleration_including_gravity_z(false),
+ has_rotation_rate_alpha(false),
+ has_rotation_rate_beta(false),
+ has_rotation_rate_gamma(false) {}
+ WebDeviceMotionData(const WebDeviceMotionData& other) = default;
+ ~WebDeviceMotionData() {}
+
+ double acceleration_x;
+ double acceleration_y;
+ double acceleration_z;
- // Note that the returned object is owned by this class.
- // FIXME: make the return value const, see crbug.com/233174.
- DeviceMotionData* LatestDeviceMotionData();
+ double acceleration_including_gravity_x;
+ double acceleration_including_gravity_y;
+ double acceleration_including_gravity_z;
- // Inherited from WebDeviceMotionListener.
- void DidChangeDeviceMotion(const device::MotionData&) override;
+ double rotation_rate_alpha;
+ double rotation_rate_beta;
+ double rotation_rate_gamma;
- DECLARE_VIRTUAL_TRACE();
+ double interval;
- private:
- DeviceMotionDispatcher();
+ bool has_acceleration_x : 1;
+ bool has_acceleration_y : 1;
+ bool has_acceleration_z : 1;
- // Inherited from PlatformEventDispatcher.
- void StartListening() override;
- void StopListening() override;
+ bool has_acceleration_including_gravity_x : 1;
+ bool has_acceleration_including_gravity_y : 1;
+ bool has_acceleration_including_gravity_z : 1;
- Member<DeviceMotionData> last_device_motion_data_;
+ bool has_rotation_rate_alpha : 1;
+ bool has_rotation_rate_beta : 1;
+ bool has_rotation_rate_gamma : 1;
};
+static_assert(sizeof(WebDeviceMotionData) ==
+ (10 * sizeof(double) + 2 * sizeof(char)),
+ "WebDeviceMotionData has wrong size");
Reilly Grant (use Gerrit) 2017/05/22 20:29:46 This struct isn't used in shared memory so packing
juncai 2017/05/23 02:30:24 Done.
+
+#pragma pack(pop)
+
} // namespace blink
-#endif // DeviceMotionDispatcher_h
+#endif // WebDeviceMotionData_h

Powered by Google App Engine
This is Rietveld 408576698