| 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 "base/callback.h" | 10 #include <functional> |
| 11 |
| 11 #include "mojo/edk/system/handle_table.h" | 12 #include "mojo/edk/system/handle_table.h" |
| 12 #include "mojo/edk/system/mapping_table.h" | 13 #include "mojo/edk/system/mapping_table.h" |
| 13 #include "mojo/edk/system/memory.h" | 14 #include "mojo/edk/system/memory.h" |
| 14 #include "mojo/edk/util/mutex.h" | 15 #include "mojo/edk/util/mutex.h" |
| 15 #include "mojo/edk/util/ref_ptr.h" | 16 #include "mojo/edk/util/ref_ptr.h" |
| 16 #include "mojo/edk/util/thread_annotations.h" | 17 #include "mojo/edk/util/thread_annotations.h" |
| 17 #include "mojo/public/c/system/buffer.h" | 18 #include "mojo/public/c/system/buffer.h" |
| 18 #include "mojo/public/c/system/data_pipe.h" | 19 #include "mojo/public/c/system/data_pipe.h" |
| 19 #include "mojo/public/c/system/message_pipe.h" | 20 #include "mojo/public/c/system/message_pipe.h" |
| 20 #include "mojo/public/c/system/types.h" | 21 #include "mojo/public/c/system/types.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 // handle or |MOJO_RESULT_BUSY| if the handle is marked as busy.) | 60 // handle or |MOJO_RESULT_BUSY| if the handle is marked as busy.) |
| 60 MojoResult GetAndRemoveDispatcher(MojoHandle handle, | 61 MojoResult GetAndRemoveDispatcher(MojoHandle handle, |
| 61 util::RefPtr<Dispatcher>* dispatcher); | 62 util::RefPtr<Dispatcher>* dispatcher); |
| 62 | 63 |
| 63 // Watches on the given handle for the given signals, calling |callback| when | 64 // Watches on the given handle for the given signals, calling |callback| when |
| 64 // a signal is satisfied or when all signals become unsatisfiable. |callback| | 65 // a signal is satisfied or when all signals become unsatisfiable. |callback| |
| 65 // must satisfy stringent requirements -- see |Awakable::Awake()| in | 66 // must satisfy stringent requirements -- see |Awakable::Awake()| in |
| 66 // awakable.h. In particular, it must not call any Mojo system functions. | 67 // awakable.h. In particular, it must not call any Mojo system functions. |
| 67 MojoResult AsyncWait(MojoHandle handle, | 68 MojoResult AsyncWait(MojoHandle handle, |
| 68 MojoHandleSignals signals, | 69 MojoHandleSignals signals, |
| 69 const base::Callback<void(MojoResult)>& callback); | 70 const std::function<void(MojoResult)>& callback); |
| 70 | 71 |
| 71 embedder::PlatformSupport* platform_support() const { | 72 embedder::PlatformSupport* platform_support() const { |
| 72 return platform_support_; | 73 return platform_support_; |
| 73 } | 74 } |
| 74 | 75 |
| 75 // --------------------------------------------------------------------------- | 76 // --------------------------------------------------------------------------- |
| 76 | 77 |
| 77 // The following methods are essentially implementations of the Mojo Core | 78 // The following methods are essentially implementations of the Mojo Core |
| 78 // functions of the Mojo API, with the C interface translated to C++ by | 79 // functions of the Mojo API, with the C interface translated to C++ by |
| 79 // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract | 80 // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 util::Mutex mapping_table_mutex_; | 183 util::Mutex mapping_table_mutex_; |
| 183 MappingTable mapping_table_ MOJO_GUARDED_BY(mapping_table_mutex_); | 184 MappingTable mapping_table_ MOJO_GUARDED_BY(mapping_table_mutex_); |
| 184 | 185 |
| 185 MOJO_DISALLOW_COPY_AND_ASSIGN(Core); | 186 MOJO_DISALLOW_COPY_AND_ASSIGN(Core); |
| 186 }; | 187 }; |
| 187 | 188 |
| 188 } // namespace system | 189 } // namespace system |
| 189 } // namespace mojo | 190 } // namespace mojo |
| 190 | 191 |
| 191 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 192 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
| OLD | NEW |