| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 part of internal; | 5 part of internal; |
| 6 | 6 |
| 7 // Data associated with an open handle. | 7 // Data associated with an open handle. |
| 8 class _OpenHandle { | 8 class _OpenHandle { |
| 9 final StackTrace stack; | 9 final StackTrace stack; |
| 10 String description; | 10 String description; |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 /// class. In particular, a successful operation returns [MojoResult.kOk]. | 125 /// class. In particular, a successful operation returns [MojoResult.kOk]. |
| 126 /// | 126 /// |
| 127 /// The [handleToken] is a token that identifies the Mojo handle. | 127 /// The [handleToken] is a token that identifies the Mojo handle. |
| 128 static int close(int handleToken) native "MojoHandle_Close"; | 128 static int close(int handleToken) native "MojoHandle_Close"; |
| 129 | 129 |
| 130 /// Waits on the given [handleToken] for a signal. | 130 /// Waits on the given [handleToken] for a signal. |
| 131 /// | 131 /// |
| 132 /// Returns a list of two elements. The first entry is an integer, encoding | 132 /// Returns a list of two elements. The first entry is an integer, encoding |
| 133 /// if the operation was a success or not, as specified in the [MojoResult] | 133 /// if the operation was a success or not, as specified in the [MojoResult] |
| 134 /// class. In particular, a successful operation is signaled by | 134 /// class. In particular, a successful operation is signaled by |
| 135 /// [MojoResult.kOk]. The second entry is itself a List of 2 elements: | 135 /// [MojoResult.kOk]. The second entry is itself a list of 2 elements: |
| 136 /// an integer of satisfied signals, and an integer of satisfiable signals. | 136 /// an integer of satisfied signals, and an integer of satisfiable signals. |
| 137 /// Both entries are encoded as specified in [MojoHandleSignals]. | 137 /// Both entries are encoded as specified in [MojoHandleSignals]. |
| 138 /// | 138 /// |
| 139 /// A signal is satisfiable, if the signal may become true in the future. |
| 140 /// |
| 139 /// The [deadline] specifies how long the call should wait (if no signal is | 141 /// The [deadline] specifies how long the call should wait (if no signal is |
| 140 /// triggered). If the deadline passes, the returned result-integer is | 142 /// triggered). If the deadline passes, the returned result-integer is |
| 141 /// [MojoResult.kDeadlineExceeded]. If the deadline is 0, then the result | 143 /// [MojoResult.kDeadlineExceeded]. If the deadline is 0, then the result |
| 142 /// is only [MojoResult.kDeadlineExceeded] if no other termination condition | 144 /// is only [MojoResult.kDeadlineExceeded] if no other termination condition |
| 143 /// is already satisfied (see below). | 145 /// is already satisfied (see below). |
| 144 /// | 146 /// |
| 145 /// The [signals] integer encodes the signals this method should wait for. | 147 /// The [signals] integer encodes the signals this method should wait for. |
| 146 /// The integer is encoded as specified in [MojoHandleSignals]. | 148 /// The integer is encoded as specified in [MojoHandleSignals]. |
| 147 /// | 149 /// |
| 148 /// Waits on the given handle until one of the following happens: | 150 /// Waits on the given handle until one of the following happens: |
| 149 /// - A signal indicated by [signals] is satisfied. | 151 /// - A signal indicated by [signals] is satisfied. |
| 150 /// - It becomes known that no signal indicated by [signals] will ever be | 152 /// - It becomes known that no signal indicated by [signals] will ever be |
| 151 /// satisfied (for example the handle has been closed on the other side). | 153 /// satisfied (for example the handle has been closed on the other side). |
| 152 /// - The [deadline] has passed. | 154 /// - The [deadline] has passed. |
| 153 static List wait(int handleToken, int signals, int deadline) | 155 static List wait(int handleToken, int signals, int deadline) |
| 154 native "MojoHandle_Wait"; | 156 native "MojoHandle_Wait"; |
| 155 | 157 |
| 156 /// Waits on many handles at the same time. | 158 /// Waits on many handles at the same time. |
| 157 /// | 159 /// |
| 158 /// The returned value is similar to the result of [wait]. | 160 /// Returns a list with exactly 3 elements: |
| 161 /// - the result integer, encoded as specified in [MojoResult]. In particular, |
| 162 /// [MojoResult.kOk] signals success. |
| 163 /// - the index of the handle that caused the return. May be `null` if the |
| 164 /// operation didn't succeed. |
| 165 /// - a list of signal states. May be `null` if the operation didn't succeed. |
| 166 /// Each signal state is represented by a list of 2 elements: an integer of |
| 167 /// satisfied signals, and an integer of satisfiable signals (see [wait]). |
| 159 /// | 168 /// |
| 160 /// Behaves as if [wait] was called on each of the [handleTokens] separately, | 169 /// Behaves as if [wait] was called on each of the [handleTokens] separately, |
| 161 /// completing when the first would complete. | 170 /// completing when the first would complete. |
| 162 static List waitMany(List<int> handleTokens, List<int> signals, int deadline) | 171 static List waitMany(List<int> handleTokens, List<int> signals, int deadline) |
| 163 native "MojoHandle_WaitMany"; | 172 native "MojoHandle_WaitMany"; |
| 164 | 173 |
| 165 // Called from the embedder's unhandled exception callback. | 174 // Called from the embedder's unhandled exception callback. |
| 166 // Returns the number of successfully closed handles. | 175 // Returns the number of successfully closed handles. |
| 167 static int _closeOpenHandles() { | 176 static int _closeOpenHandles() { |
| 168 int count = 0; | 177 int count = 0; |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 /// buffer. | 534 /// buffer. |
| 526 /// | 535 /// |
| 527 /// Note: there is no `unmap` call, since this is supposed to happen via | 536 /// Note: there is no `unmap` call, since this is supposed to happen via |
| 528 /// finalizers. | 537 /// finalizers. |
| 529 /// | 538 /// |
| 530 /// The parameter [flags] is reserved for future use and should currently be | 539 /// The parameter [flags] is reserved for future use and should currently be |
| 531 /// set to [MojoSharedBuffer.mapFlagNone] (equal to 0). | 540 /// set to [MojoSharedBuffer.mapFlagNone] (equal to 0). |
| 532 static List Map(int bufferHandleToken, int offset, int numBytes, int flags) | 541 static List Map(int bufferHandleToken, int offset, int numBytes, int flags) |
| 533 native "MojoSharedBuffer_Map"; | 542 native "MojoSharedBuffer_Map"; |
| 534 } | 543 } |
| OLD | NEW |