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 /** | 6 /** |
7 * This file defines the API for handling the passing of data types between | 7 * This file defines the API for handling the passing of data types between |
8 * your module and the page. | 8 * your module and the page. |
9 */ | 9 */ |
10 | 10 |
(...skipping 27 matching lines...) Expand all Loading... |
38 /** | 38 /** |
39 * A double-precision floating point value. Use the <code>as_double</code> | 39 * A double-precision floating point value. Use the <code>as_double</code> |
40 * member of the var. | 40 * member of the var. |
41 */ | 41 */ |
42 PP_VARTYPE_DOUBLE = 4, | 42 PP_VARTYPE_DOUBLE = 4, |
43 | 43 |
44 /** | 44 /** |
45 * The Var represents a string. The <code>as_id</code> field is used to | 45 * The Var represents a string. The <code>as_id</code> field is used to |
46 * identify the string, which may be created and retrieved from the | 46 * identify the string, which may be created and retrieved from the |
47 * <code>PPB_Var</code> interface. These objects are reference counted, so | 47 * <code>PPB_Var</code> interface. These objects are reference counted, so |
48 * AddRef and Release must be used properly to avoid memory leaks. | 48 * AddRef() and Release() must be used properly to avoid memory leaks. |
49 */ | 49 */ |
50 PP_VARTYPE_STRING = 5, | 50 PP_VARTYPE_STRING = 5, |
51 | 51 |
52 /** | 52 /** |
53 * Represents a JavaScript object. This vartype is not currently usable | 53 * Represents a JavaScript object. This vartype is not currently usable |
54 * from modules, although it is used internally for some tasks. These objects | 54 * from modules, although it is used internally for some tasks. These objects |
55 * are reference counted, so AddRef and Release must be used properly to avoid | 55 * are reference counted, so AddRef() and Release() must be used properly to |
56 * memory leaks. | 56 * avoid memory leaks. |
57 */ | 57 */ |
58 PP_VARTYPE_OBJECT = 6, | 58 PP_VARTYPE_OBJECT = 6, |
59 | 59 |
60 /** | 60 /** |
61 * Represents an array of Vars. The <code>as_id</code> field is used to | 61 * Represents an array of Vars. The <code>as_id</code> field is used to |
62 * identify the array, which may be created and manipulated from the | 62 * identify the array, which may be created and manipulated from the |
63 * <code>PPB_VarArray</code> interface. These objects are reference counted, | 63 * <code>PPB_VarArray</code> interface. These objects are reference counted, |
64 * so AddRef and Release must be used properly to avoid memory leaks. | 64 * so AddRef() and Release() must be used properly to avoid memory leaks. |
65 */ | 65 */ |
66 PP_VARTYPE_ARRAY = 7, | 66 PP_VARTYPE_ARRAY = 7, |
67 | 67 |
68 /** | 68 /** |
69 * Represents a mapping from strings to Vars. The <code>as_id</code> field is | 69 * Represents a mapping from strings to Vars. The <code>as_id</code> field is |
70 * used to identify the dictionary, which may be created and manipulated from | 70 * used to identify the dictionary, which may be created and manipulated from |
71 * the <code>PPB_VarDictionary</code> interface. These objects are reference | 71 * the <code>PPB_VarDictionary</code> interface. These objects are reference |
72 * counted, so AddRef and Release must be used properly to avoid memory leaks. | 72 * counted, so AddRef() and Release() must be used properly to avoid memory |
| 73 * leaks. |
73 */ | 74 */ |
74 PP_VARTYPE_DICTIONARY = 8, | 75 PP_VARTYPE_DICTIONARY = 8, |
75 | 76 |
76 /** | 77 /** |
77 * ArrayBuffer represents a JavaScript ArrayBuffer. This is the type which | 78 * ArrayBuffer represents a JavaScript ArrayBuffer. This is the type which |
78 * represents Typed Arrays in JavaScript. Unlike JavaScript 'Array', it is | 79 * represents Typed Arrays in JavaScript. Unlike JavaScript 'Array', it is |
79 * only meant to contain basic numeric types, and is always stored | 80 * only meant to contain basic numeric types, and is always stored |
80 * contiguously. See PPB_VarArrayBuffer_Dev for functions special to | 81 * contiguously. See PPB_VarArrayBuffer_Dev for functions special to |
81 * ArrayBuffer vars. These objects are reference counted, so AddRef and | 82 * ArrayBuffer vars. These objects are reference counted, so AddRef() and |
82 * Release must be used properly to avoid memory leaks. | 83 * Release() must be used properly to avoid memory leaks. |
83 */ | 84 */ |
84 PP_VARTYPE_ARRAY_BUFFER = 9, | 85 PP_VARTYPE_ARRAY_BUFFER = 9, |
85 | 86 |
86 /** | 87 /** |
87 * Resources are not currently supported but will be added in the future | 88 * This type allows the <code>PP_Var</code> to wrap a <code>PP_Resource |
88 * These objects are reference counted, so AddRef and Release must be used | 89 * </code>. This can be useful for sending or receiving some types of |
89 * properly to avoid memory leaks. | 90 * <code>PP_Resource</code> using <code>PPB_Messaging</code> or |
| 91 * <code>PPP_Messaging</code>. |
| 92 * |
| 93 * These objects are reference counted, so AddRef() and Release() must be used |
| 94 * properly to avoid memory leaks. Under normal circumstances, the |
| 95 * <code>PP_Var</code> will implicitly hold a reference count on the |
| 96 * <code>PP_Resource</code> on your behalf. For example, if you call |
| 97 * VarFromResource(), it implicitly calls PPB_Core::AddRefResource() on the |
| 98 * <code>PP_Resource</code>. Likewise, PPB_Var::Release() on a Resource |
| 99 * <code>PP_Var</code> will invoke PPB_Core::ReleaseResource() when the Var |
| 100 * reference count goes to zero. |
90 */ | 101 */ |
91 PP_VARTYPE_RESOURCE = 10 | 102 PP_VARTYPE_RESOURCE = 10 |
92 }; | 103 }; |
93 | 104 |
94 | 105 |
95 /** | 106 /** |
96 * The PP_VarValue union stores the data for any one of the types listed | 107 * The PP_VarValue union stores the data for any one of the types listed |
97 * in the PP_VarType enum. | 108 * in the PP_VarType enum. |
98 */ | 109 */ |
99 [union] struct PP_VarValue { | 110 [union] struct PP_VarValue { |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; | 245 struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} }; |
235 result.value.as_double = value; | 246 result.value.as_double = value; |
236 return result; | 247 return result; |
237 } | 248 } |
238 /** | 249 /** |
239 * @} | 250 * @} |
240 */ | 251 */ |
241 | 252 |
242 #endinl | 253 #endinl |
243 | 254 |
OLD | NEW |