| 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 // Note: This header should be compilable as C. | 5 // Note: This header should be compilable as C. |
| 6 | 6 |
| 7 #ifndef MOJO_PUBLIC_C_SYSTEM_THUNKS_H_ | 7 #ifndef MOJO_PUBLIC_C_SYSTEM_THUNKS_H_ |
| 8 #define MOJO_PUBLIC_C_SYSTEM_THUNKS_H_ | 8 #define MOJO_PUBLIC_C_SYSTEM_THUNKS_H_ |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| 11 #include <stdint.h> | 11 #include <stdint.h> |
| 12 | 12 |
| 13 #include "mojo/public/c/system/core.h" | 13 #include "mojo/public/c/system/core.h" |
| 14 #include "mojo/public/c/system/system_export.h" | 14 #include "mojo/public/c/system/system_export.h" |
| 15 | 15 |
| 16 // Structure used to bind the basic Mojo Core functions to an embedder | 16 // Structure used to bind the basic Mojo Core functions to an embedder |
| 17 // implementation. This is intended to eventually be used as a stable ABI | 17 // implementation. This is intended to eventually be used as a stable ABI |
| 18 // between a Mojo embedder and some loaded application code, but for now it is | 18 // between a Mojo embedder and some loaded application code, but for now it is |
| 19 // still effectively safe to rearrange entries as needed. | 19 // still effectively safe to rearrange entries as needed. |
| 20 #pragma pack(push, 8) | 20 #pragma pack(push, 8) |
| 21 struct MojoSystemThunks { | 21 struct MojoSystemThunks { |
| 22 size_t size; // Should be set to sizeof(MojoSystemThunks). | 22 size_t size; // Should be set to sizeof(MojoSystemThunks). |
| 23 MojoTimeTicks (*GetTimeTicksNow)(); | 23 MojoTimeTicks (*GetTimeTicksNow)(); |
| 24 MojoResult (*Close)(MojoHandle handle); | 24 MojoResult (*Close)(MojoHandle handle); |
| 25 MojoResult (*QueryHandleSignalsState)( | 25 MojoResult (*QueryHandleSignalsState)( |
| 26 MojoHandle handle, | 26 MojoHandle handle, |
| 27 struct MojoHandleSignalsState* signals_state); | 27 struct MojoHandleSignalsState* signals_state); |
| 28 MojoResult (*Wait)(MojoHandle handle, | |
| 29 MojoHandleSignals signals, | |
| 30 MojoDeadline deadline, | |
| 31 struct MojoHandleSignalsState* signals_state); | |
| 32 MojoResult (*WaitMany)(const MojoHandle* handles, | |
| 33 const MojoHandleSignals* signals, | |
| 34 uint32_t num_handles, | |
| 35 MojoDeadline deadline, | |
| 36 uint32_t* result_index, | |
| 37 struct MojoHandleSignalsState* signals_states); | |
| 38 MojoResult (*CreateMessagePipe)( | 28 MojoResult (*CreateMessagePipe)( |
| 39 const struct MojoCreateMessagePipeOptions* options, | 29 const struct MojoCreateMessagePipeOptions* options, |
| 40 MojoHandle* message_pipe_handle0, | 30 MojoHandle* message_pipe_handle0, |
| 41 MojoHandle* message_pipe_handle1); | 31 MojoHandle* message_pipe_handle1); |
| 42 MojoResult (*WriteMessage)(MojoHandle message_pipe_handle, | 32 MojoResult (*WriteMessage)(MojoHandle message_pipe_handle, |
| 43 const void* bytes, | 33 const void* bytes, |
| 44 uint32_t num_bytes, | 34 uint32_t num_bytes, |
| 45 const MojoHandle* handles, | 35 const MojoHandle* handles, |
| 46 uint32_t num_handles, | 36 uint32_t num_handles, |
| 47 MojoWriteMessageFlags flags); | 37 MojoWriteMessageFlags flags); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 MojoResult (*DuplicateBufferHandle)( | 71 MojoResult (*DuplicateBufferHandle)( |
| 82 MojoHandle buffer_handle, | 72 MojoHandle buffer_handle, |
| 83 const struct MojoDuplicateBufferHandleOptions* options, | 73 const struct MojoDuplicateBufferHandleOptions* options, |
| 84 MojoHandle* new_buffer_handle); | 74 MojoHandle* new_buffer_handle); |
| 85 MojoResult (*MapBuffer)(MojoHandle buffer_handle, | 75 MojoResult (*MapBuffer)(MojoHandle buffer_handle, |
| 86 uint64_t offset, | 76 uint64_t offset, |
| 87 uint64_t num_bytes, | 77 uint64_t num_bytes, |
| 88 void** buffer, | 78 void** buffer, |
| 89 MojoMapBufferFlags flags); | 79 MojoMapBufferFlags flags); |
| 90 MojoResult (*UnmapBuffer)(void* buffer); | 80 MojoResult (*UnmapBuffer)(void* buffer); |
| 91 | |
| 92 MojoResult (*CreateWaitSet)(MojoHandle* wait_set); | |
| 93 MojoResult (*AddHandle)(MojoHandle wait_set, | |
| 94 MojoHandle handle, | |
| 95 MojoHandleSignals signals); | |
| 96 MojoResult (*RemoveHandle)(MojoHandle wait_set, | |
| 97 MojoHandle handle); | |
| 98 MojoResult (*GetReadyHandles)(MojoHandle wait_set, | |
| 99 uint32_t* count, | |
| 100 MojoHandle* handles, | |
| 101 MojoResult* results, | |
| 102 struct MojoHandleSignalsState* signals_states); | |
| 103 MojoResult (*CreateWatcher)(MojoWatcherCallback callback, | 81 MojoResult (*CreateWatcher)(MojoWatcherCallback callback, |
| 104 MojoHandle* watcher_handle); | 82 MojoHandle* watcher_handle); |
| 105 MojoResult (*Watch)(MojoHandle watcher_handle, | 83 MojoResult (*Watch)(MojoHandle watcher_handle, |
| 106 MojoHandle handle, | 84 MojoHandle handle, |
| 107 MojoHandleSignals signals, | 85 MojoHandleSignals signals, |
| 108 uintptr_t context); | 86 uintptr_t context); |
| 109 MojoResult (*CancelWatch)(MojoHandle watcher_handle, uintptr_t context); | 87 MojoResult (*CancelWatch)(MojoHandle watcher_handle, uintptr_t context); |
| 110 MojoResult (*ArmWatcher)(MojoHandle watcher_handle, | 88 MojoResult (*ArmWatcher)(MojoHandle watcher_handle, |
| 111 uint32_t* num_ready_contexts, | 89 uint32_t* num_ready_contexts, |
| 112 uintptr_t* ready_contexts, | 90 uintptr_t* ready_contexts, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 // The contents of |system_thunks| are copied. | 139 // The contents of |system_thunks| are copied. |
| 162 typedef size_t (*MojoSetSystemThunksFn)( | 140 typedef size_t (*MojoSetSystemThunksFn)( |
| 163 const struct MojoSystemThunks* system_thunks); | 141 const struct MojoSystemThunks* system_thunks); |
| 164 | 142 |
| 165 // A function for setting up the embedder's own system thunks. This should only | 143 // A function for setting up the embedder's own system thunks. This should only |
| 166 // be called by Mojo embedder code. | 144 // be called by Mojo embedder code. |
| 167 MOJO_SYSTEM_EXPORT size_t MojoEmbedderSetSystemThunks( | 145 MOJO_SYSTEM_EXPORT size_t MojoEmbedderSetSystemThunks( |
| 168 const struct MojoSystemThunks* system_thunks); | 146 const struct MojoSystemThunks* system_thunks); |
| 169 | 147 |
| 170 #endif // MOJO_PUBLIC_C_SYSTEM_THUNKS_H_ | 148 #endif // MOJO_PUBLIC_C_SYSTEM_THUNKS_H_ |
| OLD | NEW |