OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "mojo/public/c/system/thunks.h" | 5 #include "mojo/public/c/system/thunks.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 MojoResult MojoGetReadyHandles(MojoHandle wait_set, | 178 MojoResult MojoGetReadyHandles(MojoHandle wait_set, |
179 uint32_t* count, | 179 uint32_t* count, |
180 MojoHandle* handles, | 180 MojoHandle* handles, |
181 MojoResult* results, | 181 MojoResult* results, |
182 struct MojoHandleSignalsState* signals_states) { | 182 struct MojoHandleSignalsState* signals_states) { |
183 assert(g_thunks.GetReadyHandles); | 183 assert(g_thunks.GetReadyHandles); |
184 return g_thunks.GetReadyHandles(wait_set, count, handles, results, | 184 return g_thunks.GetReadyHandles(wait_set, count, handles, results, |
185 signals_states); | 185 signals_states); |
186 } | 186 } |
187 | 187 |
188 MojoResult MojoWatch(MojoHandle handle, | 188 MojoResult MojoCreateWatcher(MojoWatcherCallback callback, |
| 189 MojoHandle* watcher_handle) { |
| 190 assert(g_thunks.CreateWatcher); |
| 191 return g_thunks.CreateWatcher(callback, watcher_handle); |
| 192 } |
| 193 |
| 194 MojoResult MojoWatch(MojoHandle watcher_handle, |
| 195 MojoHandle handle, |
189 MojoHandleSignals signals, | 196 MojoHandleSignals signals, |
190 MojoWatchCallback callback, | |
191 uintptr_t context) { | 197 uintptr_t context) { |
192 assert(g_thunks.Watch); | 198 assert(g_thunks.Watch); |
193 return g_thunks.Watch(handle, signals, callback, context); | 199 return g_thunks.Watch(watcher_handle, handle, signals, context); |
194 } | 200 } |
195 | 201 |
196 MojoResult MojoCancelWatch(MojoHandle handle, uintptr_t context) { | 202 MojoResult MojoCancelWatch(MojoHandle watcher_handle, uintptr_t context) { |
197 assert(g_thunks.CancelWatch); | 203 assert(g_thunks.CancelWatch); |
198 return g_thunks.CancelWatch(handle, context); | 204 return g_thunks.CancelWatch(watcher_handle, context); |
| 205 } |
| 206 |
| 207 MojoResult MojoArmWatcher(MojoHandle watcher_handle, |
| 208 uint32_t* num_ready_contexts, |
| 209 uintptr_t* ready_contexts, |
| 210 MojoResult* ready_results, |
| 211 MojoHandleSignalsState* ready_signals_states) { |
| 212 assert(g_thunks.ArmWatcher); |
| 213 return g_thunks.ArmWatcher(watcher_handle, num_ready_contexts, ready_contexts, |
| 214 ready_results, ready_signals_states); |
199 } | 215 } |
200 | 216 |
201 MojoResult MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1) { | 217 MojoResult MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1) { |
202 assert(g_thunks.FuseMessagePipes); | 218 assert(g_thunks.FuseMessagePipes); |
203 return g_thunks.FuseMessagePipes(handle0, handle1); | 219 return g_thunks.FuseMessagePipes(handle0, handle1); |
204 } | 220 } |
205 | 221 |
206 MojoResult MojoWriteMessageNew(MojoHandle message_pipe_handle, | 222 MojoResult MojoWriteMessageNew(MojoHandle message_pipe_handle, |
207 MojoMessageHandle message, | 223 MojoMessageHandle message, |
208 MojoWriteMessageFlags flags) { | 224 MojoWriteMessageFlags flags) { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
287 return g_thunks.GetProperty(type, value); | 303 return g_thunks.GetProperty(type, value); |
288 } | 304 } |
289 | 305 |
290 } // extern "C" | 306 } // extern "C" |
291 | 307 |
292 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { | 308 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { |
293 if (system_thunks->size >= sizeof(g_thunks)) | 309 if (system_thunks->size >= sizeof(g_thunks)) |
294 g_thunks = *system_thunks; | 310 g_thunks = *system_thunks; |
295 return sizeof(g_thunks); | 311 return sizeof(g_thunks); |
296 } | 312 } |
OLD | NEW |