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

Side by Side Diff: mojo/public/c/system/thunks.h

Issue 2044023004: Mojo: Eliminate duplicate C API symbols (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 6 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
« no previous file with comments | « mojo/public/c/system/system_export.h ('k') | mojo/public/c/system/thunks.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_C_SYSTEM_THUNKS_H_
8 #define MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ 8 #define MOJO_PUBLIC_C_SYSTEM_THUNKS_H_
9 9
10 #include <stddef.h> 10 #include <stddef.h>
11 #include <stdint.h> 11 #include <stdint.h>
12 12
13 #include "mojo/public/c/system/core.h" 13 #include "mojo/public/c/system/core.h"
14 #include "mojo/public/c/system/system_export.h"
14 15
15 // The embedder needs to bind the basic Mojo Core functions of a DSO to those of 16 // The embedder needs to bind the basic Mojo Core functions of a DSO to those of
16 // the embedder when loading a DSO that is dependent on mojo_system. 17 // the embedder when loading a DSO that is dependent on mojo_system.
17 // The typical usage would look like: 18 // The typical usage would look like:
18 // base::ScopedNativeLibrary app_library( 19 // base::ScopedNativeLibrary app_library(
19 // base::LoadNativeLibrary(app_path_, &error)); 20 // base::LoadNativeLibrary(app_path_, &error));
20 // typedef MojoResult (*MojoSetSystemThunksFn)(MojoSystemThunks*); 21 // typedef MojoResult (*MojoSetSystemThunksFn)(MojoSystemThunks*);
21 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = 22 // MojoSetSystemThunksFn mojo_set_system_thunks_fn =
22 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( 23 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer(
23 // "MojoSetSystemThunks")); 24 // "MojoSetSystemThunks"));
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 MojoPlatformSharedBufferHandleFlags flags, 149 MojoPlatformSharedBufferHandleFlags flags,
149 MojoHandle* mojo_handle); 150 MojoHandle* mojo_handle);
150 MojoResult (*UnwrapPlatformSharedBufferHandle)( 151 MojoResult (*UnwrapPlatformSharedBufferHandle)(
151 MojoHandle mojo_handle, 152 MojoHandle mojo_handle,
152 struct MojoPlatformHandle* platform_handle, 153 struct MojoPlatformHandle* platform_handle,
153 size_t* num_bytes, 154 size_t* num_bytes,
154 MojoPlatformSharedBufferHandleFlags* flags); 155 MojoPlatformSharedBufferHandleFlags* flags);
155 }; 156 };
156 #pragma pack(pop) 157 #pragma pack(pop)
157 158
158
159 #ifdef __cplusplus
160 // Intended to be called from the embedder. Returns a |MojoCore| initialized
161 // to contain pointers to each of the embedder's MojoCore functions.
162 inline MojoSystemThunks MojoMakeSystemThunks() {
163 MojoSystemThunks system_thunks = {sizeof(MojoSystemThunks),
164 MojoGetTimeTicksNow,
165 MojoClose,
166 MojoWait,
167 MojoWaitMany,
168 MojoCreateMessagePipe,
169 MojoWriteMessage,
170 MojoReadMessage,
171 MojoCreateDataPipe,
172 MojoWriteData,
173 MojoBeginWriteData,
174 MojoEndWriteData,
175 MojoReadData,
176 MojoBeginReadData,
177 MojoEndReadData,
178 MojoCreateSharedBuffer,
179 MojoDuplicateBufferHandle,
180 MojoMapBuffer,
181 MojoUnmapBuffer,
182 MojoCreateWaitSet,
183 MojoAddHandle,
184 MojoRemoveHandle,
185 MojoGetReadyHandles,
186 MojoWatch,
187 MojoCancelWatch,
188 MojoFuseMessagePipes,
189 MojoWriteMessageNew,
190 MojoReadMessageNew,
191 MojoAllocMessage,
192 MojoFreeMessage,
193 MojoGetMessageBuffer,
194 MojoWrapPlatformHandle,
195 MojoUnwrapPlatformHandle,
196 MojoWrapPlatformSharedBufferHandle,
197 MojoUnwrapPlatformSharedBufferHandle};
198 return system_thunks;
199 }
200 #endif
201
202
203 // Use this type for the function found by dynamically discovering it in 159 // Use this type for the function found by dynamically discovering it in
204 // a DSO linked with mojo_system. For example: 160 // a DSO linked with mojo_system. For example:
205 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = 161 // MojoSetSystemThunksFn mojo_set_system_thunks_fn =
206 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( 162 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer(
207 // "MojoSetSystemThunks")); 163 // "MojoSetSystemThunks"));
208 // The expected size of |system_thunks} is returned. 164 // The expected size of |system_thunks| is returned.
209 // The contents of |system_thunks| are copied. 165 // The contents of |system_thunks| are copied.
210 typedef size_t (*MojoSetSystemThunksFn)( 166 typedef size_t (*MojoSetSystemThunksFn)(
211 const struct MojoSystemThunks* system_thunks); 167 const struct MojoSystemThunks* system_thunks);
212 168
213 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ 169 // A function for setting up the embedder's own system thunks. This should only
170 // be called by Mojo embedder code.
171 MOJO_SYSTEM_EXPORT size_t MojoEmbedderSetSystemThunks(
172 const struct MojoSystemThunks* system_thunks);
173
174 #endif // MOJO_PUBLIC_C_SYSTEM_THUNKS_H_
OLDNEW
« no previous file with comments | « mojo/public/c/system/system_export.h ('k') | mojo/public/c/system/thunks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698