Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(233)

Side by Side Diff: ppapi/api/dev/ppb_var_array_buffer_dev.idl

Issue 9169052: Tweaks to PPB_VarArrayBuffer in preperation for taking out of Dev. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes based on review comments Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | ppapi/c/dev/ppb_var_array_buffer_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 */ 4 */
5 5
6 /** 6 /**
7 * This file defines the <code>PPB_VarArrayBuffer_Dev</code> struct. 7 * This file defines the <code>PPB_VarArrayBuffer_Dev</code> struct.
8 */ 8 */
9 9
10 label Chrome { 10 label Chrome {
11 M17 = 0.1 11 M18 = 0.2
12 }; 12 };
13 13
14 /** 14 /**
15 * PPB_VarArrayBuffer_Dev API. This provides a way to interact with JavaScript 15 * PPB_VarArrayBuffer_Dev API. This provides a way to interact with JavaScript
16 * ArrayBuffers, which represent a contiguous sequence of bytes. To manage the 16 * ArrayBuffers, which represent a contiguous sequence of bytes. To manage the
17 * reference count for a VarArrayBuffer, please see PPB_Var. Note that 17 * reference count for a VarArrayBuffer, please see PPB_Var. Note that
18 * these Vars are not part of the embedding page's DOM, and can only be shared 18 * these Vars are not part of the embedding page's DOM, and can only be shared
19 * with JavaScript via pp::Instance's PostMessage and HandleMessage functions. 19 * with JavaScript via pp::Instance's PostMessage and HandleMessage functions.
20 */ 20 */
21 [macro="PPB_VAR_ARRAY_BUFFER_DEV_INTERFACE"] 21 [macro="PPB_VAR_ARRAY_BUFFER_DEV_INTERFACE"]
22 interface PPB_VarArrayBuffer_Dev { 22 interface PPB_VarArrayBuffer_Dev {
23 /** 23 /**
24 * Create a zero-initialized VarArrayBuffer. 24 * Create a zero-initialized VarArrayBuffer.
25 * 25 *
26 * @param[in] size_in_bytes The size of the array buffer that will be created. 26 * @param[in] size_in_bytes The size of the ArrayBuffer that will be created.
27 * 27 *
28 * @return A PP_Var which represents an VarArrayBuffer of the requested size 28 * @return A PP_Var which represents an VarArrayBuffer of the requested size
29 * with a reference count of 1. 29 * with a reference count of 1.
30 */ 30 */
31 PP_Var Create([in] uint32_t size_in_bytes); 31 PP_Var Create([in] uint32_t size_in_bytes);
32
32 /** 33 /**
33 * Returns the length of the VarArrayBuffer in bytes. 34 * Retrieves the length of the VarArrayBuffer in bytes. On success,
darin (slow to review) 2012/01/26 05:01:44 In a previous version, you had it so that ByteLeng
dmichael (off chromium) 2012/01/26 05:43:39 That was a brief moment of insanity; the patch did
35 * byte_length is set to the length of the given ArrayBuffer var. On failure,
36 * byte_length is unchanged (this could happen, for instance, if the given
37 * PP_Var is not of type PP_VARTYPE_ARRAY_BUFFER).
34 * 38 *
35 * @return The length of the VarArrayBuffer in bytes. 39 * @param[in] array The ArrayBuffer whose length should be returned.
40 *
41 * @param[out] byte_length A variable which is set to the length of the given
42 * ArrayBuffer on success.
43 *
44 * @return PP_TRUE on success, PP_FALSE on failure.
36 */ 45 */
37 uint32_t ByteLength([in] PP_Var array); 46 PP_Bool ByteLength([in] PP_Var array, [out] uint32_t byte_length);
47
38 /** 48 /**
39 * Returns a pointer to the beginning of the buffer for the given array. 49 * Maps the ArrayBuffer in to the module's address space and returns a pointer
50 * to the beginning of the buffer for the given ArrayBuffer PP_Var. Note that
51 * calling Map() can be a relatively expensive operation. Use care when
52 * calling it in performance-critical code. For example, you should call it
53 * only once when looping over an ArrayBuffer:
40 * 54 *
41 * @param[in] array The array whose buffer should be returned. 55 * <code>
56 * char* data = (char*)(array_buffer_if.Map(array_buffer_var));
57 * uint32_t byte_length = 0;
58 * PP_Bool ok = array_buffer_if.ByteLength(array_buffer_var, &byte_length);
59 * if (!ok)
60 * return DoSomethingBecauseMyVarIsNotAnArrayBuffer();
61 * for (uint32_t i = 0; i < byte_length; ++i)
62 * data[i] = 'A';
63 * </code>
42 * 64 *
43 * @return A pointer to the buffer for this array. 65 * @param[in] array The ArrayBuffer whose internal buffer should be returned.
66 *
67 * @return A pointer to the internal buffer for this ArrayBuffer. Returns NULL
68 * if the given PP_Var is not of type PP_VARTYPE_ARRAY_BUFFER.
44 */ 69 */
45 mem_t Map([in] PP_Var array); 70 mem_t Map([in] PP_Var array);
71
72 /**
73 * Unmaps the given ArrayBuffer var from the module address space. Use this if
74 * you want to save memory but might want to Map the buffer again later. The
75 * PP_Var remains valid and should still be released using PPB_Var when you
76 * are done with the ArrayBuffer.
77 *
78 * @param[in] array The ArrayBuffer which should be released.
79 */
80 void Unmap([in] PP_Var array);
46 }; 81 };
47 82
OLDNEW
« no previous file with comments | « no previous file | ppapi/c/dev/ppb_var_array_buffer_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698