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 11 matching lines...) Expand all Loading... |
22 return g_thunks.Close(handle); | 22 return g_thunks.Close(handle); |
23 } | 23 } |
24 | 24 |
25 MojoResult MojoQueryHandleSignalsState( | 25 MojoResult MojoQueryHandleSignalsState( |
26 MojoHandle handle, | 26 MojoHandle handle, |
27 struct MojoHandleSignalsState* signals_state) { | 27 struct MojoHandleSignalsState* signals_state) { |
28 assert(g_thunks.QueryHandleSignalsState); | 28 assert(g_thunks.QueryHandleSignalsState); |
29 return g_thunks.QueryHandleSignalsState(handle, signals_state); | 29 return g_thunks.QueryHandleSignalsState(handle, signals_state); |
30 } | 30 } |
31 | 31 |
32 MojoResult MojoWait(MojoHandle handle, | |
33 MojoHandleSignals signals, | |
34 MojoDeadline deadline, | |
35 struct MojoHandleSignalsState* signals_state) { | |
36 assert(g_thunks.Wait); | |
37 return g_thunks.Wait(handle, signals, deadline, signals_state); | |
38 } | |
39 | |
40 MojoResult MojoWaitMany(const MojoHandle* handles, | |
41 const MojoHandleSignals* signals, | |
42 uint32_t num_handles, | |
43 MojoDeadline deadline, | |
44 uint32_t* result_index, | |
45 struct MojoHandleSignalsState* signals_states) { | |
46 assert(g_thunks.WaitMany); | |
47 return g_thunks.WaitMany(handles, signals, num_handles, deadline, | |
48 result_index, signals_states); | |
49 } | |
50 | |
51 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options, | 32 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options, |
52 MojoHandle* message_pipe_handle0, | 33 MojoHandle* message_pipe_handle0, |
53 MojoHandle* message_pipe_handle1) { | 34 MojoHandle* message_pipe_handle1) { |
54 assert(g_thunks.CreateMessagePipe); | 35 assert(g_thunks.CreateMessagePipe); |
55 return g_thunks.CreateMessagePipe(options, message_pipe_handle0, | 36 return g_thunks.CreateMessagePipe(options, message_pipe_handle0, |
56 message_pipe_handle1); | 37 message_pipe_handle1); |
57 } | 38 } |
58 | 39 |
59 MojoResult MojoWriteMessage(MojoHandle message_pipe_handle, | 40 MojoResult MojoWriteMessage(MojoHandle message_pipe_handle, |
60 const void* bytes, | 41 const void* bytes, |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 MojoMapBufferFlags flags) { | 139 MojoMapBufferFlags flags) { |
159 assert(g_thunks.MapBuffer); | 140 assert(g_thunks.MapBuffer); |
160 return g_thunks.MapBuffer(buffer_handle, offset, num_bytes, buffer, flags); | 141 return g_thunks.MapBuffer(buffer_handle, offset, num_bytes, buffer, flags); |
161 } | 142 } |
162 | 143 |
163 MojoResult MojoUnmapBuffer(void* buffer) { | 144 MojoResult MojoUnmapBuffer(void* buffer) { |
164 assert(g_thunks.UnmapBuffer); | 145 assert(g_thunks.UnmapBuffer); |
165 return g_thunks.UnmapBuffer(buffer); | 146 return g_thunks.UnmapBuffer(buffer); |
166 } | 147 } |
167 | 148 |
168 MojoResult MojoCreateWaitSet(MojoHandle* wait_set) { | |
169 assert(g_thunks.CreateWaitSet); | |
170 return g_thunks.CreateWaitSet(wait_set); | |
171 } | |
172 | |
173 MojoResult MojoAddHandle(MojoHandle wait_set, | |
174 MojoHandle handle, | |
175 MojoHandleSignals signals) { | |
176 assert(g_thunks.AddHandle); | |
177 return g_thunks.AddHandle(wait_set, handle, signals); | |
178 } | |
179 | |
180 MojoResult MojoRemoveHandle(MojoHandle wait_set, MojoHandle handle) { | |
181 assert(g_thunks.RemoveHandle); | |
182 return g_thunks.RemoveHandle(wait_set, handle); | |
183 } | |
184 | |
185 MojoResult MojoGetReadyHandles(MojoHandle wait_set, | |
186 uint32_t* count, | |
187 MojoHandle* handles, | |
188 MojoResult* results, | |
189 struct MojoHandleSignalsState* signals_states) { | |
190 assert(g_thunks.GetReadyHandles); | |
191 return g_thunks.GetReadyHandles(wait_set, count, handles, results, | |
192 signals_states); | |
193 } | |
194 | |
195 MojoResult MojoCreateWatcher(MojoWatcherCallback callback, | 149 MojoResult MojoCreateWatcher(MojoWatcherCallback callback, |
196 MojoHandle* watcher_handle) { | 150 MojoHandle* watcher_handle) { |
197 assert(g_thunks.CreateWatcher); | 151 assert(g_thunks.CreateWatcher); |
198 return g_thunks.CreateWatcher(callback, watcher_handle); | 152 return g_thunks.CreateWatcher(callback, watcher_handle); |
199 } | 153 } |
200 | 154 |
201 MojoResult MojoWatch(MojoHandle watcher_handle, | 155 MojoResult MojoWatch(MojoHandle watcher_handle, |
202 MojoHandle handle, | 156 MojoHandle handle, |
203 MojoHandleSignals signals, | 157 MojoHandleSignals signals, |
204 uintptr_t context) { | 158 uintptr_t context) { |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 return g_thunks.GetProperty(type, value); | 264 return g_thunks.GetProperty(type, value); |
311 } | 265 } |
312 | 266 |
313 } // extern "C" | 267 } // extern "C" |
314 | 268 |
315 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { | 269 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { |
316 if (system_thunks->size >= sizeof(g_thunks)) | 270 if (system_thunks->size >= sizeof(g_thunks)) |
317 g_thunks = *system_thunks; | 271 g_thunks = *system_thunks; |
318 return sizeof(g_thunks); | 272 return sizeof(g_thunks); |
319 } | 273 } |
OLD | NEW |