OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #ifndef MOJO_EDK_SYSTEM_CORE_H_ | 5 #ifndef MOJO_EDK_SYSTEM_CORE_H_ |
6 #define MOJO_EDK_SYSTEM_CORE_H_ | 6 #define MOJO_EDK_SYSTEM_CORE_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract | 131 // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract |
132 // of these methods is to look at the header files defining the corresponding | 132 // of these methods is to look at the header files defining the corresponding |
133 // API functions, referenced below. | 133 // API functions, referenced below. |
134 | 134 |
135 // These methods correspond to the API functions defined in | 135 // These methods correspond to the API functions defined in |
136 // "mojo/public/c/system/functions.h": | 136 // "mojo/public/c/system/functions.h": |
137 MojoTimeTicks GetTimeTicksNow(); | 137 MojoTimeTicks GetTimeTicksNow(); |
138 MojoResult Close(MojoHandle handle); | 138 MojoResult Close(MojoHandle handle); |
139 MojoResult QueryHandleSignalsState(MojoHandle handle, | 139 MojoResult QueryHandleSignalsState(MojoHandle handle, |
140 MojoHandleSignalsState* signals_state); | 140 MojoHandleSignalsState* signals_state); |
141 MojoResult Wait(MojoHandle handle, | |
142 MojoHandleSignals signals, | |
143 MojoDeadline deadline, | |
144 MojoHandleSignalsState* signals_state); | |
145 MojoResult WaitMany(const MojoHandle* handles, | |
146 const MojoHandleSignals* signals, | |
147 uint32_t num_handles, | |
148 MojoDeadline deadline, | |
149 uint32_t* result_index, | |
150 MojoHandleSignalsState* signals_states); | |
151 MojoResult CreateWatcher(MojoWatcherCallback callback, | 141 MojoResult CreateWatcher(MojoWatcherCallback callback, |
152 MojoHandle* watcher_handle); | 142 MojoHandle* watcher_handle); |
153 MojoResult Watch(MojoHandle watcher_handle, | 143 MojoResult Watch(MojoHandle watcher_handle, |
154 MojoHandle handle, | 144 MojoHandle handle, |
155 MojoHandleSignals signals, | 145 MojoHandleSignals signals, |
156 uintptr_t context); | 146 uintptr_t context); |
157 MojoResult CancelWatch(MojoHandle watcher_handle, uintptr_t context); | 147 MojoResult CancelWatch(MojoHandle watcher_handle, uintptr_t context); |
158 MojoResult ArmWatcher(MojoHandle watcher_handle, | 148 MojoResult ArmWatcher(MojoHandle watcher_handle, |
159 uint32_t* num_ready_contexts, | 149 uint32_t* num_ready_contexts, |
160 uintptr_t* ready_contexts, | 150 uintptr_t* ready_contexts, |
161 MojoResult* ready_results, | 151 MojoResult* ready_results, |
162 MojoHandleSignalsState* ready_signals_states); | 152 MojoHandleSignalsState* ready_signals_states); |
163 MojoResult AllocMessage(uint32_t num_bytes, | 153 MojoResult AllocMessage(uint32_t num_bytes, |
164 const MojoHandle* handles, | 154 const MojoHandle* handles, |
165 uint32_t num_handles, | 155 uint32_t num_handles, |
166 MojoAllocMessageFlags flags, | 156 MojoAllocMessageFlags flags, |
167 MojoMessageHandle* message); | 157 MojoMessageHandle* message); |
168 MojoResult FreeMessage(MojoMessageHandle message); | 158 MojoResult FreeMessage(MojoMessageHandle message); |
169 MojoResult GetMessageBuffer(MojoMessageHandle message, void** buffer); | 159 MojoResult GetMessageBuffer(MojoMessageHandle message, void** buffer); |
170 MojoResult GetProperty(MojoPropertyType type, void* value); | 160 MojoResult GetProperty(MojoPropertyType type, void* value); |
171 | 161 |
172 // These methods correspond to the API functions defined in | 162 // These methods correspond to the API functions defined in |
173 // "mojo/public/c/system/wait_set.h": | |
174 MojoResult CreateWaitSet(MojoHandle* wait_set_handle); | |
175 MojoResult AddHandle(MojoHandle wait_set_handle, | |
176 MojoHandle handle, | |
177 MojoHandleSignals signals); | |
178 MojoResult RemoveHandle(MojoHandle wait_set_handle, | |
179 MojoHandle handle); | |
180 MojoResult GetReadyHandles(MojoHandle wait_set_handle, | |
181 uint32_t* count, | |
182 MojoHandle* handles, | |
183 MojoResult* results, | |
184 MojoHandleSignalsState* signals_states); | |
185 | |
186 // These methods correspond to the API functions defined in | |
187 // "mojo/public/c/system/message_pipe.h": | 163 // "mojo/public/c/system/message_pipe.h": |
188 MojoResult CreateMessagePipe( | 164 MojoResult CreateMessagePipe( |
189 const MojoCreateMessagePipeOptions* options, | 165 const MojoCreateMessagePipeOptions* options, |
190 MojoHandle* message_pipe_handle0, | 166 MojoHandle* message_pipe_handle0, |
191 MojoHandle* message_pipe_handle1); | 167 MojoHandle* message_pipe_handle1); |
192 MojoResult WriteMessage(MojoHandle message_pipe_handle, | 168 MojoResult WriteMessage(MojoHandle message_pipe_handle, |
193 const void* bytes, | 169 const void* bytes, |
194 uint32_t num_bytes, | 170 uint32_t num_bytes, |
195 const MojoHandle* handles, | 171 const MojoHandle* handles, |
196 uint32_t num_handles, | 172 uint32_t num_handles, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 MojoHandle* mojo_handle); | 248 MojoHandle* mojo_handle); |
273 MojoResult UnwrapPlatformSharedBufferHandle( | 249 MojoResult UnwrapPlatformSharedBufferHandle( |
274 MojoHandle mojo_handle, | 250 MojoHandle mojo_handle, |
275 MojoPlatformHandle* platform_handle, | 251 MojoPlatformHandle* platform_handle, |
276 size_t* size, | 252 size_t* size, |
277 MojoPlatformSharedBufferHandleFlags* flags); | 253 MojoPlatformSharedBufferHandleFlags* flags); |
278 | 254 |
279 void GetActiveHandlesForTest(std::vector<MojoHandle>* handles); | 255 void GetActiveHandlesForTest(std::vector<MojoHandle>* handles); |
280 | 256 |
281 private: | 257 private: |
282 MojoResult WaitManyInternal(const MojoHandle* handles, | |
283 const MojoHandleSignals* signals, | |
284 uint32_t num_handles, | |
285 MojoDeadline deadline, | |
286 uint32_t* result_index, | |
287 HandleSignalsState* signals_states); | |
288 | |
289 // Used to pass ownership of our NodeController over to the IO thread in the | 258 // Used to pass ownership of our NodeController over to the IO thread in the |
290 // event that we're torn down before said thread. | 259 // event that we're torn down before said thread. |
291 static void PassNodeControllerToIOThread( | 260 static void PassNodeControllerToIOThread( |
292 std::unique_ptr<NodeController> node_controller); | 261 std::unique_ptr<NodeController> node_controller); |
293 | 262 |
294 // Guards node_controller_. | 263 // Guards node_controller_. |
295 // | 264 // |
296 // TODO(rockot): Consider removing this. It's only needed because we | 265 // TODO(rockot): Consider removing this. It's only needed because we |
297 // initialize node_controller_ lazily and that may happen on any thread. | 266 // initialize node_controller_ lazily and that may happen on any thread. |
298 // Otherwise it's effectively const and shouldn't need to be guarded. | 267 // Otherwise it's effectively const and shouldn't need to be guarded. |
(...skipping 20 matching lines...) Expand all Loading... |
319 // Properties that can be read using the MojoGetProperty() API. | 288 // Properties that can be read using the MojoGetProperty() API. |
320 bool property_sync_call_allowed_ = true; | 289 bool property_sync_call_allowed_ = true; |
321 | 290 |
322 DISALLOW_COPY_AND_ASSIGN(Core); | 291 DISALLOW_COPY_AND_ASSIGN(Core); |
323 }; | 292 }; |
324 | 293 |
325 } // namespace edk | 294 } // namespace edk |
326 } // namespace mojo | 295 } // namespace mojo |
327 | 296 |
328 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 297 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
OLD | NEW |