summaryrefslogtreecommitdiffstats
path: root/ppapi/c/pp_input_event.h
diff options
context:
space:
mode:
authordmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 21:45:10 +0000
committerdmichael@google.com <dmichael@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-12 21:45:10 +0000
commit41ec328301235a14486cf928ca119b73211319ad (patch)
tree3e4565493f7a621e08be9872a4a88bc8721a86c4 /ppapi/c/pp_input_event.h
parent4203e6ba7883f062b505b04fbb61c8b15bba3a5d (diff)
downloadchromium_src-41ec328301235a14486cf928ca119b73211319ad.zip
chromium_src-41ec328301235a14486cf928ca119b73211319ad.tar.gz
chromium_src-41ec328301235a14486cf928ca119b73211319ad.tar.bz2
Force 8-byte alignment in PP_InputEvent. Rev PPP_Instance interface to 0.3 because this changes the size of PP_InputEvent on Linux x86-32. Add an assertion for the size of PP_InputEvent.
Note I had to tweak the macro to allow for a typename of "struct PP_InputEvent", because I was relying on having no spaces in the typename. Now there's a separate macro for structs. Other options would include: - adding a typedef, e.g. PP_InputEvent_t, and using that in the original macro (this was my initial approach, but I decided I'd rather make a new macro than obfuscate the PP_InputEvent declaration) - Make PP_InputEvent itself a typedef, i.e. typedef struct {...} PP_InputEvent. This would make it impossible to forward-declare PP_InputEvent, and would require code changes elsewhere. - Change the macro some other way so that we don't need 2 macros (e.g., don't use the passed typename when creating a unique name). Use another trick like using the line number. This also has the drawback of making the error message less helpful. BUG=62983 TEST=NaCl tests/ppapi_proxy/event_example (see http://codereview.chromium.org/3767003/show) Review URL: http://codereview.chromium.org/4861002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66000 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/pp_input_event.h')
-rw-r--r--ppapi/c/pp_input_event.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/ppapi/c/pp_input_event.h b/ppapi/c/pp_input_event.h
index 715c016..7f95e09 100644
--- a/ppapi/c/pp_input_event.h
+++ b/ppapi/c/pp_input_event.h
@@ -14,6 +14,7 @@
*/
#include "ppapi/c/pp_bool.h"
+#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_stdint.h"
#include "ppapi/c/pp_time.h"
@@ -149,6 +150,10 @@ struct PP_InputEvent_Wheel {
PP_Bool scroll_by_page;
};
+/* Ensure the elements of the struct (especially the time_stamp) are aligned on
+ 8-byte boundaries, since some compilers align doubles on 8-byte boundaries
+ for 32-bit x86, and some align on 4-byte boundaries. */
+#pragma pack(push, 8)
struct PP_InputEvent {
/** Identifies the type of the event. */
PP_InputEvent_Type type;
@@ -173,6 +178,10 @@ struct PP_InputEvent {
char padding[64];
} u;
};
+#pragma pack(pop)
+/* TODO(dmichael): Figure out why the input event is not 80 bytes wide on Mac.
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_InputEvent, 80);
+ */
/**
* @}