Index: mojo/public/js/core.js |
diff --git a/mojo/public/js/core.js b/mojo/public/js/core.js |
index b89a9560ea349a1aeb860eb7ac12960791b269c8..c2331acf077ff3ea100aced3218e5769f258a030 100644 |
--- a/mojo/public/js/core.js |
+++ b/mojo/public/js/core.js |
@@ -114,6 +114,27 @@ var READ_DATA_FLAG_QUERY; |
var READ_DATA_FLAG_PEEK; |
/** |
+ * MojoCreateSharedBufferOptionsFlags: Used to specify options to |
+ * |createSharedBuffer()|. |
+ * See core.h for more information. |
+ */ |
+var CREATE_SHARED_BUFFER_OPTIONS_FLAG_NONE; |
+ |
+/** |
+ * MojoDuplicateBufferHandleOptionsFlags: Used to specify options to |
+ * |duplicateSharedBufferHandle()|. |
+ * See core.h for more information. |
+ */ |
+var DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_NONE; |
+var DUPLICATE_BUFFER_HANDLE_OPTIONS_FLAG_READ_ONLY; |
+ |
+/** |
+ * MojoMapBufferFlags: Used to specify options to |mapBuffer()|. |
+ * See core.h for more information. |
+ */ |
+var MAP_BUFFER_FLAG_NONE; |
+ |
+/** |
* Closes the given |handle|. See MojoClose for more info. |
* @param {MojoHandle} Handle to close. |
* @return {MojoResult} Result code. |
@@ -236,3 +257,53 @@ function readData(handle, flags) { [native code] } |
* @return true or false |
*/ |
function isHandle(value) { [native code] } |
+ |
+/** |
+ * TODO(shalamov): add documentation |
+ * |
+ * @param {MojoCreateSharedBufferOptionsFlags} flags Flags. |
+ * @param {number} num_bytes Size of the memory to be allocated for shared |
+ * buffer. |
+ * @return {object} An object of the form { |
+ * result, // |RESULT_OK| on success, error code otherwise. |
+ * handle, // An MojoHandle for shared buffer (only on success). |
+ * } |
+ */ |
+function createSharedBuffer(flags, num_bytes) { [native code] } |
+ |
+/** |
+ * TODO(shalamov): add documentation |
+ * |
+ * @param {MojoHandle} handle MojoHandle. |
+ * @param {MojoCreateSharedBufferOptionsFlags} flags Flags. |
+ * @return {object} An object of the form { |
+ * result, // |RESULT_OK| on success, error code otherwise. |
+ * handle, // A duplicated MojoHandle for shared buffer (only on success). |
+ * } |
+ */ |
+function duplicateSharedBufferHandle(buffer_handle, flags) { [native code] } |
+ |
+/** |
+ * Maps the part (at offset |offset| of length |num_bytes|) of the buffer given |
+ * by |buffer_handle| into ArrayBuffer memory |buffer|, with options specified |
+ * by |flags|. |
+ * |
+ * @param {MojoHandle} buffer_handle A sharedBufferHandle returned by |
+ * createSharedBuffer. |
+ * @param {number} offset Offset. |
+ * @param {number} num_bytes Size of the memory to be mapped. |
+ * @param {MojoMapBufferFlags} flags Flags. |
+ * @return {object} An object of the form { |
+ * result, // |RESULT_OK| on success, error code otherwise. |
+ * buffer, // An ArrayBuffer (only on success). |
+ * } |
+ */ |
+function mapBuffer(buffer_handle, offset, num_bytes, flags) { [native code] } |
+ |
+/** |
+ * TODO(shalamov): add documentation |
+ * |
+ * @param {ArrayBuffer} buffer ArrayBuffer. |
+ * @return {MojoResult} Result code. |
+ */ |
+function unmapBuffer(buffer) { [native code] } |