OLD | NEW |
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2012 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 | 5 |
6 /* From pp_var.idl modified Thu Sep 12 16:41:36 2013. */ | 6 /* From pp_var.idl modified Tue Apr 8 13:27:16 2014. */ |
7 | 7 |
8 #ifndef PPAPI_C_PP_VAR_H_ | 8 #ifndef PPAPI_C_PP_VAR_H_ |
9 #define PPAPI_C_PP_VAR_H_ | 9 #define PPAPI_C_PP_VAR_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_macros.h" | 12 #include "ppapi/c/pp_macros.h" |
13 #include "ppapi/c/pp_stdint.h" | 13 #include "ppapi/c/pp_stdint.h" |
14 | 14 |
15 /** | 15 /** |
16 * @file | 16 * @file |
(...skipping 30 matching lines...) Expand all Loading... |
47 PP_VARTYPE_INT32 = 3, | 47 PP_VARTYPE_INT32 = 3, |
48 /** | 48 /** |
49 * A double-precision floating point value. Use the <code>as_double</code> | 49 * A double-precision floating point value. Use the <code>as_double</code> |
50 * member of the var. | 50 * member of the var. |
51 */ | 51 */ |
52 PP_VARTYPE_DOUBLE = 4, | 52 PP_VARTYPE_DOUBLE = 4, |
53 /** | 53 /** |
54 * The Var represents a string. The <code>as_id</code> field is used to | 54 * The Var represents a string. The <code>as_id</code> field is used to |
55 * identify the string, which may be created and retrieved from the | 55 * identify the string, which may be created and retrieved from the |
56 * <code>PPB_Var</code> interface. These objects are reference counted, so | 56 * <code>PPB_Var</code> interface. These objects are reference counted, so |
57 * AddRef and Release must be used properly to avoid memory leaks. | 57 * AddRef() and Release() must be used properly to avoid memory leaks. |
58 */ | 58 */ |
59 PP_VARTYPE_STRING = 5, | 59 PP_VARTYPE_STRING = 5, |
60 /** | 60 /** |
61 * Represents a JavaScript object. This vartype is not currently usable | 61 * Represents a JavaScript object. This vartype is not currently usable |
62 * from modules, although it is used internally for some tasks. These objects | 62 * from modules, although it is used internally for some tasks. These objects |
63 * are reference counted, so AddRef and Release must be used properly to avoid | 63 * are reference counted, so AddRef() and Release() must be used properly to |
64 * memory leaks. | 64 * avoid memory leaks. |
65 */ | 65 */ |
66 PP_VARTYPE_OBJECT = 6, | 66 PP_VARTYPE_OBJECT = 6, |
67 /** | 67 /** |
68 * Represents an array of Vars. The <code>as_id</code> field is used to | 68 * Represents an array of Vars. The <code>as_id</code> field is used to |
69 * identify the array, which may be created and manipulated from the | 69 * identify the array, which may be created and manipulated from the |
70 * <code>PPB_VarArray</code> interface. These objects are reference counted, | 70 * <code>PPB_VarArray</code> interface. These objects are reference counted, |
71 * so AddRef and Release must be used properly to avoid memory leaks. | 71 * so AddRef() and Release() must be used properly to avoid memory leaks. |
72 */ | 72 */ |
73 PP_VARTYPE_ARRAY = 7, | 73 PP_VARTYPE_ARRAY = 7, |
74 /** | 74 /** |
75 * Represents a mapping from strings to Vars. The <code>as_id</code> field is | 75 * Represents a mapping from strings to Vars. The <code>as_id</code> field is |
76 * used to identify the dictionary, which may be created and manipulated from | 76 * used to identify the dictionary, which may be created and manipulated from |
77 * the <code>PPB_VarDictionary</code> interface. These objects are reference | 77 * the <code>PPB_VarDictionary</code> interface. These objects are reference |
78 * counted, so AddRef and Release must be used properly to avoid memory leaks. | 78 * counted, so AddRef() and Release() must be used properly to avoid memory |
| 79 * leaks. |
79 */ | 80 */ |
80 PP_VARTYPE_DICTIONARY = 8, | 81 PP_VARTYPE_DICTIONARY = 8, |
81 /** | 82 /** |
82 * ArrayBuffer represents a JavaScript ArrayBuffer. This is the type which | 83 * ArrayBuffer represents a JavaScript ArrayBuffer. This is the type which |
83 * represents Typed Arrays in JavaScript. Unlike JavaScript 'Array', it is | 84 * represents Typed Arrays in JavaScript. Unlike JavaScript 'Array', it is |
84 * only meant to contain basic numeric types, and is always stored | 85 * only meant to contain basic numeric types, and is always stored |
85 * contiguously. See PPB_VarArrayBuffer_Dev for functions special to | 86 * contiguously. See PPB_VarArrayBuffer_Dev for functions special to |
86 * ArrayBuffer vars. These objects are reference counted, so AddRef and | 87 * ArrayBuffer vars. These objects are reference counted, so AddRef() and |
87 * Release must be used properly to avoid memory leaks. | 88 * Release() must be used properly to avoid memory leaks. |
88 */ | 89 */ |
89 PP_VARTYPE_ARRAY_BUFFER = 9, | 90 PP_VARTYPE_ARRAY_BUFFER = 9, |
90 /** | 91 /** |
91 * Resources are not currently supported but will be added in the future | 92 * This type allows the <code>PP_Var</code> to wrap a <code>PP_Resource |
92 * These objects are reference counted, so AddRef and Release must be used | 93 * </code>. This can be useful for sending or receiving some types of |
93 * properly to avoid memory leaks. | 94 * <code>PP_Resource</code> using <code>PPB_Messaging</code> or |
| 95 * <code>PPP_Messaging</code>. |
| 96 * |
| 97 * These objects are reference counted, so AddRef() and Release() must be used |
| 98 * properly to avoid memory leaks. Under normal circumstances, the PP_Var will |
| 99 * implicitly hold a reference count on the PP_Resource on your behalf. For |
| 100 * example, if you call VarFromResource(), it implicitly calls |
| 101 * PPB_Core::AddRefResource() on the PP_Resource. Likewise, PPB_Var::Release() |
| 102 * on a Resource <code>PP_Var</code> will invoke PPB_Core::ReleaseResource() |
| 103 * when the Var reference count goes to zero. |
94 */ | 104 */ |
95 PP_VARTYPE_RESOURCE = 10 | 105 PP_VARTYPE_RESOURCE = 10 |
96 } PP_VarType; | 106 } PP_VarType; |
97 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4); | 107 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_VarType, 4); |
98 /** | 108 /** |
99 * @} | 109 * @} |
100 */ | 110 */ |
101 | 111 |
102 /** | 112 /** |
103 * @addtogroup Structs | 113 * @addtogroup Structs |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; | 251 struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; |
242 result.value.as_double = value; | 252 result.value.as_double = value; |
243 return result; | 253 return result; |
244 } | 254 } |
245 /** | 255 /** |
246 * @} | 256 * @} |
247 */ | 257 */ |
248 | 258 |
249 #endif /* PPAPI_C_PP_VAR_H_ */ | 259 #endif /* PPAPI_C_PP_VAR_H_ */ |
250 | 260 |
OLD | NEW |