| 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 MojoCreateWatcher(MojoWatcherCallback callback, | 188 MojoResult MojoWatch(MojoHandle handle, |
| 189 MojoHandle* watcher_handle) { | 189 MojoHandleSignals signals, |
| 190 assert(g_thunks.CreateWatcher); | 190 MojoWatchCallback callback, |
| 191 return g_thunks.CreateWatcher(callback, watcher_handle); | 191 uintptr_t context) { |
| 192 assert(g_thunks.Watch); |
| 193 return g_thunks.Watch(handle, signals, callback, context); |
| 192 } | 194 } |
| 193 | 195 |
| 194 MojoResult MojoWatch(MojoHandle watcher_handle, | 196 MojoResult MojoCancelWatch(MojoHandle handle, uintptr_t context) { |
| 195 MojoHandle handle, | |
| 196 MojoHandleSignals signals, | |
| 197 uintptr_t context) { | |
| 198 assert(g_thunks.Watch); | |
| 199 return g_thunks.Watch(watcher_handle, handle, signals, context); | |
| 200 } | |
| 201 | |
| 202 MojoResult MojoCancelWatch(MojoHandle watcher_handle, uintptr_t context) { | |
| 203 assert(g_thunks.CancelWatch); | 197 assert(g_thunks.CancelWatch); |
| 204 return g_thunks.CancelWatch(watcher_handle, context); | 198 return g_thunks.CancelWatch(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); | |
| 215 } | 199 } |
| 216 | 200 |
| 217 MojoResult MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1) { | 201 MojoResult MojoFuseMessagePipes(MojoHandle handle0, MojoHandle handle1) { |
| 218 assert(g_thunks.FuseMessagePipes); | 202 assert(g_thunks.FuseMessagePipes); |
| 219 return g_thunks.FuseMessagePipes(handle0, handle1); | 203 return g_thunks.FuseMessagePipes(handle0, handle1); |
| 220 } | 204 } |
| 221 | 205 |
| 222 MojoResult MojoWriteMessageNew(MojoHandle message_pipe_handle, | 206 MojoResult MojoWriteMessageNew(MojoHandle message_pipe_handle, |
| 223 MojoMessageHandle message, | 207 MojoMessageHandle message, |
| 224 MojoWriteMessageFlags flags) { | 208 MojoWriteMessageFlags flags) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return g_thunks.GetProperty(type, value); | 287 return g_thunks.GetProperty(type, value); |
| 304 } | 288 } |
| 305 | 289 |
| 306 } // extern "C" | 290 } // extern "C" |
| 307 | 291 |
| 308 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { | 292 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { |
| 309 if (system_thunks->size >= sizeof(g_thunks)) | 293 if (system_thunks->size >= sizeof(g_thunks)) |
| 310 g_thunks = *system_thunks; | 294 g_thunks = *system_thunks; |
| 311 return sizeof(g_thunks); | 295 return sizeof(g_thunks); |
| 312 } | 296 } |
| OLD | NEW |