| 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 Wed Dec 14 18:08:00 2011. */ | 6 /* From ppb_var.idl modified Thu Feb 6 13:48:33 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_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
| 15 #include "ppapi/c/pp_var.h" | 16 #include "ppapi/c/pp_var.h" |
| 16 | 17 |
| 17 #define PPB_VAR_INTERFACE_1_0 "PPB_Var;1.0" | 18 #define PPB_VAR_INTERFACE_1_0 "PPB_Var;1.0" |
| 18 #define PPB_VAR_INTERFACE_1_1 "PPB_Var;1.1" | 19 #define PPB_VAR_INTERFACE_1_1 "PPB_Var;1.1" |
| 19 #define PPB_VAR_INTERFACE PPB_VAR_INTERFACE_1_1 | 20 #define PPB_VAR_INTERFACE_1_2 "PPB_Var;1.2" |
| 21 #define PPB_VAR_INTERFACE PPB_VAR_INTERFACE_1_2 |
| 20 | 22 |
| 21 /** | 23 /** |
| 22 * @file | 24 * @file |
| 23 * This file defines the <code>PPB_Var</code> struct. | 25 * This file defines the <code>PPB_Var</code> struct. |
| 24 */ | 26 */ |
| 25 | 27 |
| 26 | 28 |
| 27 /** | 29 /** |
| 28 * @addtogroup Interfaces | 30 * @addtogroup Interfaces |
| 29 * @{ | 31 * @{ |
| 30 */ | 32 */ |
| 31 /** | 33 /** |
| 32 * PPB_Var API | 34 * PPB_Var API |
| 33 */ | 35 */ |
| 34 struct PPB_Var_1_1 { | 36 struct PPB_Var_1_2 { |
| 35 /** | 37 /** |
| 36 * 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 |
| 37 * 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 |
| 38 * what the type. | 40 * what the type. |
| 39 * | 41 * |
| 40 * @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. |
| 41 */ | 43 */ |
| 42 void (*AddRef)(struct PP_Var var); | 44 void (*AddRef)(struct PP_Var var); |
| 43 /** | 45 /** |
| 44 * 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 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 * The returned buffer will be valid as long as the underlying var is alive. | 88 * The returned buffer will be valid as long as the underlying var is alive. |
| 87 * If the instance frees its reference, the string will be freed and the | 89 * If the instance frees its reference, the string will be freed and the |
| 88 * pointer will be to arbitrary memory. | 90 * pointer will be to arbitrary memory. |
| 89 * | 91 * |
| 90 * @param[in] var A PP_Var struct containing a string-type var. | 92 * @param[in] var A PP_Var struct containing a string-type var. |
| 91 * @param[in,out] len A pointer to the length of the string-type var. | 93 * @param[in,out] len A pointer to the length of the string-type var. |
| 92 * | 94 * |
| 93 * @return A char* encoded in UTF-8. | 95 * @return A char* encoded in UTF-8. |
| 94 */ | 96 */ |
| 95 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); | 97 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); |
| 98 /** |
| 99 * Converts a resource-type var to a <code>PP_Resource</code>. |
| 100 * |
| 101 * @param[in] var A <code>PP_Var</code> struct containing a resource-type var. |
| 102 * |
| 103 * @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 |
| 105 * behalf of the caller. |
| 106 */ |
| 107 PP_Resource (*VarToResource)(struct PP_Var var); |
| 108 /** |
| 109 * Creates a new <code>PP_Var</code> from a given resource. |
| 110 * |
| 111 * @param[in] resource A <code>PP_Resource</code> to be wrapped in a var. |
| 112 * |
| 113 * @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 |
| 115 * 1 on behalf of the caller. |
| 116 */ |
| 117 struct PP_Var (*VarFromResource)(PP_Resource resource); |
| 96 }; | 118 }; |
| 97 | 119 |
| 98 typedef struct PPB_Var_1_1 PPB_Var; | 120 typedef struct PPB_Var_1_2 PPB_Var; |
| 99 | 121 |
| 100 struct PPB_Var_1_0 { | 122 struct PPB_Var_1_0 { |
| 101 void (*AddRef)(struct PP_Var var); | 123 void (*AddRef)(struct PP_Var var); |
| 102 void (*Release)(struct PP_Var var); | 124 void (*Release)(struct PP_Var var); |
| 103 struct PP_Var (*VarFromUtf8)(PP_Module module, | 125 struct PP_Var (*VarFromUtf8)(PP_Module module, |
| 104 const char* data, | 126 const char* data, |
| 105 uint32_t len); | 127 uint32_t len); |
| 106 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); | 128 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); |
| 107 }; | 129 }; |
| 130 |
| 131 struct PPB_Var_1_1 { |
| 132 void (*AddRef)(struct PP_Var var); |
| 133 void (*Release)(struct PP_Var var); |
| 134 struct PP_Var (*VarFromUtf8)(const char* data, uint32_t len); |
| 135 const char* (*VarToUtf8)(struct PP_Var var, uint32_t* len); |
| 136 }; |
| 108 /** | 137 /** |
| 109 * @} | 138 * @} |
| 110 */ | 139 */ |
| 111 | 140 |
| 112 #endif /* PPAPI_C_PPB_VAR_H_ */ | 141 #endif /* PPAPI_C_PPB_VAR_H_ */ |
| 113 | 142 |
| OLD | NEW |