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_Buffer_Dev</code> interface.
8 */
9
10label Chrome {
11  M14 = 0.4
12};
13
14interface PPB_Buffer_Dev {
15  /**
16   * Allocates a buffer of the given size in bytes. The return value will have
17   * a non-zero ID on success, or zero on failure. Failure means the module
18   * handle was invalid. The buffer will be initialized to contain zeroes.
19   */
20  PP_Resource Create(
21      [in] PP_Instance instance,
22      [in] uint32_t size_in_bytes);
23
24  /**
25   * Returns PP_TRUE if the given resource is a Buffer. Returns PP_FALSE if the
26   * resource is invalid or some type other than a Buffer.
27   */
28  PP_Bool IsBuffer(
29      [in] PP_Resource resource);
30
31  /**
32   * Gets the size of the buffer. Returns PP_TRUE on success, PP_FALSE
33   * if the resource is not a buffer. On failure, |*size_in_bytes| is not set.
34   */
35  PP_Bool Describe(
36      [in] PP_Resource resource,
37      [out] uint32_t size_in_bytes);
38
39  /**
40   * Maps this buffer into the plugin address space and returns a pointer to
41   * the beginning of the data.
42   */
43  mem_t Map(
44      [in] PP_Resource resource);
45
46  /**
47   * Unmaps this buffer.
48   */
49  void Unmap(
50      [in] PP_Resource resource);
51};
52