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

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

Issue 2750373002: Revert of Mojo: Armed Watchers (Closed)
Patch Set: Created 3 years, 9 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/functions.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_C_SYSTEM_THUNKS_H_ 7 #ifndef MOJO_PUBLIC_C_SYSTEM_THUNKS_H_
8 #define MOJO_PUBLIC_C_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 #include "mojo/public/c/system/system_export.h"
15 15
16 // Structure used to bind the basic Mojo Core functions to an embedder 16 // The embedder needs to bind the basic Mojo Core functions of a DSO to those of
17 // implementation. This is intended to eventually be used as a stable ABI 17 // the embedder when loading a DSO that is dependent on mojo_system.
18 // between a Mojo embedder and some loaded application code, but for now it is 18 // The typical usage would look like:
19 // still effectively safe to rearrange entries as needed. 19 // base::ScopedNativeLibrary app_library(
20 // base::LoadNativeLibrary(app_path_, &error));
21 // typedef MojoResult (*MojoSetSystemThunksFn)(MojoSystemThunks*);
22 // MojoSetSystemThunksFn mojo_set_system_thunks_fn =
23 // reinterpret_cast<MojoSetSystemThunksFn>(app_library.GetFunctionPointer(
24 // "MojoSetSystemThunks"));
25 // MojoSystemThunks system_thunks = MojoMakeSystemThunks();
26 // size_t expected_size = mojo_set_system_thunks_fn(&system_thunks);
27 // if (expected_size > sizeof(MojoSystemThunks)) {
28 // LOG(ERROR)
29 // << "Invalid DSO. Expected MojoSystemThunks size: "
30 // << expected_size;
31 // break;
32 // }
33
34 // Structure used to bind the basic Mojo Core functions of a DSO to those of
35 // the embedder.
36 // This is the ABI between the embedder and the DSO. It can only have new
37 // functions added to the end. No other changes are supported.
20 #pragma pack(push, 8) 38 #pragma pack(push, 8)
21 struct MojoSystemThunks { 39 struct MojoSystemThunks {
22 size_t size; // Should be set to sizeof(MojoSystemThunks). 40 size_t size; // Should be set to sizeof(MojoSystemThunks).
23 MojoTimeTicks (*GetTimeTicksNow)(); 41 MojoTimeTicks (*GetTimeTicksNow)();
24 MojoResult (*Close)(MojoHandle handle); 42 MojoResult (*Close)(MojoHandle handle);
25 MojoResult (*Wait)(MojoHandle handle, 43 MojoResult (*Wait)(MojoHandle handle,
26 MojoHandleSignals signals, 44 MojoHandleSignals signals,
27 MojoDeadline deadline, 45 MojoDeadline deadline,
28 struct MojoHandleSignalsState* signals_state); 46 struct MojoHandleSignalsState* signals_state);
29 MojoResult (*WaitMany)(const MojoHandle* handles, 47 MojoResult (*WaitMany)(const MojoHandle* handles,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 MojoResult (*AddHandle)(MojoHandle wait_set, 108 MojoResult (*AddHandle)(MojoHandle wait_set,
91 MojoHandle handle, 109 MojoHandle handle,
92 MojoHandleSignals signals); 110 MojoHandleSignals signals);
93 MojoResult (*RemoveHandle)(MojoHandle wait_set, 111 MojoResult (*RemoveHandle)(MojoHandle wait_set,
94 MojoHandle handle); 112 MojoHandle handle);
95 MojoResult (*GetReadyHandles)(MojoHandle wait_set, 113 MojoResult (*GetReadyHandles)(MojoHandle wait_set,
96 uint32_t* count, 114 uint32_t* count,
97 MojoHandle* handles, 115 MojoHandle* handles,
98 MojoResult* results, 116 MojoResult* results,
99 struct MojoHandleSignalsState* signals_states); 117 struct MojoHandleSignalsState* signals_states);
100 MojoResult (*CreateWatcher)(MojoWatcherCallback callback, 118 MojoResult (*Watch)(MojoHandle handle,
101 MojoHandle* watcher_handle);
102 MojoResult (*Watch)(MojoHandle watcher_handle,
103 MojoHandle handle,
104 MojoHandleSignals signals, 119 MojoHandleSignals signals,
120 MojoWatchCallback callback,
105 uintptr_t context); 121 uintptr_t context);
106 MojoResult (*CancelWatch)(MojoHandle watcher_handle, uintptr_t context); 122 MojoResult (*CancelWatch)(MojoHandle handle, uintptr_t context);
107 MojoResult (*ArmWatcher)(MojoHandle watcher_handle,
108 uint32_t* num_ready_contexts,
109 uintptr_t* ready_contexts,
110 MojoResult* ready_results,
111 MojoHandleSignalsState* ready_signals_states);
112 MojoResult (*FuseMessagePipes)(MojoHandle handle0, MojoHandle handle1); 123 MojoResult (*FuseMessagePipes)(MojoHandle handle0, MojoHandle handle1);
113 MojoResult (*WriteMessageNew)(MojoHandle message_pipe_handle, 124 MojoResult (*WriteMessageNew)(MojoHandle message_pipe_handle,
114 MojoMessageHandle message, 125 MojoMessageHandle message,
115 MojoWriteMessageFlags flags); 126 MojoWriteMessageFlags flags);
116 MojoResult (*ReadMessageNew)(MojoHandle message_pipe_handle, 127 MojoResult (*ReadMessageNew)(MojoHandle message_pipe_handle,
117 MojoMessageHandle* message, 128 MojoMessageHandle* message,
118 uint32_t* num_bytes, 129 uint32_t* num_bytes,
119 MojoHandle* handles, 130 MojoHandle* handles,
120 uint32_t* num_handles, 131 uint32_t* num_handles,
121 MojoReadMessageFlags flags); 132 MojoReadMessageFlags flags);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // The contents of |system_thunks| are copied. 169 // The contents of |system_thunks| are copied.
159 typedef size_t (*MojoSetSystemThunksFn)( 170 typedef size_t (*MojoSetSystemThunksFn)(
160 const struct MojoSystemThunks* system_thunks); 171 const struct MojoSystemThunks* system_thunks);
161 172
162 // A function for setting up the embedder's own system thunks. This should only 173 // A function for setting up the embedder's own system thunks. This should only
163 // be called by Mojo embedder code. 174 // be called by Mojo embedder code.
164 MOJO_SYSTEM_EXPORT size_t MojoEmbedderSetSystemThunks( 175 MOJO_SYSTEM_EXPORT size_t MojoEmbedderSetSystemThunks(
165 const struct MojoSystemThunks* system_thunks); 176 const struct MojoSystemThunks* system_thunks);
166 177
167 #endif // MOJO_PUBLIC_C_SYSTEM_THUNKS_H_ 178 #endif // MOJO_PUBLIC_C_SYSTEM_THUNKS_H_
OLDNEW
« no previous file with comments | « mojo/public/c/system/functions.h ('k') | mojo/public/c/system/thunks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698