Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: ppapi/c/pp_var.h

Issue 6286018: Updated descriptions to several functions, structs, enums (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ppapi/c/ppp.h » ('j') | ppapi/c/ppp.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/c/pp_var.h
===================================================================
--- ppapi/c/pp_var.h (revision 73298)
+++ ppapi/c/pp_var.h (working copy)
@@ -19,6 +19,11 @@
* @addtogroup Enums
* @{
*/
+
+/**
+ * PP_VarType is an enumeration of the different types that can be contained
+ * within a PP_VAR structure.
+ */
typedef enum {
PP_VARTYPE_UNDEFINED,
PP_VARTYPE_NULL,
@@ -39,17 +44,19 @@
*/
/**
- * Do not rely on having a predictable and reproducible
- * int/double differentiation.
- * JavaScript has a "number" type for holding a number, and
- * does not differentiate between floating point and integer numbers. The
- * JavaScript library will try to optimize operations by using integers
- * when possible, but could end up with doubles depending on how the number
- * was arrived at.
+ * PP_VAR is a struct that represents a variant data type and can contain any
Sang Ahn 2011/02/01 19:19:00 PP_VAR does not represent a variant data type; it
jond 2011/02/02 16:54:51 Fixed.
+ * value, such as a bool, int32, double, or string. This structure is for
dmichael(do not use this one) 2011/02/01 22:17:22 'int32' -> int32_t 'or string' -> 'string, or obje
jond 2011/02/02 16:54:51 It says this now: "The PP_VAR struct is a variant
+ * passing data between native code which can be strongly typed and the browser
+ * (JavaScript) which isn't strongly typed.
*
- * Your best bet is to have a wrapper for variables
- * that always gets out the type you expect, converting as necessary.
+ * You cannot rely on having a predictable and reproducible int/double
+ * differentiation in JavaScript. JavaScript has a "number" type for holding
+ * a number, and does not differentiate between floating point and integer
+ * numbers. The JavaScript library will try to optimize operations by using
Sang Ahn 2011/02/01 19:19:00 Javascript library -> Javascript operations ie "Ja
jond 2011/02/02 16:54:51 Fixed. On 2011/02/01 19:19:00, Sang Ahn wrote:
+ * integers when possible, but could end up with doubles.
*
+ * PP_Var represents the best solution of using a wrapper for variables
+ * that always returns the type you expect (converting as necessary).
dmichael(do not use this one) 2011/02/01 22:17:22 I don't believe this is true. PPB_Var has a funct
*/
struct PP_Var {
PP_VarType type;
@@ -82,28 +89,57 @@
* @addtogroup Functions
* @{
*/
+
+/**
+ * PP_MakeUndefined() is a utility function used to wrap an undefined value
+ * into a PP_VAR struct for passing to the browser.
+ * @return A PP_Var structure
+ */
PP_INLINE struct PP_Var PP_MakeUndefined() {
struct PP_Var result = { PP_VARTYPE_UNDEFINED, 0, {PP_FALSE} };
return result;
}
+/**
+ * PP_MakeNull() is a utility function used to wrap a null value into a
+ * PP_VAR struct for passing to the browser.
+ * @return A PP_Var structure
+ */
PP_INLINE struct PP_Var PP_MakeNull() {
struct PP_Var result = { PP_VARTYPE_NULL, 0, {PP_FALSE} };
return result;
}
+/**
+ * PP_MakeBool() is a utility function used to wrap a boolean value into a
+ * PP_VAR struct for passing to the browser.
+ * @param[in] value A PP_Bool enumeration
+ * @return A PP_Var structure
+ */
PP_INLINE struct PP_Var PP_MakeBool(PP_Bool value) {
struct PP_Var result = { PP_VARTYPE_BOOL, 0, {PP_FALSE} };
result.value.as_bool = value;
return result;
}
+/**
+ * PP_MakeInt32() is a utility function used to wrap a 32 bit integer value
+ * into a PP_VAR struct for passing to the browser.
+ * @param[in] value An int32
+ * @return A PP_Var structure
+ */
PP_INLINE struct PP_Var PP_MakeInt32(int32_t value) {
struct PP_Var result = { PP_VARTYPE_INT32, 0, {PP_FALSE} };
result.value.as_int = value;
return result;
}
+/**
+ * PP_MakeDouble() is a utility function used to wrap a double value into a
+ * PP_VAR struct for passing to the browser.
+ * @param[in] value A double
+ * @return A PP_Var structure
+ */
PP_INLINE struct PP_Var PP_MakeDouble(double value) {
struct PP_Var result = { PP_VARTYPE_DOUBLE, 0, {PP_FALSE} };
result.value.as_double = value;
« no previous file with comments | « no previous file | ppapi/c/ppp.h » ('j') | ppapi/c/ppp.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698