| 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 static struct MojoSystemThunks g_thunks = {0}; | 11 static struct MojoSystemThunks g_thunks = {0}; |
| 12 | 12 |
| 13 MojoTimeTicks MojoGetTimeTicksNow() { | 13 MojoTimeTicks MojoGetTimeTicksNow() { |
| 14 assert(g_thunks.GetTimeTicksNow); | 14 assert(g_thunks.GetTimeTicksNow); |
| 15 return g_thunks.GetTimeTicksNow(); | 15 return g_thunks.GetTimeTicksNow(); |
| 16 } | 16 } |
| 17 | 17 |
| 18 MojoResult MojoClose(MojoHandle handle) { | 18 MojoResult MojoClose(MojoHandle handle) { |
| 19 assert(g_thunks.Close); | 19 assert(g_thunks.Close); |
| 20 return g_thunks.Close(handle); | 20 return g_thunks.Close(handle); |
| 21 } | 21 } |
| 22 | 22 |
| 23 MojoResult MojoGetRights(MojoHandle handle, MojoHandleRights* rights) { | 23 MojoResult MojoGetRights(MojoHandle handle, MojoHandleRights* rights) { |
| 24 assert(g_thunks.GetRights); | 24 assert(g_thunks.GetRights); |
| 25 return g_thunks.GetRights(handle, rights); | 25 return g_thunks.GetRights(handle, rights); |
| 26 } | 26 } |
| 27 | 27 |
| 28 MojoResult MojoDuplicateHandleWithReducedRights( |
| 29 MojoHandle handle, |
| 30 MojoHandleRights rights_to_remove, |
| 31 MojoHandle* new_handle) { |
| 32 assert(g_thunks.DuplicateHandleWithReducedRights); |
| 33 return g_thunks.DuplicateHandleWithReducedRights(handle, rights_to_remove, |
| 34 new_handle); |
| 35 } |
| 36 |
| 37 MojoResult MojoDuplicateHandle(MojoHandle handle, MojoHandle* new_handle) { |
| 38 assert(g_thunks.DuplicateHandle); |
| 39 return g_thunks.DuplicateHandle(handle, new_handle); |
| 40 } |
| 41 |
| 28 MojoResult MojoWait(MojoHandle handle, | 42 MojoResult MojoWait(MojoHandle handle, |
| 29 MojoHandleSignals signals, | 43 MojoHandleSignals signals, |
| 30 MojoDeadline deadline, | 44 MojoDeadline deadline, |
| 31 struct MojoHandleSignalsState* signals_state) { | 45 struct MojoHandleSignalsState* signals_state) { |
| 32 assert(g_thunks.Wait); | 46 assert(g_thunks.Wait); |
| 33 return g_thunks.Wait(handle, signals, deadline, signals_state); | 47 return g_thunks.Wait(handle, signals, deadline, signals_state); |
| 34 } | 48 } |
| 35 | 49 |
| 36 MojoResult MojoWaitMany(const MojoHandle* handles, | 50 MojoResult MojoWaitMany(const MojoHandle* handles, |
| 37 const MojoHandleSignals* signals, | 51 const MojoHandleSignals* signals, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 assert(g_thunks.UnmapBuffer); | 216 assert(g_thunks.UnmapBuffer); |
| 203 return g_thunks.UnmapBuffer(buffer); | 217 return g_thunks.UnmapBuffer(buffer); |
| 204 } | 218 } |
| 205 | 219 |
| 206 THUNK_EXPORT size_t | 220 THUNK_EXPORT size_t |
| 207 MojoSetSystemThunks(const struct MojoSystemThunks* system_thunks) { | 221 MojoSetSystemThunks(const struct MojoSystemThunks* system_thunks) { |
| 208 if (system_thunks->size >= sizeof(g_thunks)) | 222 if (system_thunks->size >= sizeof(g_thunks)) |
| 209 g_thunks = *system_thunks; | 223 g_thunks = *system_thunks; |
| 210 return sizeof(g_thunks); | 224 return sizeof(g_thunks); |
| 211 } | 225 } |
| OLD | NEW |