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/c/system/thunks.h" | 5 #include "mojo/public/c/system/thunks.h" |
6 | 6 |
7 #include <assert.h> | 7 #include <assert.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.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 MojoQueryHandleSignalsState( |
| 26 MojoHandle handle, |
| 27 struct MojoHandleSignalsState* signals_state) { |
| 28 assert(g_thunks.QueryHandleSignalsState); |
| 29 return g_thunks.QueryHandleSignalsState(handle, signals_state); |
| 30 } |
| 31 |
25 MojoResult MojoWait(MojoHandle handle, | 32 MojoResult MojoWait(MojoHandle handle, |
26 MojoHandleSignals signals, | 33 MojoHandleSignals signals, |
27 MojoDeadline deadline, | 34 MojoDeadline deadline, |
28 struct MojoHandleSignalsState* signals_state) { | 35 struct MojoHandleSignalsState* signals_state) { |
29 assert(g_thunks.Wait); | 36 assert(g_thunks.Wait); |
30 return g_thunks.Wait(handle, signals, deadline, signals_state); | 37 return g_thunks.Wait(handle, signals, deadline, signals_state); |
31 } | 38 } |
32 | 39 |
33 MojoResult MojoWaitMany(const MojoHandle* handles, | 40 MojoResult MojoWaitMany(const MojoHandle* handles, |
34 const MojoHandleSignals* signals, | 41 const MojoHandleSignals* signals, |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 return g_thunks.GetProperty(type, value); | 310 return g_thunks.GetProperty(type, value); |
304 } | 311 } |
305 | 312 |
306 } // extern "C" | 313 } // extern "C" |
307 | 314 |
308 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { | 315 size_t MojoEmbedderSetSystemThunks(const MojoSystemThunks* system_thunks) { |
309 if (system_thunks->size >= sizeof(g_thunks)) | 316 if (system_thunks->size >= sizeof(g_thunks)) |
310 g_thunks = *system_thunks; | 317 g_thunks = *system_thunks; |
311 return sizeof(g_thunks); | 318 return sizeof(g_thunks); |
312 } | 319 } |
OLD | NEW |