| 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 <code>PPB_Var</code> struct. | 7 * This file defines the <code>PPB_Var</code> struct. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 label Chrome { | 10 label Chrome { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 * object, this function will do nothing so you can always call it no matter | 22 * object, this function will do nothing so you can always call it no matter |
| 23 * what the type. | 23 * what the type. |
| 24 * | 24 * |
| 25 * @param[in] var A <code>PP_Var</code> that will have a reference added. | 25 * @param[in] var A <code>PP_Var</code> that will have a reference added. |
| 26 */ | 26 */ |
| 27 [version=1.0] | 27 [version=1.0] |
| 28 void AddRef([in] PP_Var var); | 28 void AddRef([in] PP_Var var); |
| 29 | 29 |
| 30 /** | 30 /** |
| 31 * Release() removes a reference to given var, deleting it if the internal | 31 * Release() removes a reference to given var, deleting it if the internal |
| 32 * reference count becomes 0. If the given var is not a refcounted object, | 32 * reference count becomes 0. If the <code>PP_Var</code> is of type |
| 33 * this function will do nothing so you can always call it no matter what | 33 * <code>PP_VARTYPE_RESOURCE</code>, |
| 34 * the type. | 34 * it will implicitly release a reference count on the |
| 35 * <code>PP_Resource</code> (equivalent to PPB_Core::ReleaseResource()). |
| 36 * |
| 37 * If the given var is not a refcounted object, this function will do nothing |
| 38 * so you can always call it no matter what the type. |
| 35 * | 39 * |
| 36 * @param[in] var A <code>PP_Var</code> that will have a reference removed. | 40 * @param[in] var A <code>PP_Var</code> that will have a reference removed. |
| 37 */ | 41 */ |
| 38 [version=1.0] | 42 [version=1.0] |
| 39 void Release([in] PP_Var var); | 43 void Release([in] PP_Var var); |
| 40 | 44 |
| 41 /** | 45 /** |
| 42 * VarFromUtf8() creates a string var from a string. The string must be | 46 * VarFromUtf8() creates a string var from a string. The string must be |
| 43 * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be | 47 * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be |
| 44 * specified in <code>len</code>. It is an error if the string is not | 48 * specified in <code>len</code>. It is an error if the string is not |
| 45 * valid UTF-8. | 49 * valid UTF-8. |
| 46 * | 50 * |
| 47 * If the length is 0, the <code>*data</code> pointer will not be dereferenced | 51 * If the length is 0, the <code>*data</code> pointer will not be dereferenced |
| 48 * and may be <code>NULL</code>. Note, however if length is 0, the | 52 * and may be <code>NULL</code>. Note, however if length is 0, the |
| 49 * "NULL-ness" will not be preserved, as <code>VarToUtf8</code> will never | 53 * "NULL-ness" will not be preserved, as VarToUtf8() will never |
| 50 * return <code>NULL</code> on success, even for empty strings. | 54 * return <code>NULL</code> on success, even for empty strings. |
| 51 * | 55 * |
| 52 * The resulting object will be a refcounted string object. It will be | 56 * The resulting object will be a refcounted string object. It will be |
| 53 * AddRef'ed for the caller. When the caller is done with it, it should be | 57 * AddRef'ed for the caller. When the caller is done with it, it should be |
| 54 * Released. | 58 * Released. |
| 55 * | 59 * |
| 56 * On error (basically out of memory to allocate the string, or input that | 60 * On error (basically out of memory to allocate the string, or input that |
| 57 * is not valid UTF-8), this function will return a Null var. | 61 * is not valid UTF-8), this function will return a Null var. |
| 58 * | 62 * |
| 59 * @param[in] module A PP_Module uniquely identifying the module or .nexe. | 63 * @param[in] module A PP_Module uniquely identifying the module or .nexe. |
| 60 * @param[in] data A string | 64 * @param[in] data A string |
| 61 * @param[in] len The length of the string. | 65 * @param[in] len The length of the string. |
| 62 * | 66 * |
| 63 * @return A <code>PP_Var</code> structure containing a reference counted | 67 * @return A <code>PP_Var</code> structure containing a reference counted |
| 64 * string object. | 68 * string object. |
| 65 */ | 69 */ |
| 66 [version=1.0] | 70 [version=1.0] |
| 67 PP_Var VarFromUtf8([in] PP_Module module, [in] str_t data, [in] uint32_t len); | 71 PP_Var VarFromUtf8([in] PP_Module module, [in] str_t data, [in] uint32_t len); |
| 68 | 72 |
| 69 /** | 73 /** |
| 70 * VarFromUtf8() creates a string var from a string. The string must be | 74 * VarFromUtf8() creates a string var from a string. The string must be |
| 71 * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be | 75 * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be |
| 72 * specified in <code>len</code>. It is an error if the string is not | 76 * specified in <code>len</code>. It is an error if the string is not |
| 73 * valid UTF-8. | 77 * valid UTF-8. |
| 74 * | 78 * |
| 75 * If the length is 0, the <code>*data</code> pointer will not be dereferenced | 79 * If the length is 0, the <code>*data</code> pointer will not be dereferenced |
| 76 * and may be <code>NULL</code>. Note, however if length is 0, the | 80 * and may be <code>NULL</code>. Note, however if length is 0, the |
| 77 * "NULL-ness" will not be preserved, as <code>VarToUtf8</code> will never | 81 * "NULL-ness" will not be preserved, as VarToUtf8() will never return |
| 78 * return <code>NULL</code> on success, even for empty strings. | 82 * <code>NULL</code> on success, even for empty strings. |
| 79 * | 83 * |
| 80 * The resulting object will be a refcounted string object. It will be | 84 * The resulting object will be a refcounted string object. It will be |
| 81 * AddRef'ed for the caller. When the caller is done with it, it should be | 85 * AddRef'ed for the caller. When the caller is done with it, it should be |
| 82 * Released. | 86 * Released. |
| 83 * | 87 * |
| 84 * On error (basically out of memory to allocate the string, or input that | 88 * On error (basically out of memory to allocate the string, or input that |
| 85 * is not valid UTF-8), this function will return a Null var. | 89 * is not valid UTF-8), this function will return a Null var. |
| 86 * | 90 * |
| 87 * @param[in] data A string | 91 * @param[in] data A string |
| 88 * @param[in] len The length of the string. | 92 * @param[in] len The length of the string. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 * @param[in] var A <code>PP_Var</code> struct containing a resource-type var. | 124 * @param[in] var A <code>PP_Var</code> struct containing a resource-type var. |
| 121 * | 125 * |
| 122 * @return A <code>PP_Resource</code> retrieved from the var, or 0 if the var | 126 * @return A <code>PP_Resource</code> retrieved from the var, or 0 if the var |
| 123 * is not a resource. The reference count of the resource is incremented on | 127 * is not a resource. The reference count of the resource is incremented on |
| 124 * behalf of the caller. | 128 * behalf of the caller. |
| 125 */ | 129 */ |
| 126 [version=1.2] | 130 [version=1.2] |
| 127 PP_Resource VarToResource([in] PP_Var var); | 131 PP_Resource VarToResource([in] PP_Var var); |
| 128 | 132 |
| 129 /** | 133 /** |
| 130 * Creates a new <code>PP_Var</code> from a given resource. | 134 * Creates a new <code>PP_Var</code> from a given resource. Implicitly adds a |
| 135 * reference count on the <code>PP_Resource</code> (equivalent to |
| 136 * PPB_Core::AddRefResource(resource)). |
| 131 * | 137 * |
| 132 * @param[in] resource A <code>PP_Resource</code> to be wrapped in a var. | 138 * @param[in] resource A <code>PP_Resource</code> to be wrapped in a var. |
| 133 * | 139 * |
| 134 * @return A <code>PP_Var</code> created for this resource, with type | 140 * @return A <code>PP_Var</code> created for this resource, with type |
| 135 * <code>PP_VARTYPE_RESOURCE</code>. The reference count of the var is set to | 141 * <code>PP_VARTYPE_RESOURCE</code>. The reference count of the var is set to |
| 136 * 1 on behalf of the caller. | 142 * 1 on behalf of the caller. |
| 137 */ | 143 */ |
| 138 [version=1.2] | 144 [version=1.2] |
| 139 PP_Var VarFromResource([in] PP_Resource resource); | 145 PP_Var VarFromResource([in] PP_Resource resource); |
| 140 }; | 146 }; |
| 141 | 147 |
| OLD | NEW |