| 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/platform/native/system_thunks.h" | 5 #include "mojo/public/platform/native/system_thunks.h" |
| 6 | 6 |
| 7 #include <assert.h> | 7 #include <assert.h> |
| 8 | 8 |
| 9 #include "mojo/public/platform/native/thunk_export.h" | 9 #include "mojo/public/platform/native/thunk_export.h" |
| 10 | 10 |
| 11 extern "C" { | 11 extern "C" { |
| 12 | 12 |
| 13 static MojoSystemThunks g_thunks = {0}; | 13 static MojoSystemThunks g_thunks = {0}; |
| 14 | 14 |
| 15 MojoTimeTicks MojoGetTimeTicksNow() { | 15 MojoTimeTicks MojoGetTimeTicksNow() { |
| 16 assert(g_thunks.GetTimeTicksNow); | 16 assert(g_thunks.GetTimeTicksNow); |
| 17 return g_thunks.GetTimeTicksNow(); | 17 return g_thunks.GetTimeTicksNow(); |
| 18 } | 18 } |
| 19 | 19 |
| 20 MojoResult MojoClose(MojoHandle handle) { | 20 MojoResult MojoClose(MojoHandle handle) { |
| 21 assert(g_thunks.Close); | 21 assert(g_thunks.Close); |
| 22 return g_thunks.Close(handle); | 22 return g_thunks.Close(handle); |
| 23 } | 23 } |
| 24 | 24 |
| 25 MojoResult MojoWait(MojoHandle handle, | 25 MojoResult MojoWait(MojoHandle handle, |
| 26 MojoHandleSignals signals, | 26 MojoHandleSignals signals, |
| 27 MojoDeadline deadline) { | 27 MojoDeadline deadline, |
| 28 struct MojoHandleSignalsState* signals_state) { |
| 28 assert(g_thunks.Wait); | 29 assert(g_thunks.Wait); |
| 29 return g_thunks.Wait(handle, signals, deadline); | 30 return g_thunks.Wait(handle, signals, deadline, signals_state); |
| 30 } | 31 } |
| 31 | 32 |
| 32 MojoResult MojoWaitMany(const MojoHandle* handles, | 33 MojoResult MojoWaitMany(const MojoHandle* handles, |
| 33 const MojoHandleSignals* signals, | 34 const MojoHandleSignals* signals, |
| 34 uint32_t num_handles, | 35 uint32_t num_handles, |
| 35 MojoDeadline deadline) { | 36 MojoDeadline deadline, |
| 37 uint32_t* result_index, |
| 38 struct MojoHandleSignalsState* signals_states) { |
| 36 assert(g_thunks.WaitMany); | 39 assert(g_thunks.WaitMany); |
| 37 return g_thunks.WaitMany(handles, signals, num_handles, deadline); | 40 return g_thunks.WaitMany(handles, signals, num_handles, deadline, |
| 38 } | 41 result_index, signals_states); |
| 39 | |
| 40 MojoResult MojoNewWait(MojoHandle handle, | |
| 41 MojoHandleSignals signals, | |
| 42 MojoDeadline deadline, | |
| 43 struct MojoHandleSignalsState* signals_state) { | |
| 44 assert(g_thunks.NewWait); | |
| 45 return g_thunks.NewWait(handle, signals, deadline, signals_state); | |
| 46 } | |
| 47 | |
| 48 MojoResult MojoNewWaitMany(const MojoHandle* handles, | |
| 49 const MojoHandleSignals* signals, | |
| 50 uint32_t num_handles, | |
| 51 MojoDeadline deadline, | |
| 52 uint32_t* result_index, | |
| 53 struct MojoHandleSignalsState* signals_states) { | |
| 54 assert(g_thunks.NewWaitMany); | |
| 55 return g_thunks.NewWaitMany(handles, signals, num_handles, deadline, | |
| 56 result_index, signals_states); | |
| 57 } | 42 } |
| 58 | 43 |
| 59 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options, | 44 MojoResult MojoCreateMessagePipe(const MojoCreateMessagePipeOptions* options, |
| 60 MojoHandle* message_pipe_handle0, | 45 MojoHandle* message_pipe_handle0, |
| 61 MojoHandle* message_pipe_handle1) { | 46 MojoHandle* message_pipe_handle1) { |
| 62 assert(g_thunks.CreateMessagePipe); | 47 assert(g_thunks.CreateMessagePipe); |
| 63 return g_thunks.CreateMessagePipe(options, message_pipe_handle0, | 48 return g_thunks.CreateMessagePipe(options, message_pipe_handle0, |
| 64 message_pipe_handle1); | 49 message_pipe_handle1); |
| 65 } | 50 } |
| 66 | 51 |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 } | 159 } |
| 175 | 160 |
| 176 extern "C" THUNK_EXPORT size_t MojoSetSystemThunks( | 161 extern "C" THUNK_EXPORT size_t MojoSetSystemThunks( |
| 177 const MojoSystemThunks* system_thunks) { | 162 const MojoSystemThunks* system_thunks) { |
| 178 if (system_thunks->size >= sizeof(g_thunks)) | 163 if (system_thunks->size >= sizeof(g_thunks)) |
| 179 g_thunks = *system_thunks; | 164 g_thunks = *system_thunks; |
| 180 return sizeof(g_thunks); | 165 return sizeof(g_thunks); |
| 181 } | 166 } |
| 182 | 167 |
| 183 } // extern "C" | 168 } // extern "C" |
| OLD | NEW |