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

Side by Side 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: sync 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/shared_impl/var_tracker.cc ('k') | ppapi/shared_impl/var_value_conversions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
6 #define PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
7
8 #include "ppapi/c/pp_var.h"
9 #include "ppapi/shared_impl/ppapi_shared_export.h"
10
11 namespace base {
12 class Value;
13 }
14
15 namespace ppapi {
16
17 // Converts a PP_Var to a base::Value object. The caller takes ownership of the
18 // returned object.
19 //
20 // Both PP_VARTYPE_UNDEFINED and PP_VARTYPE_NULL are converted to
21 // base::Value::TYPE_NULL. In dictionary vars, key-value pairs whose value is
22 // undefined (PP_VARTYPE_UNDEFINED) are ignored. If a node in |var| appears more
23 // than once, it is duplicated in the result. For example, if |var| is an array
24 // and it has two elements pointing to the same dictionary, the resulting list
25 // value will have two copies of the dictionary.
26 //
27 // The conversion fails and returns NULL if
28 // - |var| is object (PP_VARTYPE_OBJECT); or
29 // - |var| is an array or dictionary, and calling CreateValueFromVar() on any of
30 // the array elements or dictionary values fails; or
31 // - there exist circular references, i.e., an array or dictionary is its own
32 // ancestor/descendant.
33 PPAPI_SHARED_EXPORT base::Value* CreateValueFromVar(const PP_Var& var);
34
35 // The returned var has been added ref on behalf of the caller.
36 // Returns an undefined var if the conversion fails.
37 PPAPI_SHARED_EXPORT PP_Var CreateVarFromValue(const base::Value& value);
38
39 } // namespace ppapi
40
41 #endif // PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_
OLDNEW
« no previous file with comments | « ppapi/shared_impl/var_tracker.cc ('k') | ppapi/shared_impl/var_value_conversions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698