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 #include "mojo/edk/embedder/entrypoints.h" | 5 #include "mojo/edk/embedder/entrypoints.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "mojo/edk/embedder/embedder_internal.h" | 9 #include "mojo/edk/embedder/embedder_internal.h" |
10 #include "mojo/edk/system/core.h" | 10 #include "mojo/edk/system/core.h" |
11 #include "mojo/public/c/system/buffer.h" | 11 #include "mojo/public/c/system/buffer.h" |
12 #include "mojo/public/c/system/data_pipe.h" | 12 #include "mojo/public/c/system/data_pipe.h" |
13 #include "mojo/public/c/system/functions.h" | 13 #include "mojo/public/c/system/functions.h" |
14 #include "mojo/public/c/system/message_pipe.h" | 14 #include "mojo/public/c/system/message_pipe.h" |
15 #include "mojo/public/c/system/platform_handle.h" | 15 #include "mojo/public/c/system/platform_handle.h" |
16 #include "mojo/public/c/system/wait_set.h" | |
17 | 16 |
18 using mojo::edk::internal::g_core; | 17 using mojo::edk::internal::g_core; |
19 | 18 |
20 // Definitions of the system functions. | 19 // Definitions of the system functions. |
21 extern "C" { | 20 extern "C" { |
22 | 21 |
23 MojoTimeTicks MojoGetTimeTicksNowImpl() { | 22 MojoTimeTicks MojoGetTimeTicksNowImpl() { |
24 return g_core->GetTimeTicksNow(); | 23 return g_core->GetTimeTicksNow(); |
25 } | 24 } |
26 | 25 |
27 MojoResult MojoCloseImpl(MojoHandle handle) { | 26 MojoResult MojoCloseImpl(MojoHandle handle) { |
28 return g_core->Close(handle); | 27 return g_core->Close(handle); |
29 } | 28 } |
30 | 29 |
31 MojoResult MojoQueryHandleSignalsStateImpl( | 30 MojoResult MojoQueryHandleSignalsStateImpl( |
32 MojoHandle handle, | 31 MojoHandle handle, |
33 MojoHandleSignalsState* signals_state) { | 32 MojoHandleSignalsState* signals_state) { |
34 return g_core->QueryHandleSignalsState(handle, signals_state); | 33 return g_core->QueryHandleSignalsState(handle, signals_state); |
35 } | 34 } |
36 | 35 |
37 MojoResult MojoWaitImpl(MojoHandle handle, | |
38 MojoHandleSignals signals, | |
39 MojoDeadline deadline, | |
40 MojoHandleSignalsState* signals_state) { | |
41 return g_core->Wait(handle, signals, deadline, signals_state); | |
42 } | |
43 | |
44 MojoResult MojoWaitManyImpl(const MojoHandle* handles, | |
45 const MojoHandleSignals* signals, | |
46 uint32_t num_handles, | |
47 MojoDeadline deadline, | |
48 uint32_t* result_index, | |
49 MojoHandleSignalsState* signals_states) { | |
50 return g_core->WaitMany(handles, signals, num_handles, deadline, result_index, | |
51 signals_states); | |
52 } | |
53 | |
54 MojoResult MojoCreateWatcherImpl(MojoWatcherCallback callback, | 36 MojoResult MojoCreateWatcherImpl(MojoWatcherCallback callback, |
55 MojoHandle* watcher_handle) { | 37 MojoHandle* watcher_handle) { |
56 return g_core->CreateWatcher(callback, watcher_handle); | 38 return g_core->CreateWatcher(callback, watcher_handle); |
57 } | 39 } |
58 | 40 |
59 MojoResult MojoArmWatcherImpl(MojoHandle watcher_handle, | 41 MojoResult MojoArmWatcherImpl(MojoHandle watcher_handle, |
60 uint32_t* num_ready_contexts, | 42 uint32_t* num_ready_contexts, |
61 uintptr_t* ready_contexts, | 43 uintptr_t* ready_contexts, |
62 MojoResult* ready_results, | 44 MojoResult* ready_results, |
63 MojoHandleSignalsState* ready_signals_states) { | 45 MojoHandleSignalsState* ready_signals_states) { |
(...skipping 21 matching lines...) Expand all Loading... |
85 } | 67 } |
86 | 68 |
87 MojoResult MojoFreeMessageImpl(MojoMessageHandle message) { | 69 MojoResult MojoFreeMessageImpl(MojoMessageHandle message) { |
88 return g_core->FreeMessage(message); | 70 return g_core->FreeMessage(message); |
89 } | 71 } |
90 | 72 |
91 MojoResult MojoGetMessageBufferImpl(MojoMessageHandle message, void** buffer) { | 73 MojoResult MojoGetMessageBufferImpl(MojoMessageHandle message, void** buffer) { |
92 return g_core->GetMessageBuffer(message, buffer); | 74 return g_core->GetMessageBuffer(message, buffer); |
93 } | 75 } |
94 | 76 |
95 MojoResult MojoCreateWaitSetImpl(MojoHandle* wait_set_handle) { | |
96 return g_core->CreateWaitSet(wait_set_handle); | |
97 } | |
98 | |
99 MojoResult MojoAddHandleImpl(MojoHandle wait_set_handle, | |
100 MojoHandle handle, | |
101 MojoHandleSignals signals) { | |
102 return g_core->AddHandle(wait_set_handle, handle, signals); | |
103 } | |
104 | |
105 MojoResult MojoRemoveHandleImpl(MojoHandle wait_set_handle, MojoHandle handle) { | |
106 return g_core->RemoveHandle(wait_set_handle, handle); | |
107 } | |
108 | |
109 MojoResult MojoGetReadyHandlesImpl( | |
110 MojoHandle wait_set_handle, | |
111 uint32_t* count, | |
112 MojoHandle* handles, | |
113 MojoResult* results, | |
114 struct MojoHandleSignalsState* signals_states) { | |
115 return g_core->GetReadyHandles(wait_set_handle, count, handles, results, | |
116 signals_states); | |
117 } | |
118 | |
119 MojoResult MojoCreateMessagePipeImpl( | 77 MojoResult MojoCreateMessagePipeImpl( |
120 const MojoCreateMessagePipeOptions* options, | 78 const MojoCreateMessagePipeOptions* options, |
121 MojoHandle* message_pipe_handle0, | 79 MojoHandle* message_pipe_handle0, |
122 MojoHandle* message_pipe_handle1) { | 80 MojoHandle* message_pipe_handle1) { |
123 return g_core->CreateMessagePipe(options, message_pipe_handle0, | 81 return g_core->CreateMessagePipe(options, message_pipe_handle0, |
124 message_pipe_handle1); | 82 message_pipe_handle1); |
125 } | 83 } |
126 | 84 |
127 MojoResult MojoWriteMessageImpl(MojoHandle message_pipe_handle, | 85 MojoResult MojoWriteMessageImpl(MojoHandle message_pipe_handle, |
128 const void* bytes, | 86 const void* bytes, |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 } // extern "C" | 239 } // extern "C" |
282 | 240 |
283 namespace mojo { | 241 namespace mojo { |
284 namespace edk { | 242 namespace edk { |
285 | 243 |
286 MojoSystemThunks MakeSystemThunks() { | 244 MojoSystemThunks MakeSystemThunks() { |
287 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks), | 245 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks), |
288 MojoGetTimeTicksNowImpl, | 246 MojoGetTimeTicksNowImpl, |
289 MojoCloseImpl, | 247 MojoCloseImpl, |
290 MojoQueryHandleSignalsStateImpl, | 248 MojoQueryHandleSignalsStateImpl, |
291 MojoWaitImpl, | |
292 MojoWaitManyImpl, | |
293 MojoCreateMessagePipeImpl, | 249 MojoCreateMessagePipeImpl, |
294 MojoWriteMessageImpl, | 250 MojoWriteMessageImpl, |
295 MojoReadMessageImpl, | 251 MojoReadMessageImpl, |
296 MojoCreateDataPipeImpl, | 252 MojoCreateDataPipeImpl, |
297 MojoWriteDataImpl, | 253 MojoWriteDataImpl, |
298 MojoBeginWriteDataImpl, | 254 MojoBeginWriteDataImpl, |
299 MojoEndWriteDataImpl, | 255 MojoEndWriteDataImpl, |
300 MojoReadDataImpl, | 256 MojoReadDataImpl, |
301 MojoBeginReadDataImpl, | 257 MojoBeginReadDataImpl, |
302 MojoEndReadDataImpl, | 258 MojoEndReadDataImpl, |
303 MojoCreateSharedBufferImpl, | 259 MojoCreateSharedBufferImpl, |
304 MojoDuplicateBufferHandleImpl, | 260 MojoDuplicateBufferHandleImpl, |
305 MojoMapBufferImpl, | 261 MojoMapBufferImpl, |
306 MojoUnmapBufferImpl, | 262 MojoUnmapBufferImpl, |
307 MojoCreateWaitSetImpl, | |
308 MojoAddHandleImpl, | |
309 MojoRemoveHandleImpl, | |
310 MojoGetReadyHandlesImpl, | |
311 MojoCreateWatcherImpl, | 263 MojoCreateWatcherImpl, |
312 MojoWatchImpl, | 264 MojoWatchImpl, |
313 MojoCancelWatchImpl, | 265 MojoCancelWatchImpl, |
314 MojoArmWatcherImpl, | 266 MojoArmWatcherImpl, |
315 MojoFuseMessagePipesImpl, | 267 MojoFuseMessagePipesImpl, |
316 MojoWriteMessageNewImpl, | 268 MojoWriteMessageNewImpl, |
317 MojoReadMessageNewImpl, | 269 MojoReadMessageNewImpl, |
318 MojoAllocMessageImpl, | 270 MojoAllocMessageImpl, |
319 MojoFreeMessageImpl, | 271 MojoFreeMessageImpl, |
320 MojoGetMessageBufferImpl, | 272 MojoGetMessageBufferImpl, |
321 MojoWrapPlatformHandleImpl, | 273 MojoWrapPlatformHandleImpl, |
322 MojoUnwrapPlatformHandleImpl, | 274 MojoUnwrapPlatformHandleImpl, |
323 MojoWrapPlatformSharedBufferHandleImpl, | 275 MojoWrapPlatformSharedBufferHandleImpl, |
324 MojoUnwrapPlatformSharedBufferHandleImpl, | 276 MojoUnwrapPlatformSharedBufferHandleImpl, |
325 MojoNotifyBadMessageImpl, | 277 MojoNotifyBadMessageImpl, |
326 MojoGetPropertyImpl}; | 278 MojoGetPropertyImpl}; |
327 return system_thunks; | 279 return system_thunks; |
328 } | 280 } |
329 | 281 |
330 } // namespace edk | 282 } // namespace edk |
331 } // namespace mojo | 283 } // namespace mojo |
OLD | NEW |