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/system/core.h" | 5 #include "mojo/public/system/core.h" |
6 | 6 |
| 7 #include "base/logging.h" |
7 #include "mojo/system/core_impl.h" | 8 #include "mojo/system/core_impl.h" |
8 | 9 |
9 extern "C" { | 10 extern "C" { |
10 | 11 |
11 MojoResult MojoClose(MojoHandle handle) { | 12 MojoResult MojoClose(MojoHandle handle) { |
| 13 DCHECK(mojo::system::CoreImpl::Get()) << "CoreImpl not initialized."; |
12 return mojo::system::CoreImpl::Get()->Close(handle); | 14 return mojo::system::CoreImpl::Get()->Close(handle); |
13 } | 15 } |
14 | 16 |
15 MojoResult MojoWait(MojoHandle handle, | 17 MojoResult MojoWait(MojoHandle handle, |
16 MojoWaitFlags flags, | 18 MojoWaitFlags flags, |
17 MojoDeadline deadline) { | 19 MojoDeadline deadline) { |
| 20 DCHECK(mojo::system::CoreImpl::Get()) << "CoreImpl not initialized."; |
18 return mojo::system::CoreImpl::Get()->Wait(handle, flags, deadline); | 21 return mojo::system::CoreImpl::Get()->Wait(handle, flags, deadline); |
19 } | 22 } |
20 | 23 |
21 MojoResult MojoWaitMany(const MojoHandle* handles, | 24 MojoResult MojoWaitMany(const MojoHandle* handles, |
22 const MojoWaitFlags* flags, | 25 const MojoWaitFlags* flags, |
23 uint32_t num_handles, | 26 uint32_t num_handles, |
24 MojoDeadline deadline) { | 27 MojoDeadline deadline) { |
| 28 DCHECK(mojo::system::CoreImpl::Get()) << "CoreImpl not initialized."; |
25 return mojo::system::CoreImpl::Get()->WaitMany(handles, flags, num_handles, | 29 return mojo::system::CoreImpl::Get()->WaitMany(handles, flags, num_handles, |
26 deadline); | 30 deadline); |
27 } | 31 } |
28 | 32 |
29 MojoResult MojoCreateMessagePipe(MojoHandle* handle_0, MojoHandle* handle_1) { | 33 MojoResult MojoCreateMessagePipe(MojoHandle* handle_0, MojoHandle* handle_1) { |
| 34 DCHECK(mojo::system::CoreImpl::Get()) << "CoreImpl not initialized."; |
30 return mojo::system::CoreImpl::Get()->CreateMessagePipe(handle_0, handle_1); | 35 return mojo::system::CoreImpl::Get()->CreateMessagePipe(handle_0, handle_1); |
31 } | 36 } |
32 | 37 |
33 MojoResult MojoWriteMessage(MojoHandle handle, | 38 MojoResult MojoWriteMessage(MojoHandle handle, |
34 const void* bytes, uint32_t num_bytes, | 39 const void* bytes, uint32_t num_bytes, |
35 const MojoHandle* handles, uint32_t num_handles, | 40 const MojoHandle* handles, uint32_t num_handles, |
36 MojoWriteMessageFlags flags) { | 41 MojoWriteMessageFlags flags) { |
| 42 DCHECK(mojo::system::CoreImpl::Get()) << "CoreImpl not initialized."; |
37 return mojo::system::CoreImpl::Get()->WriteMessage(handle, | 43 return mojo::system::CoreImpl::Get()->WriteMessage(handle, |
38 bytes, num_bytes, | 44 bytes, num_bytes, |
39 handles, num_handles, | 45 handles, num_handles, |
40 flags); | 46 flags); |
41 } | 47 } |
42 | 48 |
43 MojoResult MojoReadMessage(MojoHandle handle, | 49 MojoResult MojoReadMessage(MojoHandle handle, |
44 void* bytes, uint32_t* num_bytes, | 50 void* bytes, uint32_t* num_bytes, |
45 MojoHandle* handles, uint32_t* num_handles, | 51 MojoHandle* handles, uint32_t* num_handles, |
46 MojoReadMessageFlags flags) { | 52 MojoReadMessageFlags flags) { |
| 53 DCHECK(mojo::system::CoreImpl::Get()) << "CoreImpl not initialized."; |
47 return mojo::system::CoreImpl::Get()->ReadMessage(handle, | 54 return mojo::system::CoreImpl::Get()->ReadMessage(handle, |
48 bytes, num_bytes, | 55 bytes, num_bytes, |
49 handles, num_handles, | 56 handles, num_handles, |
50 flags); | 57 flags); |
51 } | 58 } |
52 | 59 |
53 } // extern "C" | 60 } // extern "C" |
OLD | NEW |