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