diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-07 06:49:00 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-07 06:49:00 +0000 |
commit | ddd61db54184ca4491521f8ce8f4e50a4ca5025f (patch) | |
tree | 5b39af5a2fc0910a9c33a7595432189ea716a9de /ppapi/c/dev | |
parent | d4067421c536731f986013afb0551dc0bcc164c9 (diff) | |
download | chromium_src-ddd61db54184ca4491521f8ce8f4e50a4ca5025f.zip chromium_src-ddd61db54184ca4491521f8ce8f4e50a4ca5025f.tar.gz chromium_src-ddd61db54184ca4491521f8ce8f4e50a4ca5025f.tar.bz2 |
Draft of a PPAPI interface for ArrayBuffer.
See the TypedArray spec for reference:
http://www.khronos.org/registry/typedarray/specs/latest/
Things in the spec that I'm omiting:
- slice (Having a view of the ArrayBuffer that has a different offset/length)
TODO in future CLs:
-Implementation for in-process/trusted + tests (almost ready)
-NaCl proxy
-OOP proxy
Later still:
- Support for ArrayBufferView and TypedArray based on that.
BUG=103435
TEST=N/A
Review URL: http://codereview.chromium.org/8502030
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113355 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c/dev')
-rw-r--r-- | ppapi/c/dev/ppb_var_array_buffer_dev.h | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/ppapi/c/dev/ppb_var_array_buffer_dev.h b/ppapi/c/dev/ppb_var_array_buffer_dev.h new file mode 100644 index 0000000..49d9e6a --- /dev/null +++ b/ppapi/c/dev/ppb_var_array_buffer_dev.h @@ -0,0 +1,67 @@ +/* Copyright (c) 2011 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. + */ + +/* From dev/ppb_var_array_buffer_dev.idl modified Fri Dec 2 16:17:08 2011. */ + +#ifndef PPAPI_C_DEV_PPB_VAR_ARRAY_BUFFER_DEV_H_ +#define PPAPI_C_DEV_PPB_VAR_ARRAY_BUFFER_DEV_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_VAR_ARRAY_BUFFER_DEV_INTERFACE_0_1 "PPB_VarArrayBuffer(Dev);0.1" +#define PPB_VAR_ARRAY_BUFFER_DEV_INTERFACE \ + PPB_VAR_ARRAY_BUFFER_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the <code>PPB_VarArrayBuffer_Dev</code> struct. + */ + + +/** + * @addtogroup Interfaces + * @{ + */ +/** + * PPB_VarArrayBuffer_Dev API. This provides a way to interact with JavaScript + * ArrayBuffers, which represent a contiguous sequence of bytes. To manage the + * reference count for a VarArrayBuffer, please see PPB_Var. Note that + * these Vars are not part of the embedding page's DOM, and can only be shared + * with JavaScript via pp::Instance's PostMessage and HandleMessage functions. + */ +struct PPB_VarArrayBuffer_Dev { + /** + * Create a zero-initialized VarArrayBuffer. + * + * @param[in] size_in_bytes The size of the array buffer that will be created. + * + * @return A PP_Var which represents an VarArrayBuffer of the requested size + * with a reference count of 1. + */ + struct PP_Var (*Create)(uint32_t size_in_bytes); + /** + * Returns the length of the VarArrayBuffer in bytes. + * + * @return The length of the VarArrayBuffer in bytes. + */ + uint32_t (*ByteLength)(struct PP_Var array); + /** + * Returns a pointer to the beginning of the buffer for the given array. + * + * @param[in] array The array whose buffer should be returned. + * + * @return A pointer to the buffer for this array. + */ + void* (*Map)(struct PP_Var array); +}; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_VAR_ARRAY_BUFFER_DEV_H_ */ + |