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

Unified Diff: third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.h
diff --git a/third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationListener.h b/third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.h
similarity index 62%
copy from third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationListener.h
copy to third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.h
index e0b0ac6f96a5f0e2e6b0f552d05e284c0945d0e4..aea1d63791221d19bd85b732e7067317ac0d7ab8 100644
--- a/third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationListener.h
+++ b/third_party/WebKit/public/platform/modules/device_orientation/WebDeviceOrientationData.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,25 +28,44 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebDeviceOrientationListener_h
-#define WebDeviceOrientationListener_h
+#ifndef WebDeviceOrientationData_h
+#define WebDeviceOrientationData_h
-#include "public/platform/WebPlatformEventListener.h"
-
-namespace device {
-class OrientationData;
-}
+#include <string.h>
namespace blink {
-class WebDeviceOrientationListener : public WebPlatformEventListener {
+#pragma pack(push, 1)
+
+class WebDeviceOrientationData {
public:
- // This method is called every time new device orientation data is available.
- virtual void DidChangeDeviceOrientation(const device::OrientationData&) = 0;
+ WebDeviceOrientationData() {
+ // Make sure to zero out the memory so that there are no uninitialized bits.
+ // This object is used in the shared memory buffer and is memory copied by
+ // two processes. Valgrind will complain if we copy around memory that is
+ // only partially initialized.
+ memset(this, 0, sizeof(*this));
+ }
+
+ ~WebDeviceOrientationData() {}
+
+ double alpha;
+ double beta;
+ double gamma;
- virtual ~WebDeviceOrientationListener() {}
+ bool has_alpha : 1;
+ bool has_beta : 1;
+ bool has_gamma : 1;
+
+ bool absolute : 1;
};
+static_assert(sizeof(WebDeviceOrientationData) ==
+ (3 * sizeof(double) + 1 * sizeof(char)),
+ "WebDeviceOrientationData has wrong size");
+
+#pragma pack(pop)
+
} // namespace blink
-#endif // WebDeviceOrientationListener_h
+#endif // WebDeviceOrientationData_h

Powered by Google App Engine
This is Rietveld 408576698