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

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

Issue 5340003: Make a new test to enforce the sizes of all structs and enums in the C API.... (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
« no previous file with comments | « ppapi/c/pp_macros.h ('k') | ppapi/generate_ppapi_include_tests.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_PP_VAR_H_ 5 #ifndef PPAPI_C_PP_VAR_H_
6 #define PPAPI_C_PP_VAR_H_ 6 #define PPAPI_C_PP_VAR_H_
7 7
8 /** 8 /**
9 * @file 9 * @file
10 * Defines the API ... 10 * Defines the API ...
11 * 11 *
12 * @addtogroup PP 12 * @addtogroup PP
13 * @{ 13 * @{
14 */ 14 */
15 15
16 #include "ppapi/c/pp_bool.h" 16 #include "ppapi/c/pp_bool.h"
17 #include "ppapi/c/pp_macros.h" 17 #include "ppapi/c/pp_macros.h"
18 #include "ppapi/c/pp_stdint.h" 18 #include "ppapi/c/pp_stdint.h"
19 19
20 typedef enum { 20 typedef enum {
21 PP_VARTYPE_UNDEFINED, 21 PP_VARTYPE_UNDEFINED,
22 PP_VARTYPE_NULL, 22 PP_VARTYPE_NULL,
23 PP_VARTYPE_BOOL, 23 PP_VARTYPE_BOOL,
24 PP_VARTYPE_INT32, 24 PP_VARTYPE_INT32,
25 PP_VARTYPE_DOUBLE, 25 PP_VARTYPE_DOUBLE,
26 PP_VARTYPE_STRING, 26 PP_VARTYPE_STRING,
27 PP_VARTYPE_OBJECT 27 PP_VARTYPE_OBJECT
28 } PP_VarType; 28 } PP_VarType;
29 29
30 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4);
31
32 /** 30 /**
33 * Do not rely on having a predictable and reproducible 31 * Do not rely on having a predictable and reproducible
34 * int/double differentiation. 32 * int/double differentiation.
35 * JavaScript has a "number" type for holding a number, and 33 * JavaScript has a "number" type for holding a number, and
36 * does not differentiate between floating point and integer numbers. The 34 * does not differentiate between floating point and integer numbers. The
37 * JavaScript library will try to optimize operations by using integers 35 * JavaScript library will try to optimize operations by using integers
38 * when possible, but could end up with doubles depending on how the number 36 * when possible, but could end up with doubles depending on how the number
39 * was arrived at. 37 * was arrived at.
40 * 38 *
41 * Your best bet is to have a wrapper for variables 39 * Your best bet is to have a wrapper for variables
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 struct PP_Var result = { PP_VARTYPE_DOUBLE, {PP_FALSE} }; 81 struct PP_Var result = { PP_VARTYPE_DOUBLE, {PP_FALSE} };
84 result.value.as_double = value; 82 result.value.as_double = value;
85 return result; 83 return result;
86 } 84 }
87 85
88 /** 86 /**
89 * @} 87 * @}
90 * End addtogroup PP 88 * End addtogroup PP
91 */ 89 */
92 #endif // PPAPI_C_PP_VAR_H_ 90 #endif // PPAPI_C_PP_VAR_H_
OLDNEW
« no previous file with comments | « ppapi/c/pp_macros.h ('k') | ppapi/generate_ppapi_include_tests.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698