OLD | NEW |
---|---|
(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 // The caller takes ownership of the returned object. | |
18 // | |
19 // The conversion fails and returns NULL if | |
20 // - |var| is undefined (PP_VARTYPE_UNDEFINED), or object (PP_VARTYPE_OBJECT); | |
21 // or | |
22 // - |var| is an array or dictionary, and calling CreateValueFromVar() on any of | |
23 // the array elements or dictionary values fails; or | |
24 // - there exist circular references, i.e., an array or dictionary is its own | |
25 // ancestor/descendant. | |
26 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
| |
27 | |
28 // The returned var has been added ref on behalf of the caller. | |
29 // Returns an undefined var if the conversion fails. | |
30 PPAPI_SHARED_EXPORT PP_Var CreateVarFromValue(const base::Value& value); | |
31 | |
32 } // namespace ppapi | |
33 | |
34 #endif // PPAPI_SHARED_IMPL_VAR_VALUE_CONVERSIONS_H_ | |
OLD | NEW |