Chromium Code Reviews| Index: mojo/public/platform/native/system_thunks.h |
| diff --git a/mojo/public/platform/native/system_thunks.h b/mojo/public/platform/native/system_thunks.h |
| index de82eba1bfc1e7adedb30737f1c575e0de8c13c0..78beac9aa05caabf4196f19f6096aef23aa3f060 100644 |
| --- a/mojo/public/platform/native/system_thunks.h |
| +++ b/mojo/public/platform/native/system_thunks.h |
| @@ -2,9 +2,13 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| +// Note: This header should be compilable as C. |
|
qsr
2014/09/23 14:20:49
You added this comment twice.
tburkard
2014/09/23 14:39:06
Done. Whoops, one of the other files, functions.h,
|
| + |
| #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
| #define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
| +// Note: This header should be compilable as C. |
| + |
| #include <stddef.h> |
| #include "mojo/public/c/system/core.h" |
| @@ -43,9 +47,10 @@ struct MojoSystemThunks { |
| const MojoHandleSignals* signals, |
| uint32_t num_handles, |
| MojoDeadline deadline); |
| - MojoResult (*CreateMessagePipe)(const MojoCreateMessagePipeOptions* options, |
| - MojoHandle* message_pipe_handle0, |
| - MojoHandle* message_pipe_handle1); |
| + MojoResult (*CreateMessagePipe)( |
| + const struct MojoCreateMessagePipeOptions* options, |
| + MojoHandle* message_pipe_handle0, |
| + MojoHandle* message_pipe_handle1); |
| MojoResult (*WriteMessage)(MojoHandle message_pipe_handle, |
| const void* bytes, |
| uint32_t num_bytes, |
| @@ -58,7 +63,7 @@ struct MojoSystemThunks { |
| MojoHandle* handles, |
| uint32_t* num_handles, |
| MojoReadMessageFlags flags); |
| - MojoResult (*CreateDataPipe)(const MojoCreateDataPipeOptions* options, |
| + MojoResult (*CreateDataPipe)(const struct MojoCreateDataPipeOptions* options, |
| MojoHandle* data_pipe_producer_handle, |
| MojoHandle* data_pipe_consumer_handle); |
| MojoResult (*WriteData)(MojoHandle data_pipe_producer_handle, |
| @@ -82,12 +87,12 @@ struct MojoSystemThunks { |
| MojoResult (*EndReadData)(MojoHandle data_pipe_consumer_handle, |
| uint32_t num_elements_read); |
| MojoResult (*CreateSharedBuffer)( |
| - const MojoCreateSharedBufferOptions* options, |
| + const struct MojoCreateSharedBufferOptions* options, |
| uint64_t num_bytes, |
| MojoHandle* shared_buffer_handle); |
| MojoResult (*DuplicateBufferHandle)( |
| MojoHandle buffer_handle, |
| - const MojoDuplicateBufferHandleOptions* options, |
| + const struct MojoDuplicateBufferHandleOptions* options, |
| MojoHandle* new_buffer_handle); |
| MojoResult (*MapBuffer)(MojoHandle buffer_handle, |
| uint64_t offset, |
| @@ -98,11 +103,13 @@ struct MojoSystemThunks { |
| }; |
| #pragma pack(pop) |
| + |
| +#ifndef __cplusplus |
|
qsr
2014/09/23 14:20:49
That should be #ifdef, and you should not modify t
tburkard
2014/09/23 14:39:06
Done.
|
| // Intended to be called from the embedder. Returns a |MojoCore| initialized |
| // to contain pointers to each of the embedder's MojoCore functions. |
| -inline MojoSystemThunks MojoMakeSystemThunks() { |
| - MojoSystemThunks system_thunks = { |
| - sizeof(MojoSystemThunks), |
| +inline struct MojoSystemThunks MojoMakeSystemThunks() { |
| + struct MojoSystemThunks system_thunks = { |
| + sizeof(struct MojoSystemThunks), |
| MojoGetTimeTicksNow, |
| MojoClose, |
| MojoWait, |
| @@ -124,6 +131,8 @@ inline MojoSystemThunks MojoMakeSystemThunks() { |
| }; |
| return system_thunks; |
| } |
| +#endif |
| + |
| // Use this type for the function found by dynamically discovering it in |
| // a DSO linked with mojo_system. For example: |
| @@ -132,6 +141,7 @@ inline MojoSystemThunks MojoMakeSystemThunks() { |
| // "MojoSetSystemThunks")); |
| // The expected size of |system_thunks} is returned. |
| // The contents of |system_thunks| are copied. |
| -typedef size_t (*MojoSetSystemThunksFn)(const MojoSystemThunks* system_thunks); |
| +typedef size_t (*MojoSetSystemThunksFn)( |
| + const struct MojoSystemThunks* system_thunks); |
| #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |