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/* From dev/ppb_buffer_dev.idl modified Wed Oct 5 14:06:02 2011. */ 7 8#ifndef PPAPI_C_DEV_PPB_BUFFER_DEV_H_ 9#define PPAPI_C_DEV_PPB_BUFFER_DEV_H_ 10 11#include "ppapi/c/pp_bool.h" 12#include "ppapi/c/pp_instance.h" 13#include "ppapi/c/pp_macros.h" 14#include "ppapi/c/pp_resource.h" 15#include "ppapi/c/pp_stdint.h" 16 17#define PPB_BUFFER_DEV_INTERFACE_0_4 "PPB_Buffer(Dev);0.4" 18#define PPB_BUFFER_DEV_INTERFACE PPB_BUFFER_DEV_INTERFACE_0_4 19 20/** 21 * @file 22 * This file defines the <code>PPB_Buffer_Dev</code> interface. 23 */ 24 25 26/** 27 * @addtogroup Interfaces 28 * @{ 29 */ 30struct PPB_Buffer_Dev_0_4 { 31 /** 32 * Allocates a buffer of the given size in bytes. The return value will have 33 * a non-zero ID on success, or zero on failure. Failure means the module 34 * handle was invalid. The buffer will be initialized to contain zeroes. 35 */ 36 PP_Resource (*Create)(PP_Instance instance, uint32_t size_in_bytes); 37 /** 38 * Returns PP_TRUE if the given resource is a Buffer. Returns PP_FALSE if the 39 * resource is invalid or some type other than a Buffer. 40 */ 41 PP_Bool (*IsBuffer)(PP_Resource resource); 42 /** 43 * Gets the size of the buffer. Returns PP_TRUE on success, PP_FALSE 44 * if the resource is not a buffer. On failure, |*size_in_bytes| is not set. 45 */ 46 PP_Bool (*Describe)(PP_Resource resource, uint32_t* size_in_bytes); 47 /** 48 * Maps this buffer into the plugin address space and returns a pointer to 49 * the beginning of the data. 50 */ 51 void* (*Map)(PP_Resource resource); 52 /** 53 * Unmaps this buffer. 54 */ 55 void (*Unmap)(PP_Resource resource); 56}; 57 58typedef struct PPB_Buffer_Dev_0_4 PPB_Buffer_Dev; 59/** 60 * @} 61 */ 62 63#endif /* PPAPI_C_DEV_PPB_BUFFER_DEV_H_ */ 64 65