OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 // Note: This header should be compilable as C. | 5 // Note: This header should be compilable as C. |
6 | 6 |
7 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 7 #ifndef MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
8 #define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 8 #define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
9 | 9 |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 MojoResult (*DuplicateBufferHandle)( | 94 MojoResult (*DuplicateBufferHandle)( |
95 MojoHandle buffer_handle, | 95 MojoHandle buffer_handle, |
96 const struct MojoDuplicateBufferHandleOptions* options, | 96 const struct MojoDuplicateBufferHandleOptions* options, |
97 MojoHandle* new_buffer_handle); | 97 MojoHandle* new_buffer_handle); |
98 MojoResult (*MapBuffer)(MojoHandle buffer_handle, | 98 MojoResult (*MapBuffer)(MojoHandle buffer_handle, |
99 uint64_t offset, | 99 uint64_t offset, |
100 uint64_t num_bytes, | 100 uint64_t num_bytes, |
101 void** buffer, | 101 void** buffer, |
102 MojoMapBufferFlags flags); | 102 MojoMapBufferFlags flags); |
103 MojoResult (*UnmapBuffer)(void* buffer); | 103 MojoResult (*UnmapBuffer)(void* buffer); |
| 104 // TODO(vtl): The next time an ABI-breaking change is made, re-order the |
| 105 // following elements (to match the order in |Core|). |
| 106 MojoResult (*GetBufferInformation)(MojoHandle buffer_handle, |
| 107 struct MojoBufferInformation* info, |
| 108 uint32_t info_num_bytes); |
104 }; | 109 }; |
105 #pragma pack(pop) | 110 #pragma pack(pop) |
106 | 111 |
107 | 112 |
108 #ifdef __cplusplus | 113 #ifdef __cplusplus |
109 // Intended to be called from the embedder. Returns a |MojoCore| initialized | 114 // Intended to be called from the embedder. Returns a |MojoCore| initialized |
110 // to contain pointers to each of the embedder's MojoCore functions. | 115 // to contain pointers to each of the embedder's MojoCore functions. |
111 inline MojoSystemThunks MojoMakeSystemThunks() { | 116 inline MojoSystemThunks MojoMakeSystemThunks() { |
112 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks), | 117 MojoSystemThunks system_thunks = { |
113 MojoGetTimeTicksNow, | 118 sizeof(MojoSystemThunks), |
114 MojoClose, | 119 MojoGetTimeTicksNow, |
115 MojoWait, | 120 MojoClose, |
116 MojoWaitMany, | 121 MojoWait, |
117 MojoCreateMessagePipe, | 122 MojoWaitMany, |
118 MojoWriteMessage, | 123 MojoCreateMessagePipe, |
119 MojoReadMessage, | 124 MojoWriteMessage, |
120 MojoCreateDataPipe, | 125 MojoReadMessage, |
121 MojoWriteData, | 126 MojoCreateDataPipe, |
122 MojoBeginWriteData, | 127 MojoWriteData, |
123 MojoEndWriteData, | 128 MojoBeginWriteData, |
124 MojoReadData, | 129 MojoEndWriteData, |
125 MojoBeginReadData, | 130 MojoReadData, |
126 MojoEndReadData, | 131 MojoBeginReadData, |
127 MojoCreateSharedBuffer, | 132 MojoEndReadData, |
128 MojoDuplicateBufferHandle, | 133 MojoCreateSharedBuffer, |
129 MojoMapBuffer, | 134 MojoDuplicateBufferHandle, |
130 MojoUnmapBuffer}; | 135 MojoMapBuffer, |
| 136 MojoUnmapBuffer, |
| 137 MojoGetBufferInformation, |
| 138 }; |
131 return system_thunks; | 139 return system_thunks; |
132 } | 140 } |
133 #endif | 141 #endif |
134 | 142 |
135 | 143 |
136 // Use this type for the function found by dynamically discovering it in | 144 // Use this type for the function found by dynamically discovering it in |
137 // a DSO linked with mojo_system. For example: | 145 // a DSO linked with mojo_system. For example: |
138 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = | 146 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = |
139 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( | 147 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( |
140 // "MojoSetSystemThunks")); | 148 // "MojoSetSystemThunks")); |
141 // The expected size of |system_thunks} is returned. | 149 // The expected size of |system_thunks} is returned. |
142 // The contents of |system_thunks| are copied. | 150 // The contents of |system_thunks| are copied. |
143 typedef size_t (*MojoSetSystemThunksFn)( | 151 typedef size_t (*MojoSetSystemThunksFn)( |
144 const struct MojoSystemThunks* system_thunks); | 152 const struct MojoSystemThunks* system_thunks); |
145 | 153 |
146 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ | 154 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ |
OLD | NEW |