Home | History | Annotate | Download | only in dev
      1 /* Copyright (c) 2012 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 
      6 /**
      7  * This file defines the <code>PPB_ResourceArray_Dev</code> interface.
      8  */
      9 
     10 [generate_thunk]
     11 
     12 label Chrome {
     13   M18 = 0.1
     14 };
     15 
     16 /**
     17  * A resource array holds a list of resources and retains a reference to each of
     18  * them.
     19  */
     20 interface PPB_ResourceArray_Dev {
     21   /**
     22    * Creates a resource array.
     23    * Note: It will add a reference to each of the elements.
     24    *
     25    * @param[in] elements <code>PP_Resource</code>s to be stored in the created
     26    * resource array.
     27    * @param[in] size The number of elements.
     28    *
     29    * @return A <code>PP_Resource</code> corresponding to a resource array if
     30    * successful; 0 if failed.
     31    */
     32   PP_Resource Create([in] PP_Instance instance,
     33                      [in, size_as=size] PP_Resource[] elements,
     34                      [in] uint32_t size);
     35 
     36   /**
     37    * Determines if the provided resource is a resource array.
     38    *
     39    * @param[in] resource A <code>PP_Resource</code> corresponding to a generic
     40    * resource.
     41    *
     42    * @return A <code>PP_Bool</code> that is <code>PP_TRUE</code> if the given
     43    * resource is a resource array, otherwise <code>PP_FALSE</code>.
     44    */
     45   PP_Bool IsResourceArray([in] PP_Resource resource);
     46 
     47   /**
     48    * Gets the array size.
     49    *
     50    * @param[in] resource_array The resource array.
     51    *
     52    * @return How many elements are there in the array.
     53    */
     54   uint32_t GetSize([in] PP_Resource resource_array);
     55 
     56   /**
     57    * Gets the element at the specified position.
     58    * Note: It doesn't add a reference to the returned resource for the caller.
     59    *
     60    * @param[in] resource_array The resource array.
     61    * @param[in] index An integer indicating a position in the array.
     62    *
     63    * @return A <code>PP_Resource</code>. Returns 0 if the index is out of range.
     64    */
     65   PP_Resource GetAt(
     66       [in] PP_Resource resource_array,
     67       [in] uint32_t index);
     68 };
     69