diff options
author | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-23 01:49:43 +0000 |
---|---|---|
committer | bbudge@chromium.org <bbudge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-23 01:49:43 +0000 |
commit | 452fb1414f6efba42085b6f448f892a63f02fbe5 (patch) | |
tree | b1dc76173743a0cb7f0f065d9dd03b22912daf99 /ppapi/api | |
parent | 6548b66b64fb2d46d64e468f9bed0912236bfde0 (diff) | |
download | chromium_src-452fb1414f6efba42085b6f448f892a63f02fbe5.zip chromium_src-452fb1414f6efba42085b6f448f892a63f02fbe5.tar.gz chromium_src-452fb1414f6efba42085b6f448f892a63f02fbe5.tar.bz2 |
Avoid memory allocation for PPB_FileIO Read when callback is blocking.
Performs file read directly into caller's buffer.
BUG=194304
Review URL: https://codereview.chromium.org/27730003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@230282 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/api')
-rw-r--r-- | ppapi/api/pp_array_output.idl | 9 | ||||
-rw-r--r-- | ppapi/api/ppb_file_io.idl | 12 |
2 files changed, 15 insertions, 6 deletions
diff --git a/ppapi/api/pp_array_output.idl b/ppapi/api/pp_array_output.idl index be1aca7..8e04a4c 100644 --- a/ppapi/api/pp_array_output.idl +++ b/ppapi/api/pp_array_output.idl @@ -9,7 +9,7 @@ * * This function will be called reentrantly. This means that if you call a * function PPB_Foo.GetData(&array_output), GetData will call your - * GetDataBuffer function before it returns. + * GetDataBuffer function before it returns. * * This function will be called even when returning 0-length arrays, so be sure * your implementation can support that. You can return NULL for 0 length @@ -34,7 +34,10 @@ * @param element_size The size of each element in bytes. * * @return Returns a pointer to the allocated memory. On failure, returns null. - * You can also return null if the element_count is 0. + * You can also return null if the element_count is 0. When a non-null value is + * returned, the buffer must remain valid until after the callback runs. If used + * with a blocking callback, the buffer must remain valid until after the + * function returns. The plugin can then free any memory that it allocated. */ typedef mem_t PP_ArrayOutput_GetDataBuffer([inout] mem_t user_data, [in] uint32_t element_count, @@ -78,7 +81,7 @@ typedef mem_t PP_ArrayOutput_GetDataBuffer([inout] mem_t user_data, [passByValue] struct PP_ArrayOutput { /** - * A pointer to the allocation function that the browser implements. + * A pointer to the allocation function that the browser will call. */ PP_ArrayOutput_GetDataBuffer GetDataBuffer; diff --git a/ppapi/api/ppb_file_io.idl b/ppapi/api/ppb_file_io.idl index 2e43ec5..9b8c9e2 100644 --- a/ppapi/api/ppb_file_io.idl +++ b/ppapi/api/ppb_file_io.idl @@ -121,7 +121,9 @@ interface PPB_FileIO { * @param[out] info The <code>PP_FileInfo</code> structure representing all * information about the file. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Query(). + * completion of Query(). <code>info</code> must remain valid until after the + * callback runs. If you pass a blocking callback, <code>info</code> must + * remain valid until after Query() returns. * * @return An int32_t containing an error code from <code>pp_errors.h</code>. * PP_ERROR_FAILED will be returned if the file isn't opened, and @@ -158,6 +160,7 @@ interface PPB_FileIO { * large enough to hold the specified number of bytes to read. This function * might perform a partial read, meaning all the requested bytes * might not be returned, even if the end of the file has not been reached. + * The FileIO object must have been opened with read access. * * ReadToArray() is preferred to Read() when doing asynchronous operations. * @@ -168,7 +171,9 @@ interface PPB_FileIO { * @param[in] bytes_to_read The number of bytes to read from * <code>offset</code>. * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon - * completion of Read(). + * completion of Read(). <code>buffer</code> must remain valid until after + * the callback runs. If you pass a blocking callback, <code>buffer</code> + * must remain valid until after Read() returns. * * @return The number of bytes read or an error code from * <code>pp_errors.h</code>. If the return value is 0, then end-of-file was @@ -260,7 +265,8 @@ interface PPB_FileIO { /** * ReadToArray() reads from an offset in the file. A PP_ArrayOutput must be * provided so that output will be stored in its allocated buffer. This - * function might perform a partial read. + * function might perform a partial read. The FileIO object must have been + * opened with read access. * * @param[in] file_io A <code>PP_Resource</code> corresponding to a file * FileIO. |