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 <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 void RequestShutdown(const base::Closure& callback); | 117 void RequestShutdown(const base::Closure& callback); |
118 | 118 |
119 // Watches on the given handle for the given signals, calling |callback| when | 119 // Watches on the given handle for the given signals, calling |callback| when |
120 // a signal is satisfied or when all signals become unsatisfiable. |callback| | 120 // a signal is satisfied or when all signals become unsatisfiable. |callback| |
121 // must satisfy stringent requirements -- see |Awakable::Awake()| in | 121 // must satisfy stringent requirements -- see |Awakable::Awake()| in |
122 // awakable.h. In particular, it must not call any Mojo system functions. | 122 // awakable.h. In particular, it must not call any Mojo system functions. |
123 MojoResult AsyncWait(MojoHandle handle, | 123 MojoResult AsyncWait(MojoHandle handle, |
124 MojoHandleSignals signals, | 124 MojoHandleSignals signals, |
125 const base::Callback<void(MojoResult)>& callback); | 125 const base::Callback<void(MojoResult)>& callback); |
126 | 126 |
| 127 MojoResult SetProperty(MojoPropertyType type, const void* value); |
| 128 |
127 // --------------------------------------------------------------------------- | 129 // --------------------------------------------------------------------------- |
128 | 130 |
129 // The following methods are essentially implementations of the Mojo Core | 131 // The following methods are essentially implementations of the Mojo Core |
130 // functions of the Mojo API, with the C interface translated to C++ by | 132 // functions of the Mojo API, with the C interface translated to C++ by |
131 // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract | 133 // "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 | 134 // of these methods is to look at the header files defining the corresponding |
133 // API functions, referenced below. | 135 // API functions, referenced below. |
134 | 136 |
135 // These methods correspond to the API functions defined in | 137 // These methods correspond to the API functions defined in |
136 // "mojo/public/c/system/functions.h": | 138 // "mojo/public/c/system/functions.h": |
(...skipping 14 matching lines...) Expand all Loading... |
151 MojoWatchCallback callback, | 153 MojoWatchCallback callback, |
152 uintptr_t context); | 154 uintptr_t context); |
153 MojoResult CancelWatch(MojoHandle handle, uintptr_t context); | 155 MojoResult CancelWatch(MojoHandle handle, uintptr_t context); |
154 MojoResult AllocMessage(uint32_t num_bytes, | 156 MojoResult AllocMessage(uint32_t num_bytes, |
155 const MojoHandle* handles, | 157 const MojoHandle* handles, |
156 uint32_t num_handles, | 158 uint32_t num_handles, |
157 MojoAllocMessageFlags flags, | 159 MojoAllocMessageFlags flags, |
158 MojoMessageHandle* message); | 160 MojoMessageHandle* message); |
159 MojoResult FreeMessage(MojoMessageHandle message); | 161 MojoResult FreeMessage(MojoMessageHandle message); |
160 MojoResult GetMessageBuffer(MojoMessageHandle message, void** buffer); | 162 MojoResult GetMessageBuffer(MojoMessageHandle message, void** buffer); |
| 163 MojoResult GetProperty(MojoPropertyType type, void* value); |
161 | 164 |
162 // These methods correspond to the API functions defined in | 165 // These methods correspond to the API functions defined in |
163 // "mojo/public/c/system/wait_set.h": | 166 // "mojo/public/c/system/wait_set.h": |
164 MojoResult CreateWaitSet(MojoHandle* wait_set_handle); | 167 MojoResult CreateWaitSet(MojoHandle* wait_set_handle); |
165 MojoResult AddHandle(MojoHandle wait_set_handle, | 168 MojoResult AddHandle(MojoHandle wait_set_handle, |
166 MojoHandle handle, | 169 MojoHandle handle, |
167 MojoHandleSignals signals); | 170 MojoHandleSignals signals); |
168 MojoResult RemoveHandle(MojoHandle wait_set_handle, | 171 MojoResult RemoveHandle(MojoHandle wait_set_handle, |
169 MojoHandle handle); | 172 MojoHandle handle); |
170 MojoResult GetReadyHandles(MojoHandle wait_set_handle, | 173 MojoResult GetReadyHandles(MojoHandle wait_set_handle, |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 // This is lazily initialized on first access. Always use GetNodeController() | 297 // This is lazily initialized on first access. Always use GetNodeController() |
295 // to access it. | 298 // to access it. |
296 std::unique_ptr<NodeController> node_controller_; | 299 std::unique_ptr<NodeController> node_controller_; |
297 | 300 |
298 base::Lock handles_lock_; | 301 base::Lock handles_lock_; |
299 HandleTable handles_; | 302 HandleTable handles_; |
300 | 303 |
301 base::Lock mapping_table_lock_; // Protects |mapping_table_|. | 304 base::Lock mapping_table_lock_; // Protects |mapping_table_|. |
302 MappingTable mapping_table_; | 305 MappingTable mapping_table_; |
303 | 306 |
| 307 base::Lock property_lock_; |
| 308 // Properties that can be read using the MojoGetProperty() API. |
| 309 bool property_sync_call_allowed_ = true; |
| 310 |
304 DISALLOW_COPY_AND_ASSIGN(Core); | 311 DISALLOW_COPY_AND_ASSIGN(Core); |
305 }; | 312 }; |
306 | 313 |
307 } // namespace edk | 314 } // namespace edk |
308 } // namespace mojo | 315 } // namespace mojo |
309 | 316 |
310 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 317 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
OLD | NEW |