| 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_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 7 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
| 8 #define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 8 #define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
| 9 | 9 |
| 10 #include <stddef.h> | 10 #include <stddef.h> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 size_t size; // Should be set to sizeof(MojoSystemThunks). | 38 size_t size; // Should be set to sizeof(MojoSystemThunks). |
| 39 MojoTimeTicks (*GetTimeTicksNow)(); | 39 MojoTimeTicks (*GetTimeTicksNow)(); |
| 40 MojoResult (*Close)(MojoHandle handle); | 40 MojoResult (*Close)(MojoHandle handle); |
| 41 MojoResult (*Wait)(MojoHandle handle, | 41 MojoResult (*Wait)(MojoHandle handle, |
| 42 MojoHandleSignals signals, | 42 MojoHandleSignals signals, |
| 43 MojoDeadline deadline); | 43 MojoDeadline deadline); |
| 44 MojoResult (*WaitMany)(const MojoHandle* handles, | 44 MojoResult (*WaitMany)(const MojoHandle* handles, |
| 45 const MojoHandleSignals* signals, | 45 const MojoHandleSignals* signals, |
| 46 uint32_t num_handles, | 46 uint32_t num_handles, |
| 47 MojoDeadline deadline); | 47 MojoDeadline deadline); |
| 48 MojoResult (*NewWait)(MojoHandle handle, |
| 49 MojoHandleSignals signals, |
| 50 MojoDeadline deadline, |
| 51 struct MojoHandleSignalsState* signals_state); |
| 52 MojoResult (*NewWaitMany)(const MojoHandle* handles, |
| 53 const MojoHandleSignals* signals, |
| 54 uint32_t num_handles, |
| 55 MojoDeadline deadline, |
| 56 uint32_t* result_index, |
| 57 struct MojoHandleSignalsState* signals_states); |
| 48 MojoResult (*CreateMessagePipe)( | 58 MojoResult (*CreateMessagePipe)( |
| 49 const struct MojoCreateMessagePipeOptions* options, | 59 const struct MojoCreateMessagePipeOptions* options, |
| 50 MojoHandle* message_pipe_handle0, | 60 MojoHandle* message_pipe_handle0, |
| 51 MojoHandle* message_pipe_handle1); | 61 MojoHandle* message_pipe_handle1); |
| 52 MojoResult (*WriteMessage)(MojoHandle message_pipe_handle, | 62 MojoResult (*WriteMessage)(MojoHandle message_pipe_handle, |
| 53 const void* bytes, | 63 const void* bytes, |
| 54 uint32_t num_bytes, | 64 uint32_t num_bytes, |
| 55 const MojoHandle* handles, | 65 const MojoHandle* handles, |
| 56 uint32_t num_handles, | 66 uint32_t num_handles, |
| 57 MojoWriteMessageFlags flags); | 67 MojoWriteMessageFlags flags); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 MojoMapBufferFlags flags); | 109 MojoMapBufferFlags flags); |
| 100 MojoResult (*UnmapBuffer)(void* buffer); | 110 MojoResult (*UnmapBuffer)(void* buffer); |
| 101 }; | 111 }; |
| 102 #pragma pack(pop) | 112 #pragma pack(pop) |
| 103 | 113 |
| 104 | 114 |
| 105 #ifdef __cplusplus | 115 #ifdef __cplusplus |
| 106 // Intended to be called from the embedder. Returns a |MojoCore| initialized | 116 // Intended to be called from the embedder. Returns a |MojoCore| initialized |
| 107 // to contain pointers to each of the embedder's MojoCore functions. | 117 // to contain pointers to each of the embedder's MojoCore functions. |
| 108 inline MojoSystemThunks MojoMakeSystemThunks() { | 118 inline MojoSystemThunks MojoMakeSystemThunks() { |
| 109 MojoSystemThunks system_thunks = { | 119 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks), |
| 110 sizeof(MojoSystemThunks), | 120 MojoGetTimeTicksNow, |
| 111 MojoGetTimeTicksNow, | 121 MojoClose, |
| 112 MojoClose, | 122 MojoWait, |
| 113 MojoWait, | 123 MojoWaitMany, |
| 114 MojoWaitMany, | 124 MojoNewWait, |
| 115 MojoCreateMessagePipe, | 125 MojoNewWaitMany, |
| 116 MojoWriteMessage, | 126 MojoCreateMessagePipe, |
| 117 MojoReadMessage, | 127 MojoWriteMessage, |
| 118 MojoCreateDataPipe, | 128 MojoReadMessage, |
| 119 MojoWriteData, | 129 MojoCreateDataPipe, |
| 120 MojoBeginWriteData, | 130 MojoWriteData, |
| 121 MojoEndWriteData, | 131 MojoBeginWriteData, |
| 122 MojoReadData, | 132 MojoEndWriteData, |
| 123 MojoBeginReadData, | 133 MojoReadData, |
| 124 MojoEndReadData, | 134 MojoBeginReadData, |
| 125 MojoCreateSharedBuffer, | 135 MojoEndReadData, |
| 126 MojoDuplicateBufferHandle, | 136 MojoCreateSharedBuffer, |
| 127 MojoMapBuffer, | 137 MojoDuplicateBufferHandle, |
| 128 MojoUnmapBuffer | 138 MojoMapBuffer, |
| 129 }; | 139 MojoUnmapBuffer}; |
| 130 return system_thunks; | 140 return system_thunks; |
| 131 } | 141 } |
| 132 #endif | 142 #endif |
| 133 | 143 |
| 134 | 144 |
| 135 // Use this type for the function found by dynamically discovering it in | 145 // Use this type for the function found by dynamically discovering it in |
| 136 // a DSO linked with mojo_system. For example: | 146 // a DSO linked with mojo_system. For example: |
| 137 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = | 147 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = |
| 138 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( | 148 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( |
| 139 // "MojoSetSystemThunks")); | 149 // "MojoSetSystemThunks")); |
| 140 // The expected size of |system_thunks} is returned. | 150 // The expected size of |system_thunks} is returned. |
| 141 // The contents of |system_thunks| are copied. | 151 // The contents of |system_thunks| are copied. |
| 142 typedef size_t (*MojoSetSystemThunksFn)( | 152 typedef size_t (*MojoSetSystemThunksFn)( |
| 143 const struct MojoSystemThunks* system_thunks); | 153 const struct MojoSystemThunks* system_thunks); |
| 144 | 154 |
| 145 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 155 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
| OLD | NEW |