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

Side by Side Diff: ppapi/c/ppb_var.h

Issue 5674004: Add compile assertions to enforce the sizes of all structs and enums in the C... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef PPAPI_C_PPB_VAR_H_ 5 #ifndef PPAPI_C_PPB_VAR_H_
6 #define PPAPI_C_PPB_VAR_H_ 6 #define PPAPI_C_PPB_VAR_H_
7 7
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_instance.h" 9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_macros.h" 10 #include "ppapi/c/pp_macros.h"
11 #include "ppapi/c/pp_module.h" 11 #include "ppapi/c/pp_module.h"
12 #include "ppapi/c/pp_resource.h" 12 #include "ppapi/c/pp_resource.h"
13 #include "ppapi/c/pp_stdint.h" 13 #include "ppapi/c/pp_stdint.h"
14 #include "ppapi/c/pp_var.h" 14 #include "ppapi/c/pp_var.h"
15 15
16 #define PPB_VAR_INTERFACE "PPB_Var;0.2" 16 #define PPB_VAR_INTERFACE "PPB_Var;0.3"
17 17
18 /** 18 /**
19 * @file 19 * @file
20 * Defines the PPB_Var struct. 20 * Defines the PPB_Var struct.
21 * See http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript 21 * See http://code.google.com/p/ppapi/wiki/InterfacingWithJavaScript
22 * for general information on using this interface. 22 * for general information on using this interface.
23 * {PENDING: Should the generated doc really be pointing to methods?} 23 * {PENDING: Should the generated doc really be pointing to methods?}
24 * 24 *
25 * @addtogroup PPB 25 * @addtogroup PPB
26 * @{ 26 * @{
27 */ 27 */
28 28
29 enum PP_ObjectProperty_Modifier { 29 enum PP_ObjectProperty_Modifier {
30 PP_OBJECTPROPERTY_MODIFIER_NONE = 0, 30 PP_OBJECTPROPERTY_MODIFIER_NONE = 0,
31 PP_OBJECTPROPERTY_MODIFIER_READONLY = 1 << 0, 31 PP_OBJECTPROPERTY_MODIFIER_READONLY = 1 << 0,
32 PP_OBJECTPROPERTY_MODIFIER_DONTENUM = 1 << 1, 32 PP_OBJECTPROPERTY_MODIFIER_DONTENUM = 1 << 1,
33 PP_OBJECTPROPERTY_MODIFIER_DONTDELETE = 1 << 2, 33 PP_OBJECTPROPERTY_MODIFIER_DONTDELETE = 1 << 2,
34 PP_OBJECTPROPERTY_MODIFIER_HASVALUE = 1 << 3 34 PP_OBJECTPROPERTY_MODIFIER_HASVALUE = 1 << 3
35 }; 35 };
36 PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_ObjectProperty_Modifier, 4);
36 37
37 struct PP_ObjectProperty { 38 struct PP_ObjectProperty {
38 struct PP_Var name; 39 struct PP_Var name;
39 struct PP_Var value; 40 struct PP_Var value;
40 struct PP_Var getter; 41 struct PP_Var getter;
41 struct PP_Var setter; 42 struct PP_Var setter;
42 uint32_t modifiers; 43 uint32_t modifiers;
44
45 /** Ensure that this struct is 72 bytes wide by padding the end. In some
46 * compilers, PP_Var is 8-byte aligned, so those compilers align this struct
47 * on 8-byte boundaries as well and pad it to 72 bytes even without this
48 * padding attribute. This padding makes its size consistent across
49 * compilers.
50 */
51 int32_t padding;
43 }; 52 };
53 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_ObjectProperty, 72);
44 54
45 /** 55 /**
46 * PPB_Var API 56 * PPB_Var API
47 * 57 *
48 * JavaScript specification: 58 * JavaScript specification:
49 * 59 *
50 * When referencing JS specification, we will refer to ECMAScript, 5th edition, 60 * When referencing JS specification, we will refer to ECMAScript, 5th edition,
51 * and we will put section numbers in square brackets. 61 * and we will put section numbers in square brackets.
52 * 62 *
53 * Exception handling: 63 * Exception handling:
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 result.setter = PP_MakeUndefined(); 300 result.setter = PP_MakeUndefined();
291 result.modifiers = PP_OBJECTPROPERTY_MODIFIER_HASVALUE; 301 result.modifiers = PP_OBJECTPROPERTY_MODIFIER_HASVALUE;
292 return result; 302 return result;
293 } 303 }
294 304
295 /** 305 /**
296 * @} 306 * @}
297 * End addtogroup PPB 307 * End addtogroup PPB
298 */ 308 */
299 #endif // PPAPI_C_PPB_VAR_H_ 309 #endif // PPAPI_C_PPB_VAR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698