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

Unified Diff: ppapi/shared_impl/var_value_conversions.h

Issue 12387073: Add PPB_VarDictionary_Dev support - part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use correct base branch. Created 7 years, 10 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
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
new file mode 100644
index 0000000000000000000000000000000000000000..626f6602fc7637e5feddce2f826947a077b661fa
--- /dev/null
+++ b/ppapi/shared_impl/var_value_conversions.h
@@ -0,0 +1,34 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
+#define PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
+
+#include "ppapi/c/pp_var.h"
+#include "ppapi/shared_impl/ppapi_shared_export.h"
+
+namespace base {
+class Value;
+}
+
+namespace ppapi {
+
+// The caller takes ownership of the returned object.
+//
+// The conversion fails and returns NULL if
+// - |var| is undefined (PP_VARTYPE_UNDEFINED), or object (PP_VARTYPE_OBJECT);
+// or
+// - |var| is an array or dictionary, and calling CreateValueFromVar() on any of
+// the array elements or dictionary values fails; or
+// - there exist circular references, i.e., an array or dictionary is its own
+// ancestor/descendant.
+PPAPI_SHARED_EXPORT base::Value* CreateValueFromVar(const PP_Var& var);
dmichael (off chromium) 2013/03/05 22:01:03 did you consider using scoped_ptr for the return t
yzshen1 2013/03/14 05:38:21 I think that it is consistent with things such as
dmichael (off chromium) 2013/03/15 17:35:48 Sure, consistency is worthwhile. sgtm
+
+// The returned var has been added ref on behalf of the caller.
+// Returns an undefined var if the conversion fails.
+PPAPI_SHARED_EXPORT PP_Var CreateVarFromValue(const base::Value& value);
+
+} // namespace ppapi
+
+#endif // PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_

Powered by Google App Engine
This is Rietveld 408576698