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/embedder_internal.h" | 5 #include "mojo/edk/embedder/embedder_internal.h" |
6 #include "mojo/edk/system/core.h" | 6 #include "mojo/edk/system/core.h" |
7 #include "mojo/public/c/system/buffer.h" | 7 #include "mojo/public/c/system/buffer.h" |
8 #include "mojo/public/c/system/data_pipe.h" | 8 #include "mojo/public/c/system/data_pipe.h" |
9 #include "mojo/public/c/system/functions.h" | 9 #include "mojo/public/c/system/functions.h" |
10 #include "mojo/public/c/system/message_pipe.h" | 10 #include "mojo/public/c/system/message_pipe.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 uint32_t num_handles, | 34 uint32_t num_handles, |
35 MojoDeadline deadline) { | 35 MojoDeadline deadline) { |
36 uint32_t result_index = static_cast<uint32_t>(-1); | 36 uint32_t result_index = static_cast<uint32_t>(-1); |
37 MojoResult result = g_core->WaitMany( | 37 MojoResult result = g_core->WaitMany( |
38 MakeUserPointer(handles), MakeUserPointer(signals), num_handles, deadline, | 38 MakeUserPointer(handles), MakeUserPointer(signals), num_handles, deadline, |
39 MakeUserPointer(&result_index), mojo::system::NullUserPointer()); | 39 MakeUserPointer(&result_index), mojo::system::NullUserPointer()); |
40 return (result == MOJO_RESULT_OK) ? static_cast<MojoResult>(result_index) | 40 return (result == MOJO_RESULT_OK) ? static_cast<MojoResult>(result_index) |
41 : result; | 41 : result; |
42 } | 42 } |
43 | 43 |
| 44 MojoResult MojoNewWait(MojoHandle handle, |
| 45 MojoHandleSignals signals, |
| 46 MojoDeadline deadline, |
| 47 MojoHandleSignalsState* signals_state) { |
| 48 return g_core->Wait(handle, signals, deadline, |
| 49 MakeUserPointer(signals_state)); |
| 50 } |
| 51 |
| 52 MojoResult MojoNewWaitMany(const MojoHandle* handles, |
| 53 const MojoHandleSignals* signals, |
| 54 uint32_t num_handles, |
| 55 MojoDeadline deadline, |
| 56 uint32_t* result_index, |
| 57 MojoHandleSignalsState* signals_states) { |
| 58 return g_core->WaitMany(MakeUserPointer(handles), MakeUserPointer(signals), |
| 59 num_handles, deadline, MakeUserPointer(result_index), |
| 60 MakeUserPointer(signals_states)); |
| 61 } |
| 62 |
44 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options, | 63 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options, |
45 MojoHandle* message_pipe_handle0, | 64 MojoHandle* message_pipe_handle0, |
46 MojoHandle* message_pipe_handle1) { | 65 MojoHandle* message_pipe_handle1) { |
47 return g_core->CreateMessagePipe(MakeUserPointer(options), | 66 return g_core->CreateMessagePipe(MakeUserPointer(options), |
48 MakeUserPointer(message_pipe_handle0), | 67 MakeUserPointer(message_pipe_handle0), |
49 MakeUserPointer(message_pipe_handle1)); | 68 MakeUserPointer(message_pipe_handle1)); |
50 } | 69 } |
51 | 70 |
52 MojoResult MojoWriteMessage(MojoHandle message_pipe_handle, | 71 MojoResult MojoWriteMessage(MojoHandle message_pipe_handle, |
53 const void* bytes, | 72 const void* bytes, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 MojoMapBufferFlags flags) { | 165 MojoMapBufferFlags flags) { |
147 return g_core->MapBuffer(buffer_handle, offset, num_bytes, | 166 return g_core->MapBuffer(buffer_handle, offset, num_bytes, |
148 MakeUserPointer(buffer), flags); | 167 MakeUserPointer(buffer), flags); |
149 } | 168 } |
150 | 169 |
151 MojoResult MojoUnmapBuffer(void* buffer) { | 170 MojoResult MojoUnmapBuffer(void* buffer) { |
152 return g_core->UnmapBuffer(MakeUserPointer(buffer)); | 171 return g_core->UnmapBuffer(MakeUserPointer(buffer)); |
153 } | 172 } |
154 | 173 |
155 } // extern "C" | 174 } // extern "C" |
OLD | NEW |