Add compile assertions to enforce the sizes of all structs and enums in the C API.  Adjust some structs to make their sizes consistent across architectures.  Note that some structs contain pointers, so are difficult to make consistent between 32-bit and 64-bit.  Those types are in test_struct_sizes.c.  Other types have a compile assertion immediately after their definition.

This was broken off from a bigger CL:
http://codereview.chromium.org/5340003/

BUG=61004,92983
TEST=test_struct_sizes.c, compile assertions throughout

See this CL for the code that helped generate the static assertions and find affected interfaces:
http://codereview.chromium.org/5730003
Review URL: http://codereview.chromium.org/5674004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69038 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/ppapi/c/pp_var.h b/ppapi/c/pp_var.h
index fad5db4d..1695293 100644
--- a/ppapi/c/pp_var.h
+++ b/ppapi/c/pp_var.h
@@ -26,7 +26,6 @@
   PP_VARTYPE_STRING,
   PP_VARTYPE_OBJECT
 } PP_VarType;
-
 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4);
 
 /**
@@ -43,6 +42,13 @@
  */
 struct PP_Var {
   PP_VarType type;
+
+  /** Ensures @a value is aligned on an 8-byte boundary relative to the
+   *  start of the struct. Some compilers align doubles on 8-byte boundaries
+   *  for 32-bit x86, and some align on 4-byte boundaries.
+   */
+  int32_t padding;
+
   union {
     PP_Bool as_bool;
     int32_t as_int;
@@ -56,31 +62,32 @@
     int64_t as_id;
   } value;
 };
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Var, 16);
 
 PP_INLINE struct PP_Var PP_MakeUndefined() {
-  struct PP_Var result = { PP_VARTYPE_UNDEFINED, {PP_FALSE} };
+  struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} };
   return result;
 }
 
 PP_INLINE struct PP_Var PP_MakeNull() {
-  struct PP_Var result = { PP_VARTYPE_NULL, {PP_FALSE} };
+  struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} };
   return result;
 }
 
 PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) {
-  struct PP_Var result = { PP_VARTYPE_BOOL, {PP_FALSE} };
+  struct PP_Var result = { PP_VARTYPE_BOOL, 0, {PP_FALSE} };
   result.value.as_bool = value;
   return result;
 }
 
 PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) {
-  struct PP_Var result = { PP_VARTYPE_INT32, {PP_FALSE} };
+  struct PP_Var result = { PP_VARTYPE_INT32, 0, {PP_FALSE} };
   result.value.as_int = value;
   return result;
 }
 
 PP_INLINE struct PP_Var PP_MakeDouble(double value) {
-  struct PP_Var result = { PP_VARTYPE_DOUBLE, {PP_FALSE} };
+  struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} };
   result.value.as_double = value;
   return result;
 }