Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: mojo/public/platform/native/system_thunks.h

Issue 1995753002: [mojo-edk] Expose portable API for platform handle wrapping (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 MojoHandle* handles, 129 MojoHandle* handles,
130 uint32_t* num_handles, 130 uint32_t* num_handles,
131 MojoReadMessageFlags flags); 131 MojoReadMessageFlags flags);
132 MojoResult (*AllocMessage)(uint32_t num_bytes, 132 MojoResult (*AllocMessage)(uint32_t num_bytes,
133 const MojoHandle* handles, 133 const MojoHandle* handles,
134 uint32_t num_handles, 134 uint32_t num_handles,
135 MojoAllocMessageFlags flags, 135 MojoAllocMessageFlags flags,
136 MojoMessageHandle* message); 136 MojoMessageHandle* message);
137 MojoResult (*FreeMessage)(MojoMessageHandle message); 137 MojoResult (*FreeMessage)(MojoMessageHandle message);
138 MojoResult (*GetMessageBuffer)(MojoMessageHandle message, void** buffer); 138 MojoResult (*GetMessageBuffer)(MojoMessageHandle message, void** buffer);
139 MojoResult (*WrapPlatformHandle)(MojoPlatformHandle platform_handle,
140 MojoHandle* mojo_handle);
141 MojoResult (*UnwrapPlatformHandle)(MojoHandle mojo_handle,
142 MojoPaltformHandle* platform_handle);
143 MojoResult (*WrapPlatformSharedBufferHandle)(
144 MojoPlatformHandle platform_handle,
145 size_t num_bytes,
146 MojoPlatformSharedBufferHandleFlags flags,
147 MojoHandle* mojo_handle);
148 MojoResult (*UnwrapPlatformSharedBufferHandle)(
149 MojoHandle mojo_handle,
150 MojoPlatformHandle* platform_handle,
151 size_t* num_bytes,
152 MojoPlatformSharedBufferHandleFlags* flags);
139 }; 153 };
140 #pragma pack(pop) 154 #pragma pack(pop)
141 155
142 156
143 #ifdef __cplusplus 157 #ifdef __cplusplus
144 // Intended to be called from the embedder. Returns a |MojoCore| initialized 158 // Intended to be called from the embedder. Returns a |MojoCore| initialized
145 // to contain pointers to each of the embedder's MojoCore functions. 159 // to contain pointers to each of the embedder's MojoCore functions.
146 inline MojoSystemThunks MojoMakeSystemThunks() { 160 inline MojoSystemThunks MojoMakeSystemThunks() {
147 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks), 161 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks),
148 MojoGetTimeTicksNow, 162 MojoGetTimeTicksNow,
(...skipping 18 matching lines...) Expand all
167 MojoAddHandle, 181 MojoAddHandle,
168 MojoRemoveHandle, 182 MojoRemoveHandle,
169 MojoGetReadyHandles, 183 MojoGetReadyHandles,
170 MojoWatch, 184 MojoWatch,
171 MojoCancelWatch, 185 MojoCancelWatch,
172 MojoFuseMessagePipes, 186 MojoFuseMessagePipes,
173 MojoWriteMessageNew, 187 MojoWriteMessageNew,
174 MojoReadMessageNew, 188 MojoReadMessageNew,
175 MojoAllocMessage, 189 MojoAllocMessage,
176 MojoFreeMessage, 190 MojoFreeMessage,
177 MojoGetMessageBuffer}; 191 MojoGetMessageBuffer,
192 MojoWrapPlatformHandle,
193 MojoUnwrapPlatformHandle,
194 MojoWrapPlatformSharedBufferHandle,
195 MojoUnwrapPlatformSharedBufferHandle};
178 return system_thunks; 196 return system_thunks;
179 } 197 }
180 #endif 198 #endif
181 199
182 200
183 // Use this type for the function found by dynamically discovering it in 201 // Use this type for the function found by dynamically discovering it in
184 // a DSO linked with mojo_system. For example: 202 // a DSO linked with mojo_system. For example:
185 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = 203 // MojoSetSystemThunksFn mojo_set_system_thunks_fn =
186 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( 204 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer(
187 // "MojoSetSystemThunks")); 205 // "MojoSetSystemThunks"));
188 // The expected size of |system_thunks} is returned. 206 // The expected size of |system_thunks} is returned.
189 // The contents of |system_thunks| are copied. 207 // The contents of |system_thunks| are copied.
190 typedef size_t (*MojoSetSystemThunksFn)( 208 typedef size_t (*MojoSetSystemThunksFn)(
191 const struct MojoSystemThunks* system_thunks); 209 const struct MojoSystemThunks* system_thunks);
192 210
193 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ 211 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698