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

Unified Diff: ppapi/shared_impl/var_value_conversions.h

Issue 13080002: Apps V2 in Pepper: introduce singleton resource ExtensionsCommon. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 7 years, 9 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 | « ppapi/shared_impl/singleton_resource_id.h ('k') | ppapi/shared_impl/var_value_conversions.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/var_value_conversions.h
diff --git a/ppapi/shared_impl/var_value_conversions.h b/ppapi/shared_impl/var_value_conversions.h
index 09145ce06e20100759028671bbab4928859d7a90..b72e7ccfd403b7cacd7755ce8c8d167421a8d459 100644
--- a/ppapi/shared_impl/var_value_conversions.h
+++ b/ppapi/shared_impl/var_value_conversions.h
@@ -5,10 +5,13 @@
#ifndef PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
#define PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
+#include <vector>
+
#include "ppapi/c/pp_var.h"
#include "ppapi/shared_impl/ppapi_shared_export.h"
namespace base {
+class ListValue;
class Value;
}
@@ -19,10 +22,10 @@ namespace ppapi {
//
// Both PP_VARTYPE_UNDEFINED and PP_VARTYPE_NULL are converted to
// base::Value::TYPE_NULL. In dictionary vars, key-value pairs whose value is
-// undefined (PP_VARTYPE_UNDEFINED) are ignored. If a node in |var| appears more
-// than once, it is duplicated in the result. For example, if |var| is an array
-// and it has two elements pointing to the same dictionary, the resulting list
-// value will have two copies of the dictionary.
+// undefined (PP_VARTYPE_UNDEFINED) or null (PP_VARTYPE_NULL) are ignored. If a
+// node in |var| appears more than once, it is duplicated in the result. For
+// example, if |var| is an array and it has two elements pointing to the same
+// dictionary, the resulting list value will have two copies of the dictionary.
//
// The conversion fails and returns NULL if
// - |var| is object (PP_VARTYPE_OBJECT); or
@@ -32,10 +35,26 @@ namespace ppapi {
// ancestor/descendant.
PPAPI_SHARED_EXPORT base::Value* CreateValueFromVar(const PP_Var& var);
-// The returned var has been added ref on behalf of the caller.
+// The returned var has had 1 ref added on behalf of the caller.
// Returns an undefined var if the conversion fails.
PPAPI_SHARED_EXPORT PP_Var CreateVarFromValue(const base::Value& value);
+// Calls CreateValueFromVar() on each element of |vars| and puts them in a
+// base::ListValue. The caller takes ownership of the returned object.
+//
+// The conversion fails and returns NULL if any of the calls to
+// CreateValueFromVar() fails.
+PPAPI_SHARED_EXPORT base::ListValue* CreateListValueFromVarVector(
+ const std::vector<PP_Var>& vars);
+
+// Calls CreateVarFromValue() on each element of |list_value| and puts them in
+// |vars|. The returned vars have had 1 ref added on behalf of the caller.
+//
+// The conversion fails and returns false if any of the calls to
+// CreateVarFromValue() fails. In that case, |vars| is untouched.
+PPAPI_SHARED_EXPORT bool CreateVarVectorFromListValue(
+ const base::ListValue& list_value, std::vector<PP_Var>* vars);
+
} // namespace ppapi
#endif // PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
« no previous file with comments | « ppapi/shared_impl/singleton_resource_id.h ('k') | ppapi/shared_impl/var_value_conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698