[Chromium] pack Gamepad shared memory structure
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2012 19:08:24 +0000 (19:08 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Feb 2012 19:08:24 +0000 (19:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=78022

Patch by Scott Graham <scottmg@chromium.org> on 2012-02-17
Reviewed by Darin Fisher.

Add #pragma pack around definition of shared memory structures to
avoid differences across compilers and platforms. Add COMPILE_ASSERT
to verify expected size.

* public/platform/WebGamepad.h:
(WebKit):
* public/platform/WebGamepads.h:
(WebKit):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108099 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/chromium/ChangeLog
Source/WebKit/chromium/public/platform/WebGamepad.h
Source/WebKit/chromium/public/platform/WebGamepads.h

index 347b601..c7d2a54 100644 (file)
@@ -1,3 +1,19 @@
+2012-02-17  Scott Graham  <scottmg@chromium.org>
+
+        [Chromium] pack Gamepad shared memory structure
+        https://bugs.webkit.org/show_bug.cgi?id=78022
+
+        Reviewed by Darin Fisher.
+
+        Add #pragma pack around definition of shared memory structures to
+        avoid differences across compilers and platforms. Add COMPILE_ASSERT
+        to verify expected size.
+
+        * public/platform/WebGamepad.h:
+        (WebKit):
+        * public/platform/WebGamepads.h:
+        (WebKit):
+
 2012-02-17  Tim Dresser  <tdresser@chromium.org>
 
         [chromium] Refactor video drawing to be more data driven
index 71d37b3..788e78b 100644 (file)
 
 #include "WebCommon.h"
 
+#if WEBKIT_IMPLEMENTATION
+#include <wtf/Assertions.h>
+#endif
+
 namespace WebKit {
 
+#pragma pack(push, 1)
+
 // This structure is intentionally POD and fixed size so that it can be shared
 // memory between hardware polling threads and the rest of the browser. See
 // also WebGamepads.h.
@@ -69,6 +75,12 @@ public:
     float buttons[buttonsLengthCap];
 };
 
+#if WEBKIT_IMPLEMENTATION
+COMPILE_ASSERT(sizeof(WebGamepad) == 465, WebGamepad_has_wrong_size);
+#endif
+
+#pragma pack(pop)
+
 }
 
 #endif // WebGamepad_h
index b1cc18e..50e2ab2 100644 (file)
 
 #include "WebGamepad.h"
 
+#if WEBKIT_IMPLEMENTATION
+#include <wtf/Assertions.h>
+#endif
+
 namespace WebKit {
 
+#pragma pack(push, 1)
+
 // This structure is intentionally POD and fixed size so that it can be stored
 // in shared memory between hardware polling threads and the rest of the
 // browser.
@@ -45,6 +51,12 @@ public:
     WebGamepad items[itemsLengthCap];
 };
 
+#if WEBKIT_IMPLEMENTATION
+COMPILE_ASSERT(sizeof(WebGamepads) == 1864, WebGamepads_has_wrong_size);
+#endif
+
+#pragma pack(pop)
+
 }
 
 #endif // WebGamepads_h