| 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 ppb_var.idl modified Thu Feb 6 13:48:33 2014. */ | 6 /* From ppb_var.idl modified Thu Apr 10 14:54:41 2014. */ |
| 7 | 7 |
| 8 #ifndef PPAPI_C_PPB_VAR_H_ | 8 #ifndef PPAPI_C_PPB_VAR_H_ |
| 9 #define PPAPI_C_PPB_VAR_H_ | 9 #define PPAPI_C_PPB_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_module.h" | 13 #include "ppapi/c/pp_module.h" |
| 14 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
| 15 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
| 16 #include "ppapi/c/pp_var.h" | 16 #include "ppapi/c/pp_var.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 37 /** | 37 /** |
| 38 * AddRef() adds a reference to the given var. If this is not a refcounted | 38 * AddRef() adds a reference to the given var. If this is not a refcounted |
| 39 * object, this function will do nothing so you can always call it no matter | 39 * object, this function will do nothing so you can always call it no matter |
| 40 * what the type. | 40 * what the type. |
| 41 * | 41 * |
| 42 * @param[in] var A <code>PP_Var</code> that will have a reference added. | 42 * @param[in] var A <code>PP_Var</code> that will have a reference added. |
| 43 */ | 43 */ |
| 44 void (*AddRef)(struct PP_Var var); | 44 void (*AddRef)(struct PP_Var var); |
| 45 /** | 45 /** |
| 46 * Release() removes a reference to given var, deleting it if the internal | 46 * Release() removes a reference to given var, deleting it if the internal |
| 47 * reference count becomes 0. If the given var is not a refcounted object, | 47 * reference count becomes 0. If the <code>PP_Var</code> is of type |
| 48 * this function will do nothing so you can always call it no matter what | 48 * <code>PP_VARTYPE_RESOURCE</code>, |
| 49 * the type. | 49 * it will implicitly release a reference count on the |
| 50 * <code>PP_Resource</code> (equivalent to PPB_Core::ReleaseResource()). |
| 51 * |
| 52 * If the given var is not a refcounted object, this function will do nothing |
| 53 * so you can always call it no matter what the type. |
| 50 * | 54 * |
| 51 * @param[in] var A <code>PP_Var</code> that will have a reference removed. | 55 * @param[in] var A <code>PP_Var</code> that will have a reference removed. |
| 52 */ | 56 */ |
| 53 void (*Release)(struct PP_Var var); | 57 void (*Release)(struct PP_Var var); |
| 54 /** | 58 /** |
| 55 * VarFromUtf8() creates a string var from a string. The string must be | 59 * VarFromUtf8() creates a string var from a string. The string must be |
| 56 * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be | 60 * encoded in valid UTF-8 and is NOT NULL-terminated, the length must be |
| 57 * specified in <code>len</code>. It is an error if the string is not | 61 * specified in <code>len</code>. It is an error if the string is not |
| 58 * valid UTF-8. | 62 * valid UTF-8. |
| 59 * | 63 * |
| 60 * If the length is 0, the <code>*data</code> pointer will not be dereferenced | 64 * If the length is 0, the <code>*data</code> pointer will not be dereferenced |
| 61 * and may be <code>NULL</code>. Note, however if length is 0, the | 65 * and may be <code>NULL</code>. Note, however if length is 0, the |
| 62 * "NULL-ness" will not be preserved, as <code>VarToUtf8</code> will never | 66 * "NULL-ness" will not be preserved, as VarToUtf8() will never return |
| 63 * return <code>NULL</code> on success, even for empty strings. | 67 * <code>NULL</code> on success, even for empty strings. |
| 64 * | 68 * |
| 65 * The resulting object will be a refcounted string object. It will be | 69 * The resulting object will be a refcounted string object. It will be |
| 66 * AddRef'ed for the caller. When the caller is done with it, it should be | 70 * AddRef'ed for the caller. When the caller is done with it, it should be |
| 67 * Released. | 71 * Released. |
| 68 * | 72 * |
| 69 * On error (basically out of memory to allocate the string, or input that | 73 * On error (basically out of memory to allocate the string, or input that |
| 70 * is not valid UTF-8), this function will return a Null var. | 74 * is not valid UTF-8), this function will return a Null var. |
| 71 * | 75 * |
| 72 * @param[in] data A string | 76 * @param[in] data A string |
| 73 * @param[in] len The length of the string. | 77 * @param[in] len The length of the string. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 99 * Converts a resource-type var to a <code>PP_Resource</code>. | 103 * Converts a resource-type var to a <code>PP_Resource</code>. |
| 100 * | 104 * |
| 101 * @param[in] var A <code>PP_Var</code> struct containing a resource-type var. | 105 * @param[in] var A <code>PP_Var</code> struct containing a resource-type var. |
| 102 * | 106 * |
| 103 * @return A <code>PP_Resource</code> retrieved from the var, or 0 if the var | 107 * @return A <code>PP_Resource</code> retrieved from the var, or 0 if the var |
| 104 * is not a resource. The reference count of the resource is incremented on | 108 * is not a resource. The reference count of the resource is incremented on |
| 105 * behalf of the caller. | 109 * behalf of the caller. |
| 106 */ | 110 */ |
| 107 PP_Resource (*VarToResource)(struct PP_Var var); | 111 PP_Resource (*VarToResource)(struct PP_Var var); |
| 108 /** | 112 /** |
| 109 * Creates a new <code>PP_Var</code> from a given resource. | 113 * Creates a new <code>PP_Var</code> from a given resource. Implicitly adds a |
| 114 * reference count on the <code>PP_Resource</code> (equivalent to |
| 115 * PPB_Core::AddRefResource(resource)). |
| 110 * | 116 * |
| 111 * @param[in] resource A <code>PP_Resource</code> to be wrapped in a var. | 117 * @param[in] resource A <code>PP_Resource</code> to be wrapped in a var. |
| 112 * | 118 * |
| 113 * @return A <code>PP_Var</code> created for this resource, with type | 119 * @return A <code>PP_Var</code> created for this resource, with type |
| 114 * <code>PP_VARTYPE_RESOURCE</code>. The reference count of the var is set to | 120 * <code>PP_VARTYPE_RESOURCE</code>. The reference count of the var is set to |
| 115 * 1 on behalf of the caller. | 121 * 1 on behalf of the caller. |
| 116 */ | 122 */ |
| 117 struct PP_Var (*VarFromResource)(PP_Resource resource); | 123 struct PP_Var (*VarFromResource)(PP_Resource resource); |
| 118 }; | 124 }; |
| 119 | 125 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 133 void (*Release)(struct PP_Var var); | 139 void (*Release)(struct PP_Var var); |
| 134 struct PP_Var (*VarFromUtf8)(const char* data, uint32_t len); | 140 struct PP_Var (*VarFromUtf8)(const char* data, uint32_t len); |
| 135 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); | 141 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); |
| 136 }; | 142 }; |
| 137 /** | 143 /** |
| 138 * @} | 144 * @} |
| 139 */ | 145 */ |
| 140 | 146 |
| 141 #endif /* PPAPI_C_PPB_VAR_H_ */ | 147 #endif /* PPAPI_C_PPB_VAR_H_ */ |
| 142 | 148 |
| OLD | NEW |