OLD | NEW |
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /** | 6 /** |
7 * This file defines the <code>PPB_VarDictionary_Dev</code> struct providing | 7 * This file defines the <code>PPB_VarDictionary</code> struct providing |
8 * a way to interact with dictionary vars. | 8 * a way to interact with dictionary vars. |
9 */ | 9 */ |
10 | 10 |
11 label Chrome { | 11 label Chrome { |
12 M27 = 0.1 | 12 M29 = 1.0 |
13 }; | 13 }; |
14 | 14 |
15 /** | 15 /** |
16 * A dictionary var contains key-value pairs with unique keys. The keys are | 16 * A dictionary var contains key-value pairs with unique keys. The keys are |
17 * strings while the values can be arbitrary vars. Key comparison is always | 17 * strings while the values can be arbitrary vars. Key comparison is always |
18 * done by value instead of by reference. | 18 * done by value instead of by reference. |
19 */ | 19 */ |
20 [macro="PPB_VAR_DICTIONARY_DEV_INTERFACE"] | 20 [macro="PPB_VAR_DICTIONARY_INTERFACE"] |
21 interface PPB_VarDictionary_Dev { | 21 interface PPB_VarDictionary { |
22 /** | 22 /** |
23 * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to | 23 * Creates a dictionary var, i.e., a <code>PP_Var</code> with type set to |
24 * <code>PP_VARTYPE_DICTIONARY</code>. | 24 * <code>PP_VARTYPE_DICTIONARY</code>. |
25 * | 25 * |
26 * @return An empty dictionary var, whose reference count is set to 1 on | 26 * @return An empty dictionary var, whose reference count is set to 1 on |
27 * behalf of the caller. | 27 * behalf of the caller. |
28 */ | 28 */ |
29 PP_Var Create(); | 29 PP_Var Create(); |
30 | 30 |
31 /** | 31 /** |
32 * Gets the value associated with the specified key. | 32 * Gets the value associated with the specified key. |
33 * | 33 * |
34 * @param[in] dict A dictionary var. | 34 * @param[in] dict A dictionary var. |
35 * @param[in] key A string var. | 35 * @param[in] key A string var. |
36 * | 36 * |
37 * @return The value that is associated with <code>key</code>. The reference | 37 * @return The value that is associated with <code>key</code>. The reference |
38 * count is incremented on behalf of the caller. If <code>key</code> is not a | 38 * count of the element returned is incremented on behalf of the caller. If |
39 * string var, or it doesn't exist in <code>dict</code>, an undefined var is | 39 * <code>key</code> is not a string var, or it doesn't exist in |
40 * returned. | 40 * <code>dict</code>, an undefined var is returned. |
41 */ | 41 */ |
42 PP_Var Get([in] PP_Var dict, [in] PP_Var key); | 42 PP_Var Get([in] PP_Var dict, [in] PP_Var key); |
43 | 43 |
44 /** | 44 /** |
45 * Sets the value associated with the specified key. The dictionary is | 45 * Sets the value associated with the specified key. |
46 * responsible for holding references to its children to keep them alive. | |
47 * | 46 * |
48 * @param[in] dict A dictionary var. | 47 * @param[in] dict A dictionary var. |
49 * @param[in] key A string var. If this key hasn't existed in | 48 * @param[in] key A string var. If this key hasn't existed in |
50 * <code>dict</code>, it is added and associated with <code>value</code>; | 49 * <code>dict</code>, it is added and associated with <code>value</code>; |
51 * otherwise, the previous value is replaced with <code>value</code>. | 50 * otherwise, the previous value is replaced with <code>value</code>. |
52 * @param[in] value The value to set. | 51 * @param[in] value The value to set. The dictionary holds a reference to it |
| 52 * on success. |
53 * | 53 * |
54 * @return A <code>PP_Bool</code> indicating whether the operation succeeds. | 54 * @return A <code>PP_Bool</code> indicating whether the operation succeeds. |
55 */ | 55 */ |
56 PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value); | 56 PP_Bool Set([in] PP_Var dict, [in] PP_Var key, [in] PP_Var value); |
57 | 57 |
58 /** | 58 /** |
59 * Deletes the specified key and its associated value, if the key exists. | 59 * Deletes the specified key and its associated value, if the key exists. The |
| 60 * reference to the element will be released. |
60 * | 61 * |
61 * @param[in] dict A dictionary var. | 62 * @param[in] dict A dictionary var. |
62 * @param[in] key A string var. | 63 * @param[in] key A string var. |
63 */ | 64 */ |
64 void Delete([in] PP_Var dict, [in] PP_Var key); | 65 void Delete([in] PP_Var dict, [in] PP_Var key); |
65 | 66 |
66 /** | 67 /** |
67 * Checks whether a key exists. | 68 * Checks whether a key exists. |
68 * | 69 * |
69 * @param[in] dict A dictionary var. | 70 * @param[in] dict A dictionary var. |
(...skipping 10 matching lines...) Expand all Loading... |
80 * be different). | 81 * be different). |
81 * | 82 * |
82 * @param[in] dict A dictionary var. | 83 * @param[in] dict A dictionary var. |
83 * | 84 * |
84 * @return An array var which contains all the keys of <code>dict</code>. Its | 85 * @return An array var which contains all the keys of <code>dict</code>. Its |
85 * reference count is incremented on behalf of the caller. The elements are | 86 * reference count is incremented on behalf of the caller. The elements are |
86 * string vars. Returns a null var if failed. | 87 * string vars. Returns a null var if failed. |
87 */ | 88 */ |
88 PP_Var GetKeys([in] PP_Var dict); | 89 PP_Var GetKeys([in] PP_Var dict); |
89 }; | 90 }; |
OLD | NEW |