| 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 <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <functional> | 10 #include <functional> |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 // |*platform_support| must outlive this object. | 46 // |*platform_support| must outlive this object. |
| 47 explicit Core(embedder::PlatformSupport* platform_support); | 47 explicit Core(embedder::PlatformSupport* platform_support); |
| 48 virtual ~Core(); | 48 virtual ~Core(); |
| 49 | 49 |
| 50 // Adds |handle| (which must have a dispatcher) to the handle table, returning | 50 // Adds |handle| (which must have a dispatcher) to the handle table, returning |
| 51 // the handle value for it. Returns |MOJO_HANDLE_INVALID| on failure, namely | 51 // the handle value for it. Returns |MOJO_HANDLE_INVALID| on failure, namely |
| 52 // if the handle table is full. | 52 // if the handle table is full. |
| 53 MojoHandle AddHandle(Handle&& handle); | 53 MojoHandle AddHandle(Handle&& handle); |
| 54 | 54 |
| 55 // Looks up the dispatcher for the given handle. On success, gets the | 55 // Looks up the dispatcher for the given handle value. On success, gets the |
| 56 // dispatcher for a given handle. On failure, returns an appropriate result | 56 // dispatcher for a given handle value. On failure, returns an appropriate |
| 57 // and leaves |dispatcher| alone), namely |MOJO_RESULT_INVALID_ARGUMENT| if | 57 // result and leaves |dispatcher| alone), namely |
| 58 // the handle is invalid or |MOJO_RESULT_BUSY| if the handle is marked as | 58 // |MOJO_RESULT_INVALID_ARGUMENT| if the handle value is invalid or |
| 59 // busy. | 59 // |MOJO_RESULT_BUSY| if the handle is marked as busy. |
| 60 MojoResult GetDispatcher(MojoHandle handle, | 60 MojoResult GetDispatcher(MojoHandle handle_value, |
| 61 util::RefPtr<Dispatcher>* dispatcher); | 61 util::RefPtr<Dispatcher>* dispatcher); |
| 62 | 62 |
| 63 // Like |GetDispatcher()|, but on success also removes the handle from the | 63 // Like |GetDispatcher()|, but on success also removes the handle from the |
| 64 // handle table. | 64 // handle table. |
| 65 MojoResult GetAndRemoveDispatcher(MojoHandle handle, | 65 MojoResult GetAndRemoveDispatcher(MojoHandle handle_value, |
| 66 util::RefPtr<Dispatcher>* dispatcher); | 66 util::RefPtr<Dispatcher>* dispatcher); |
| 67 | 67 |
| 68 // Watches on the given handle for the given signals, calling |callback| when | 68 // Watches on the given handle for the given signals, calling |callback| when |
| 69 // a signal is satisfied or when all signals become unsatisfiable. |callback| | 69 // a signal is satisfied or when all signals become unsatisfiable. |callback| |
| 70 // must satisfy stringent requirements -- see |Awakable::Awake()| in | 70 // must satisfy stringent requirements -- see |Awakable::Awake()| in |
| 71 // awakable.h. In particular, it must not call any Mojo system functions. | 71 // awakable.h. In particular, it must not call any Mojo system functions. |
| 72 MojoResult AsyncWait(MojoHandle handle, | 72 MojoResult AsyncWait(MojoHandle handle, |
| 73 MojoHandleSignals signals, | 73 MojoHandleSignals signals, |
| 74 const std::function<void(MojoResult)>& callback); | 74 const std::function<void(MojoResult)>& callback); |
| 75 | 75 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 util::Mutex mapping_table_mutex_; | 211 util::Mutex mapping_table_mutex_; |
| 212 MappingTable mapping_table_ MOJO_GUARDED_BY(mapping_table_mutex_); | 212 MappingTable mapping_table_ MOJO_GUARDED_BY(mapping_table_mutex_); |
| 213 | 213 |
| 214 MOJO_DISALLOW_COPY_AND_ASSIGN(Core); | 214 MOJO_DISALLOW_COPY_AND_ASSIGN(Core); |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 } // namespace system | 217 } // namespace system |
| 218 } // namespace mojo | 218 } // namespace mojo |
| 219 | 219 |
| 220 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 220 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
| OLD | NEW |