Fix race condition in WebstoreInstallHelper.
[chromium-blink-merge.git] / ppapi / c / ppb_var_array.h
blob615e4590b698acfa1c56dbdb65ecae42f4f80853
1 /* Copyright 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 */
6 /* From ppb_var_array.idl modified Sun Jun 16 15:37:27 2013. */
8 #ifndef PPAPI_C_PPB_VAR_ARRAY_H_
9 #define PPAPI_C_PPB_VAR_ARRAY_H_
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_stdint.h"
14 #include "ppapi/c/pp_var.h"
16 #define PPB_VAR_ARRAY_INTERFACE_1_0 "PPB_VarArray;1.0"
17 #define PPB_VAR_ARRAY_INTERFACE PPB_VAR_ARRAY_INTERFACE_1_0
19 /**
20 * @file
21 * This file defines the <code>PPB_VarArray</code> struct providing
22 * a way to interact with array vars.
26 /**
27 * @addtogroup Interfaces
28 * @{
30 struct PPB_VarArray_1_0 {
31 /**
32 * Creates an array var, i.e., a <code>PP_Var</code> with type set to
33 * <code>PP_VARTYPE_ARRAY</code>. The array length is set to 0.
35 * @return An empty array var, whose reference count is set to 1 on behalf of
36 * the caller.
38 struct PP_Var (*Create)(void);
39 /**
40 * Gets an element from the array.
42 * @param[in] array An array var.
43 * @param[in] index An index indicating which element to return.
45 * @return The element at the specified position. The reference count of the
46 * element returned is incremented on behalf of the caller. If
47 * <code>index</code> is larger than or equal to the array length, an
48 * undefined var is returned.
50 struct PP_Var (*Get)(struct PP_Var array, uint32_t index);
51 /**
52 * Sets the value of an element in the array.
54 * @param[in] array An array var.
55 * @param[in] index An index indicating which element to modify. If
56 * <code>index</code> is larger than or equal to the array length, the length
57 * is updated to be <code>index</code> + 1. Any position in the array that
58 * hasn't been set before is set to undefined, i.e., <code>PP_Var</code> of
59 * type <code>PP_VARTYPE_UNDEFINED</code>.
60 * @param[in] value The value to set. The array holds a reference to it on
61 * success.
63 * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
65 PP_Bool (*Set)(struct PP_Var array, uint32_t index, struct PP_Var value);
66 /**
67 * Gets the array length.
69 * @param[in] array An array var.
71 * @return The array length.
73 uint32_t (*GetLength)(struct PP_Var array);
74 /**
75 * Sets the array length.
77 * @param[in] array An array var.
78 * @param[in] length The new array length. If <code>length</code> is smaller
79 * than its current value, the array is truncated to the new length; any
80 * elements that no longer fit are removed and the references to them will be
81 * released. If <code>length</code> is larger than its current value,
82 * undefined vars are appended to increase the array to the specified length.
84 * @return A <code>PP_Bool</code> indicating whether the operation succeeds.
86 PP_Bool (*SetLength)(struct PP_Var array, uint32_t length);
89 typedef struct PPB_VarArray_1_0 PPB_VarArray;
90 /**
91 * @}
94 #endif /* PPAPI_C_PPB_VAR_ARRAY_H_ */