 Chromium Code Reviews
 Chromium Code Reviews Issue 6823016:
  Create a VarPrivate interface to contain the scripting helper functions of Var.  (Closed) 
  Base URL: svn://chrome-svn/chrome/trunk/src/
    
  
    Issue 6823016:
  Create a VarPrivate interface to contain the scripting helper functions of Var.  (Closed) 
  Base URL: svn://chrome-svn/chrome/trunk/src/| OLD | NEW | 
|---|---|
| 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 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" | 
| 9 #include "ppapi/c/pp_macros.h" | 9 #include "ppapi/c/pp_macros.h" | 
| 10 #include "ppapi/c/pp_stdint.h" | 10 #include "ppapi/c/pp_stdint.h" | 
| 11 | 11 | 
| 12 /** | 12 /** | 
| 13 * @file | 13 * @file | 
| 14 * This file defines the API for handling the passing of data types between | 14 * This file defines the API for handling the passing of data types between | 
| 15 * your module and the page. | 15 * your module and the page. | 
| 16 */ | 16 */ | 
| 17 | 17 | 
| 18 /** | 18 /** | 
| 19 * | 19 * | 
| 20 * @addtogroup Enums | 20 * @addtogroup Enums | 
| 21 * @{ | 21 * @{ | 
| 22 */ | 22 */ | 
| 23 | 23 | 
| 24 /** | 24 /** | 
| 25 * PP_VarType is an enumeration of the different types that can be contained | 25 * PP_VarType is an enumeration of the different types that can be contained | 
| 26 * within a PP_VAR structure. | 26 * within a PP_VAR structure. | 
| 27 */ | 27 */ | 
| 28 typedef enum { | 28 typedef enum { | 
| 29 /** | |
| 30 * A var with an undefined value. | |
| 
dmichael(do not use this one)
2011/04/08 22:16:28
Maybe just say 'An undefined value.' to be consist
 | |
| 31 */ | |
| 29 PP_VARTYPE_UNDEFINED, | 32 PP_VARTYPE_UNDEFINED, | 
| 33 | |
| 34 /** | |
| 35 * A NULL value. This is similar to undefined, but JavaScript differentiates | |
| 36 * the two so we expose it here as well. | |
| 37 */ | |
| 30 PP_VARTYPE_NULL, | 38 PP_VARTYPE_NULL, | 
| 39 | |
| 40 /** | |
| 41 * A boolean value, use the as_bool member of the var. | |
| 42 */ | |
| 31 PP_VARTYPE_BOOL, | 43 PP_VARTYPE_BOOL, | 
| 44 | |
| 45 /** | |
| 46 * A 32-bit integer value. Use the as_int member of the var. | |
| 47 */ | |
| 32 PP_VARTYPE_INT32, | 48 PP_VARTYPE_INT32, | 
| 49 | |
| 50 /** | |
| 51 * A double-precision floating point value. Use the as_double member of the | |
| 52 * var. | |
| 53 */ | |
| 33 PP_VARTYPE_DOUBLE, | 54 PP_VARTYPE_DOUBLE, | 
| 55 | |
| 56 /** | |
| 57 * The Var represents a string. The as_id field is used to identify the | |
| 58 * string, which may be created and retrieved from the PPB_Var interface. | |
| 59 */ | |
| 34 PP_VARTYPE_STRING, | 60 PP_VARTYPE_STRING, | 
| 35 PP_VARTYPE_OBJECT | 61 | 
| 62 /** | |
| 63 * Represents a JavaScript object. This vartype is not currently usable | |
| 
dmichael(do not use this one)
2011/04/08 22:16:28
maybe take out 'currently'?  We should avoid givin
 | |
| 64 * from plugins, although it is used internally for some tasks. | |
| 65 */ | |
| 66 PP_VARTYPE_OBJECT, | |
| 67 | |
| 68 /** | |
| 69 * Arrays and dictionaries are not currently supported but will be added | |
| 70 * in future revisions. These objects are reference counteed so be sure | |
| 
dmichael(do not use this one)
2011/04/08 22:16:28
s/counteed/counted
 | |
| 71 * to properly AddRef/Release them as you would with strings to ensure your | |
| 72 * plugin will continue to work with future versions of the API. | |
| 73 */ | |
| 74 PP_VARTYPE_ARRAY, | |
| 75 PP_VARTYPE_DICTIONARY | |
| 
dmichael(do not use this one)
2011/04/08 22:16:28
After thinking about it a little more, I still hav
 
brettw
2011/04/09 16:41:34
If we had designed this API without scripting from
 
dmichael (off chromium)
2011/04/11 00:09:16
Thanks for explaining.  I think we may still need
 | |
| 36 } PP_VarType; | 76 } PP_VarType; | 
| 37 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4); | 77 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4); | 
| 38 /** | 78 /** | 
| 39 * @} | 79 * @} | 
| 40 */ | 80 */ | 
| 41 | 81 | 
| 42 /** | 82 /** | 
| 43 * @addtogroup Structs | 83 * @addtogroup Structs | 
| 44 * @{ | 84 * @{ | 
| 45 */ | 85 */ | 
| (...skipping 20 matching lines...) Expand all Loading... | |
| 66 * for 32-bit x86, and some align on 4-byte boundaries. | 106 * for 32-bit x86, and some align on 4-byte boundaries. | 
| 67 */ | 107 */ | 
| 68 int32_t padding; | 108 int32_t padding; | 
| 69 | 109 | 
| 70 union { | 110 union { | 
| 71 PP_Bool as_bool; | 111 PP_Bool as_bool; | 
| 72 int32_t as_int; | 112 int32_t as_int; | 
| 73 double as_double; | 113 double as_double; | 
| 74 | 114 | 
| 75 /** | 115 /** | 
| 76 * Internal ID for strings and objects. The identifier is an opaque handle | 116 * Internal ID for strings objects, arrays, and dictionaries. The | 
| 77 * assigned by the browser to the plugin. It is guaranteed never to be 0, | 117 * identifier is an opaque handle assigned by the browser to the plugin. It | 
| 78 * so a plugin can initialize this ID to 0 to indicate a "NULL handle." | 118 * is guaranteed never to be 0, so a plugin can initialize this ID to 0 to | 
| 119 * indicate a "NULL handle." | |
| 
dmichael(do not use this one)
2011/04/08 22:16:28
if we _don't_ do reference counting, we can use a
 | |
| 79 */ | 120 */ | 
| 80 int64_t as_id; | 121 int64_t as_id; | 
| 81 } value; | 122 } value; | 
| 82 }; | 123 }; | 
| 83 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Var, 16); | 124 PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_Var, 16); | 
| 84 /** | 125 /** | 
| 85 * @} | 126 * @} | 
| 86 */ | 127 */ | 
| 87 | 128 | 
| 88 /** | 129 /** | 
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 144 struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; | 185 struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; | 
| 145 result.value.as_double = value; | 186 result.value.as_double = value; | 
| 146 return result; | 187 return result; | 
| 147 } | 188 } | 
| 148 /** | 189 /** | 
| 149 * @} | 190 * @} | 
| 150 */ | 191 */ | 
| 151 | 192 | 
| 152 #endif /* PPAPI_C_PP_VAR_H_ */ | 193 #endif /* PPAPI_C_PP_VAR_H_ */ | 
| 153 | 194 | 
| OLD | NEW |