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) { |
| 24 assert(g_thunks.GetRights); |
| 25 return g_thunks.GetRights(handle, rights); |
| 26 } |
| 27 |
23 MojoResult MojoWait(MojoHandle handle, | 28 MojoResult MojoWait(MojoHandle handle, |
24 MojoHandleSignals signals, | 29 MojoHandleSignals signals, |
25 MojoDeadline deadline, | 30 MojoDeadline deadline, |
26 struct MojoHandleSignalsState* signals_state) { | 31 struct MojoHandleSignalsState* signals_state) { |
27 assert(g_thunks.Wait); | 32 assert(g_thunks.Wait); |
28 return g_thunks.Wait(handle, signals, deadline, signals_state); | 33 return g_thunks.Wait(handle, signals, deadline, signals_state); |
29 } | 34 } |
30 | 35 |
31 MojoResult MojoWaitMany(const MojoHandle* handles, | 36 MojoResult MojoWaitMany(const MojoHandle* handles, |
32 const MojoHandleSignals* signals, | 37 const MojoHandleSignals* signals, |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 assert(g_thunks.UnmapBuffer); | 202 assert(g_thunks.UnmapBuffer); |
198 return g_thunks.UnmapBuffer(buffer); | 203 return g_thunks.UnmapBuffer(buffer); |
199 } | 204 } |
200 | 205 |
201 THUNK_EXPORT size_t | 206 THUNK_EXPORT size_t |
202 MojoSetSystemThunks(const struct MojoSystemThunks* system_thunks) { | 207 MojoSetSystemThunks(const struct MojoSystemThunks* system_thunks) { |
203 if (system_thunks->size >= sizeof(g_thunks)) | 208 if (system_thunks->size >= sizeof(g_thunks)) |
204 g_thunks = *system_thunks; | 209 g_thunks = *system_thunks; |
205 return sizeof(g_thunks); | 210 return sizeof(g_thunks); |
206 } | 211 } |
OLD | NEW |