OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 package org.chromium.mojo.system; | 5 package org.chromium.mojo.system; |
6 | 6 |
7 import java.util.List; | |
8 | |
9 /** | 7 /** |
10 * Core mojo interface giving access to the base operations. See |src/mojo/publi
c/c/system/core.h| | 8 * Core mojo interface giving access to the base operations. See |src/mojo/publi
c/c/system/core.h| |
11 * for the underlying api. | 9 * for the underlying api. |
12 */ | 10 */ |
13 public interface Core { | 11 public interface Core { |
14 | 12 |
15 /** | 13 /** |
16 * Used to indicate an infinite deadline (timeout). | 14 * Used to indicate an infinite deadline (timeout). |
17 */ | 15 */ |
18 public static final long DEADLINE_INFINITE = -1; | 16 public static final long DEADLINE_INFINITE = -1; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 120 |
123 /** | 121 /** |
124 * Returns the satisfiableSignals. | 122 * Returns the satisfiableSignals. |
125 */ | 123 */ |
126 public HandleSignals getSatisfiableSignals() { | 124 public HandleSignals getSatisfiableSignals() { |
127 return mSatisfiableSignals; | 125 return mSatisfiableSignals; |
128 } | 126 } |
129 } | 127 } |
130 | 128 |
131 /** | 129 /** |
132 * Result for the |wait| method. | |
133 */ | |
134 public static class WaitResult { | |
135 /** | |
136 * The result of the wait method. | |
137 * <p> | |
138 * |MojoResult.OK| if some signal in |signals| was satisfied (or is alre
ady satisfied). | |
139 * <p> | |
140 * |MojoResult.DEADLINE_EXCEEDED| if the deadline has passed without any
of the signals | |
141 * being satisfied. | |
142 * <p> | |
143 * |MojoResult.CANCELLED| if |handle| is closed concurrently by another
thread. | |
144 * <p> | |
145 * |MojoResult.FAILED_PRECONDITION| if it is or becomes impossible that
any flag in | |
146 * |signals| will ever be satisfied (for example, if the other endpoint
is closed). | |
147 */ | |
148 private int mMojoResult; | |
149 | |
150 /** | |
151 * The signaling state of handles. | |
152 */ | |
153 private HandleSignalsState mHandleSignalsState; | |
154 | |
155 /** | |
156 * Returns the mojoResult. | |
157 */ | |
158 public int getMojoResult() { | |
159 return mMojoResult; | |
160 } | |
161 | |
162 /** | |
163 * @param mojoResult the mojoResult to set | |
164 */ | |
165 public void setMojoResult(int mojoResult) { | |
166 mMojoResult = mojoResult; | |
167 } | |
168 | |
169 /** | |
170 * Returns the handleSignalsState. | |
171 */ | |
172 public HandleSignalsState getHandleSignalsState() { | |
173 return mHandleSignalsState; | |
174 } | |
175 | |
176 /** | |
177 * @param handleSignalsState the handleSignalsState to set | |
178 */ | |
179 public void setHandleSignalsState(HandleSignalsState handleSignalsState)
{ | |
180 mHandleSignalsState = handleSignalsState; | |
181 } | |
182 } | |
183 | |
184 /** | |
185 * Waits on the given |handle| until the state indicated by |signals| is sat
isfied or until | |
186 * |deadline| has passed. | |
187 * | |
188 * @return a |WaitResult|. | |
189 */ | |
190 public WaitResult wait(Handle handle, HandleSignals signals, long deadline); | |
191 | |
192 /** | |
193 * Result for the |waitMany| method. | |
194 */ | |
195 public static class WaitManyResult { | |
196 | |
197 /** | |
198 * See |wait| for the different possible values. | |
199 */ | |
200 private int mMojoResult; | |
201 | |
202 /** | |
203 * If |mojoResult| is |MojoResult.OK|, |handleIndex| is the index of the
handle for which | |
204 * some flag was satisfied (or is already satisfied). If |mojoResult| is | |
205 * |MojoResult.CANCELLED| or |MojoResult.FAILED_PRECONDITION|, |handleIn
dex| is the index of | |
206 * the handle for which the issue occurred. | |
207 */ | |
208 private int mHandleIndex; | |
209 | |
210 /** | |
211 * The signaling state of handles. Will not be set if |mojoResult| is | |
212 * |MOJO_RESULT_INVALID_ARGUMENT| or |MOJO_RESULT_RESOURCE_EXHAUSTED| | |
213 */ | |
214 private List<HandleSignalsState> mSignalStates; | |
215 | |
216 /** | |
217 * Returns the mojoResult. | |
218 */ | |
219 public int getMojoResult() { | |
220 return mMojoResult; | |
221 } | |
222 | |
223 /** | |
224 * @param mojoResult the mojoResult to set | |
225 */ | |
226 public void setMojoResult(int mojoResult) { | |
227 mMojoResult = mojoResult; | |
228 } | |
229 | |
230 /** | |
231 * Returns the handleIndex. | |
232 */ | |
233 public int getHandleIndex() { | |
234 return mHandleIndex; | |
235 } | |
236 | |
237 /** | |
238 * @param handleIndex the handleIndex to set | |
239 */ | |
240 public void setHandleIndex(int handleIndex) { | |
241 mHandleIndex = handleIndex; | |
242 } | |
243 | |
244 /** | |
245 * Returns the signalStates. | |
246 */ | |
247 public List<HandleSignalsState> getSignalStates() { | |
248 return mSignalStates; | |
249 } | |
250 | |
251 /** | |
252 * @param signalStates the signalStates to set | |
253 */ | |
254 public void setSignalStates(List<HandleSignalsState> signalStates) { | |
255 mSignalStates = signalStates; | |
256 } | |
257 } | |
258 | |
259 /** | |
260 * Waits on handle in |handles| for at least one of them to satisfy the asso
ciated | |
261 * |HandleSignals|, or until |deadline| has passed. | |
262 * | |
263 * @returns a |WaitManyResult|. | |
264 */ | |
265 public WaitManyResult waitMany(List<Pair<Handle, HandleSignals>> handles, lo
ng deadline); | |
266 | |
267 /** | |
268 * Creates a message pipe, which is a bidirectional communication channel fo
r framed data (i.e., | 130 * Creates a message pipe, which is a bidirectional communication channel fo
r framed data (i.e., |
269 * messages), with the given options. Messages can contain plain data and/or
Mojo handles. | 131 * messages), with the given options. Messages can contain plain data and/or
Mojo handles. |
270 * | 132 * |
271 * @return the set of handles for the two endpoints (ports) of the message p
ipe. | 133 * @return the set of handles for the two endpoints (ports) of the message p
ipe. |
272 */ | 134 */ |
273 public Pair<MessagePipeHandle, MessagePipeHandle> createMessagePipe( | 135 public Pair<MessagePipeHandle, MessagePipeHandle> createMessagePipe( |
274 MessagePipeHandle.CreateOptions options); | 136 MessagePipeHandle.CreateOptions options); |
275 | 137 |
276 /** | 138 /** |
277 * Creates a data pipe, which is a unidirectional communication channel for
unframed data, with | 139 * Creates a data pipe, which is a unidirectional communication channel for
unframed data, with |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 /** | 174 /** |
313 * Returns a new run loop. | 175 * Returns a new run loop. |
314 */ | 176 */ |
315 public RunLoop createDefaultRunLoop(); | 177 public RunLoop createDefaultRunLoop(); |
316 | 178 |
317 /** | 179 /** |
318 * Returns the current run loop if it exists. | 180 * Returns the current run loop if it exists. |
319 */ | 181 */ |
320 public RunLoop getCurrentRunLoop(); | 182 public RunLoop getCurrentRunLoop(); |
321 } | 183 } |
OLD | NEW |