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

Side by Side Diff: mojo/public/js/core.js

Issue 2250183003: Make the fuchsia mojo/public repo the source of truth. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 4 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
« no previous file with comments | « mojo/public/js/constants.cc ('k') | mojo/public/js/core_unittests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 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 // Module "mojo/public/js/core"
6 //
7 // Note: This file is for documentation purposes only. The code here is not
8 // actually executed. The real module is implemented natively in Mojo.
9 //
10 // This module provides the JavaScript bindings for
11 // mojo/public/c/include/mojo/system/*.h. Refer to those files for more detailed
12 // documentation for equivalent methods.
13
14 while (1);
15
16 /**
17 * MojoHandle: An opaque handles to a Mojo object (e.g. a message pipe).
18 */
19 var kInvalidHandle;
20
21 /**
22 * MojoResult {number}: Result codes for Mojo operations.
23 * See core.h for more information.
24 */
25 var RESULT_OK;
26 var RESULT_CANCELLED;
27 var RESULT_UNKNOWN;
28 var RESULT_INVALID_ARGUMENT;
29 var RESULT_DEADLINE_EXCEEDED;
30 var RESULT_NOT_FOUND;
31 var RESULT_ALREADY_EXISTS;
32 var RESULT_PERMISSION_DENIED;
33 var RESULT_RESOURCE_EXHAUSTED;
34 var RESULT_FAILED_PRECONDITION;
35 var RESULT_ABORTED;
36 var RESULT_OUT_OF_RANGE;
37 var RESULT_UNIMPLEMENTED;
38 var RESULT_INTERNAL;
39 var RESULT_UNAVAILABLE;
40 var RESULT_DATA_LOSS;
41 var RESULT_BUSY;
42 var RESULT_SHOULD_WAIT;
43
44 /**
45 * MojoDeadline {number}: Used to specify deadlines (timeouts), in microseconds.
46 * See core.h for more information.
47 */
48 var DEADLINE_INDEFINITE;
49
50 /**
51 * MojoHandleSignals: Used to specify signals that can be waited on for a handle
52 *(and which can be triggered), e.g., the ability to read or write to
53 * the handle.
54 * See core.h for more information.
55 */
56 var HANDLE_SIGNAL_NONE;
57 var HANDLE_SIGNAL_READABLE;
58 var HANDLE_SIGNAL_WRITABLE;
59 var HANDLE_SIGNAL_PEER_CLOSED;
60
61 /**
62 * MojoCreateDataMessageOptions: Used to specify creation parameters for a data
63 * pipe to |createDataMessage()|.
64 * See core.h for more information.
65 */
66 dictionary MojoCreateDataMessageOptions {
67 MojoCreateDataMessageOptionsFlags flags; // See below.
68 };
69
70 // MojoCreateDataMessageOptionsFlags
71 var CREATE_MESSAGE_PIPE_OPTIONS_FLAG_NONE;
72
73 /*
74 * MojoWriteMessageFlags: Used to specify different modes to |writeMessage()|.
75 * See core.h for more information.
76 */
77 var WRITE_MESSAGE_FLAG_NONE;
78
79 /**
80 * MojoReadMessageFlags: Used to specify different modes to |readMessage()|.
81 * See core.h for more information.
82 */
83 var READ_MESSAGE_FLAG_NONE;
84 var READ_MESSAGE_FLAG_MAY_DISCARD;
85
86 /**
87 * MojoCreateDataPipeOptions: Used to specify creation parameters for a data
88 * pipe to |createDataPipe()|.
89 * See core.h for more information.
90 */
91 dictionary MojoCreateDataPipeOptions {
92 MojoCreateDataPipeOptionsFlags flags; // See below.
93 int32 elementNumBytes; // The size of an element, in bytes.
94 int32 capacityNumBytes; // The capacity of the data pipe, in bytes.
95 };
96
97 // MojoCreateDataPipeOptionsFlags
98 var CREATE_DATA_PIPE_OPTIONS_FLAG_NONE;
99
100 /*
101 * MojoWriteDataFlags: Used to specify different modes to |writeData()|.
102 * See core.h for more information.
103 */
104 var WRITE_DATA_FLAG_NONE;
105 var WRITE_DATA_FLAG_ALL_OR_NONE;
106
107 /**
108 * MojoReadDataFlags: Used to specify different modes to |readData()|.
109 * See core.h for more information.
110 */
111 var READ_DATA_FLAG_NONE;
112 var READ_DATA_FLAG_ALL_OR_NONE;
113 var READ_DATA_FLAG_DISCARD;
114 var READ_DATA_FLAG_QUERY;
115 var READ_DATA_FLAG_PEEK;
116
117 /**
118 * Closes the given |handle|. See MojoClose for more info.
119 * @param {MojoHandle} Handle to close.
120 * @return {MojoResult} Result code.
121 */
122 function close(handle) { [native code] }
123
124 /**
125 * Waits on the given handle until a signal indicated by |signals| is
126 * satisfied or until |deadline| is passed. See MojoWait for more information.
127 *
128 * @param {MojoHandle} handle Handle to wait on.
129 * @param {MojoHandleSignals} signals Specifies the condition to wait for.
130 * @param {MojoDeadline} deadline Stops waiting if this is reached.
131 * @return {MojoResult} Result code.
132 */
133 function wait(handle, signals, deadline) { [native code] }
134
135 /**
136 * Waits on |handles[0]|, ..., |handles[handles.length-1]| for at least one of
137 * them to satisfy the state indicated by |flags[0]|, ...,
138 * |flags[handles.length-1]|, respectively, or until |deadline| has passed.
139 * See MojoWaitMany for more information.
140 *
141 * @param {Array.MojoHandle} handles Handles to wait on.
142 * @param {Array.MojoHandleSignals} signals Specifies the condition to wait for,
143 * for each corresponding handle. Must be the same length as |handles|.
144 * @param {MojoDeadline} deadline Stops waiting if this is reached.
145 * @return {MojoResult} Result code.
146 */
147 function waitMany(handles, signals, deadline) { [native code] }
148
149 /**
150 * Creates a message pipe. This function always succeeds.
151 * See MojoCreateMessagePipe for more information on message pipes.
152 *
153 * @param {MojoCreateMessagePipeOptions} optionsDict Options to control the
154 * message pipe parameters. May be null.
155 * @return {MessagePipe} An object of the form {
156 * handle0,
157 * handle1,
158 * }
159 * where |handle0| and |handle1| are MojoHandles to each end of the channel.
160 */
161 function createMessagePipe(optionsDict) { [native code] }
162
163 /**
164 * Writes a message to the message pipe endpoint given by |handle|. See
165 * MojoWriteMessage for more information, including return codes.
166 *
167 * @param {MojoHandle} handle The endpoint to write to.
168 * @param {ArrayBufferView} buffer The message data. May be empty.
169 * @param {Array.MojoHandle} handlesArray Any handles to attach. Handles are
170 * transferred on success and will no longer be valid. May be empty.
171 * @param {MojoWriteMessageFlags} flags Flags.
172 * @return {MojoResult} Result code.
173 */
174 function writeMessage(handle, buffer, handlesArray, flags) { [native code] }
175
176 /**
177 * Reads a message from the message pipe endpoint given by |handle|. See
178 * MojoReadMessage for more information, including return codes.
179 *
180 * @param {MojoHandle} handle The endpoint to read from.
181 * @param {MojoReadMessageFlags} flags Flags.
182 * @return {object} An object of the form {
183 * result, // |RESULT_OK| on success, error code otherwise.
184 * buffer, // An ArrayBufferView of the message data (only on success).
185 * handles // An array of MojoHandles transferred, if any.
186 * }
187 */
188 function readMessage(handle, flags) { [native code] }
189
190 /**
191 * Creates a data pipe, which is a unidirectional communication channel for
192 * unframed data, with the given options. See MojoCreateDataPipe for more
193 * more information, including return codes.
194 *
195 * @param {MojoCreateDataPipeOptions} optionsDict Options to control the data
196 * pipe parameters. May be null.
197 * @return {object} An object of the form {
198 * result, // |RESULT_OK| on success, error code otherwise.
199 * producerHandle, // MojoHandle to use with writeData (only on success).
200 * consumerHandle, // MojoHandle to use with readData (only on success).
201 * }
202 */
203 function createDataPipe(optionsDict) { [native code] }
204
205 /**
206 * Writes the given data to the data pipe producer given by |handle|. See
207 * MojoWriteData for more information, including return codes.
208 *
209 * @param {MojoHandle} handle A producerHandle returned by createDataPipe.
210 * @param {ArrayBufferView} buffer The data to write.
211 * @param {MojoWriteDataFlags} flags Flags.
212 * @return {object} An object of the form {
213 * result, // |RESULT_OK| on success, error code otherwise.
214 * numBytes, // The number of bytes written.
215 * }
216 */
217 function writeData(handle, buffer, flags) { [native code] }
218
219 /**
220 * Reads data from the data pipe consumer given by |handle|. May also
221 * be used to discard data. See MojoReadData for more information, including
222 * return codes.
223 *
224 * @param {MojoHandle} handle A consumerHandle returned by createDataPipe.
225 * @param {MojoReadDataFlags} flags Flags.
226 * @return {object} An object of the form {
227 * result, // |RESULT_OK| on success, error code otherwise.
228 * buffer, // An ArrayBufferView of the data read (only on success).
229 * }
230 */
231 function readData(handle, flags) { [native code] }
232
233 /**
234 * True if the argument is a message or data pipe handle.
235 *
236 * @param {value} an arbitrary JS value.
237 * @return true or false
238 */
239 function isHandle(value) { [native code] }
OLDNEW
« no previous file with comments | « mojo/public/js/constants.cc ('k') | mojo/public/js/core_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698