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

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

Issue 2106433002: Add thunks for wait set operations, together with public tests. (Closed) Base URL: https://github.com/domokit/mojo.git@work791_wait_set_6-x-work790_wait_set_5.4
Patch Set: doh Created 4 years, 5 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/platform/nacl/mojo_irt.h ('k') | mojo/public/platform/native/system_thunks.c » ('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_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>
11 11
12 #include "mojo/public/c/system/buffer.h" 12 #include "mojo/public/c/system/buffer.h"
13 #include "mojo/public/c/system/data_pipe.h" 13 #include "mojo/public/c/system/data_pipe.h"
14 #include "mojo/public/c/system/handle.h" 14 #include "mojo/public/c/system/handle.h"
15 #include "mojo/public/c/system/message_pipe.h" 15 #include "mojo/public/c/system/message_pipe.h"
16 #include "mojo/public/c/system/result.h" 16 #include "mojo/public/c/system/result.h"
17 #include "mojo/public/c/system/time.h" 17 #include "mojo/public/c/system/time.h"
18 #include "mojo/public/c/system/wait.h" 18 #include "mojo/public/c/system/wait.h"
19 #include "mojo/public/c/system/wait_set.h"
19 20
20 // The embedder needs to bind the basic Mojo Core functions of a DSO to those of 21 // The embedder needs to bind the basic Mojo Core functions of a DSO to those of
21 // the embedder when loading a DSO that is dependent on mojo_system. 22 // the embedder when loading a DSO that is dependent on mojo_system.
22 // The typical usage would look like: 23 // The typical usage would look like:
23 // base::ScopedNativeLibrary app_library( 24 // base::ScopedNativeLibrary app_library(
24 // base::LoadNativeLibrary(app_path_, &error)); 25 // base::LoadNativeLibrary(app_path_, &error));
25 // typedef MojoResult (*MojoSetSystemThunksFn)(MojoSystemThunks*); 26 // typedef MojoResult (*MojoSetSystemThunksFn)(MojoSystemThunks*);
26 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = 27 // MojoSetSystemThunksFn mojo_set_system_thunks_fn =
27 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( 28 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer(
28 // "MojoSetSystemThunks")); 29 // "MojoSetSystemThunks"));
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 MojoResult (*GetRights)(MojoHandle handle, MojoHandleRights* rights); 130 MojoResult (*GetRights)(MojoHandle handle, MojoHandleRights* rights);
130 MojoResult (*DuplicateHandleWithReducedRights)( 131 MojoResult (*DuplicateHandleWithReducedRights)(
131 MojoHandle handle, 132 MojoHandle handle,
132 MojoHandleRights rights_to_remove, 133 MojoHandleRights rights_to_remove,
133 MojoHandle* new_handle); 134 MojoHandle* new_handle);
134 MojoResult (*DuplicateHandle)(MojoHandle handle, MojoHandle* new_handle); 135 MojoResult (*DuplicateHandle)(MojoHandle handle, MojoHandle* new_handle);
135 MojoResult (*ReplaceHandleWithReducedRights)( 136 MojoResult (*ReplaceHandleWithReducedRights)(
136 MojoHandle handle, 137 MojoHandle handle,
137 MojoHandleRights rights_to_remove, 138 MojoHandleRights rights_to_remove,
138 MojoHandle* replacement_handle); 139 MojoHandle* replacement_handle);
140 MojoResult (*CreateWaitSet)(const struct MojoCreateWaitSetOptions* options,
141 MojoHandle* handle);
142 MojoResult (*WaitSetAdd)(MojoHandle wait_set_handle,
143 MojoHandle handle,
144 MojoHandleSignals signals,
145 uint64_t cookie,
146 const struct MojoWaitSetAddOptions* options);
147 MojoResult (*WaitSetRemove)(MojoHandle wait_set_handle, uint64_t cookie);
148 MojoResult (*WaitSetWait)(MojoHandle wait_set_handle,
149 MojoDeadline deadline,
150 uint32_t* num_results,
151 struct MojoWaitSetResult* results,
152 uint32_t* max_results);
139 }; 153 };
140 #pragma pack(pop) 154 #pragma pack(pop)
141 155
142
143 #ifdef __cplusplus 156 #ifdef __cplusplus
144 // Intended to be called from the embedder. Returns a |MojoCore| initialized 157 // Intended to be called from the embedder. Returns a |MojoCore| initialized
145 // to contain pointers to each of the embedder's MojoCore functions. 158 // to contain pointers to each of the embedder's MojoCore functions.
146 inline MojoSystemThunks MojoMakeSystemThunks() { 159 inline MojoSystemThunks MojoMakeSystemThunks() {
147 MojoSystemThunks system_thunks = { 160 MojoSystemThunks system_thunks = {
148 sizeof(MojoSystemThunks), 161 sizeof(MojoSystemThunks),
149 MojoGetTimeTicksNow, 162 MojoGetTimeTicksNow,
150 MojoClose, 163 MojoClose,
151 MojoWait, 164 MojoWait,
152 MojoWaitMany, 165 MojoWaitMany,
(...skipping 13 matching lines...) Expand all
166 MojoUnmapBuffer, 179 MojoUnmapBuffer,
167 MojoGetBufferInformation, 180 MojoGetBufferInformation,
168 MojoSetDataPipeConsumerOptions, 181 MojoSetDataPipeConsumerOptions,
169 MojoGetDataPipeConsumerOptions, 182 MojoGetDataPipeConsumerOptions,
170 MojoSetDataPipeProducerOptions, 183 MojoSetDataPipeProducerOptions,
171 MojoGetDataPipeProducerOptions, 184 MojoGetDataPipeProducerOptions,
172 MojoGetRights, 185 MojoGetRights,
173 MojoDuplicateHandleWithReducedRights, 186 MojoDuplicateHandleWithReducedRights,
174 MojoDuplicateHandle, 187 MojoDuplicateHandle,
175 MojoReplaceHandleWithReducedRights, 188 MojoReplaceHandleWithReducedRights,
189 MojoCreateWaitSet,
190 MojoWaitSetAdd,
191 MojoWaitSetRemove,
192 MojoWaitSetWait,
176 }; 193 };
177 return system_thunks; 194 return system_thunks;
178 } 195 }
179 #endif 196 #endif
180 197
181 198
182 // Use this type for the function found by dynamically discovering it in 199 // Use this type for the function found by dynamically discovering it in
183 // a DSO linked with mojo_system. For example: 200 // a DSO linked with mojo_system. For example:
184 // MojoSetSystemThunksFn mojo_set_system_thunks_fn = 201 // MojoSetSystemThunksFn mojo_set_system_thunks_fn =
185 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer( 202 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer(
186 // "MojoSetSystemThunks")); 203 // "MojoSetSystemThunks"));
187 // The expected size of |system_thunks} is returned. 204 // The expected size of |system_thunks} is returned.
188 // The contents of |system_thunks| are copied. 205 // The contents of |system_thunks| are copied.
189 typedef size_t (*MojoSetSystemThunksFn)( 206 typedef size_t (*MojoSetSystemThunksFn)(
190 const struct MojoSystemThunks* system_thunks); 207 const struct MojoSystemThunks* system_thunks);
191 208
192 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_ 209 #endif // MOJO_PUBLIC_PLATFORM_NATIVE_SYSTEM_THUNKS_H_
OLDNEW
« no previous file with comments | « mojo/public/platform/nacl/mojo_irt.h ('k') | mojo/public/platform/native/system_thunks.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698