| 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 "base/callback.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 MojoResult AsyncWait(MojoHandle handle, | 57 MojoResult AsyncWait(MojoHandle handle, |
| 58 MojoHandleSignals signals, | 58 MojoHandleSignals signals, |
| 59 base::Callback<void(MojoResult)> callback); | 59 base::Callback<void(MojoResult)> callback); |
| 60 | 60 |
| 61 embedder::PlatformSupport* platform_support() const { | 61 embedder::PlatformSupport* platform_support() const { |
| 62 return platform_support_.get(); | 62 return platform_support_.get(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // --------------------------------------------------------------------------- | 65 // --------------------------------------------------------------------------- |
| 66 | 66 |
| 67 // System calls implementation: | 67 // The following methods are essentially implementations of the Mojo Core |
| 68 // functions of the Mojo API, with the C interface translated to C++ by |
| 69 // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract |
| 70 // of these methods is to look at the header files defining the corresponding |
| 71 // API functions, referenced below. |
| 72 |
| 73 // These methods correspond to the API functions defined in |
| 74 // "mojo/public/c/system/functions.h": |
| 68 MojoTimeTicks GetTimeTicksNow(); | 75 MojoTimeTicks GetTimeTicksNow(); |
| 69 MojoResult Close(MojoHandle handle); | 76 MojoResult Close(MojoHandle handle); |
| 70 MojoResult Wait(MojoHandle handle, | 77 MojoResult Wait(MojoHandle handle, |
| 71 MojoHandleSignals signals, | 78 MojoHandleSignals signals, |
| 72 MojoDeadline deadline, | 79 MojoDeadline deadline, |
| 73 UserPointer<MojoHandleSignalsState> signals_state); | 80 UserPointer<MojoHandleSignalsState> signals_state); |
| 74 MojoResult WaitMany(UserPointer<const MojoHandle> handles, | 81 MojoResult WaitMany(UserPointer<const MojoHandle> handles, |
| 75 UserPointer<const MojoHandleSignals> signals, | 82 UserPointer<const MojoHandleSignals> signals, |
| 76 uint32_t num_handles, | 83 uint32_t num_handles, |
| 77 MojoDeadline deadline, | 84 MojoDeadline deadline, |
| 78 UserPointer<uint32_t> result_index, | 85 UserPointer<uint32_t> result_index, |
| 79 UserPointer<MojoHandleSignalsState> signals_states); | 86 UserPointer<MojoHandleSignalsState> signals_states); |
| 87 |
| 88 // These methods correspond to the API functions defined in |
| 89 // "mojo/public/c/system/message_pipe.h": |
| 80 MojoResult CreateMessagePipe( | 90 MojoResult CreateMessagePipe( |
| 81 UserPointer<const MojoCreateMessagePipeOptions> options, | 91 UserPointer<const MojoCreateMessagePipeOptions> options, |
| 82 UserPointer<MojoHandle> message_pipe_handle0, | 92 UserPointer<MojoHandle> message_pipe_handle0, |
| 83 UserPointer<MojoHandle> message_pipe_handle1); | 93 UserPointer<MojoHandle> message_pipe_handle1); |
| 84 MojoResult WriteMessage(MojoHandle message_pipe_handle, | 94 MojoResult WriteMessage(MojoHandle message_pipe_handle, |
| 85 UserPointer<const void> bytes, | 95 UserPointer<const void> bytes, |
| 86 uint32_t num_bytes, | 96 uint32_t num_bytes, |
| 87 UserPointer<const MojoHandle> handles, | 97 UserPointer<const MojoHandle> handles, |
| 88 uint32_t num_handles, | 98 uint32_t num_handles, |
| 89 MojoWriteMessageFlags flags); | 99 MojoWriteMessageFlags flags); |
| 90 MojoResult ReadMessage(MojoHandle message_pipe_handle, | 100 MojoResult ReadMessage(MojoHandle message_pipe_handle, |
| 91 UserPointer<void> bytes, | 101 UserPointer<void> bytes, |
| 92 UserPointer<uint32_t> num_bytes, | 102 UserPointer<uint32_t> num_bytes, |
| 93 UserPointer<MojoHandle> handles, | 103 UserPointer<MojoHandle> handles, |
| 94 UserPointer<uint32_t> num_handles, | 104 UserPointer<uint32_t> num_handles, |
| 95 MojoReadMessageFlags flags); | 105 MojoReadMessageFlags flags); |
| 106 |
| 107 // These methods correspond to the API functions defined in |
| 108 // "mojo/public/c/system/data_pipe.h": |
| 96 MojoResult CreateDataPipe( | 109 MojoResult CreateDataPipe( |
| 97 UserPointer<const MojoCreateDataPipeOptions> options, | 110 UserPointer<const MojoCreateDataPipeOptions> options, |
| 98 UserPointer<MojoHandle> data_pipe_producer_handle, | 111 UserPointer<MojoHandle> data_pipe_producer_handle, |
| 99 UserPointer<MojoHandle> data_pipe_consumer_handle); | 112 UserPointer<MojoHandle> data_pipe_consumer_handle); |
| 100 MojoResult WriteData(MojoHandle data_pipe_producer_handle, | 113 MojoResult WriteData(MojoHandle data_pipe_producer_handle, |
| 101 UserPointer<const void> elements, | 114 UserPointer<const void> elements, |
| 102 UserPointer<uint32_t> num_bytes, | 115 UserPointer<uint32_t> num_bytes, |
| 103 MojoWriteDataFlags flags); | 116 MojoWriteDataFlags flags); |
| 104 MojoResult BeginWriteData(MojoHandle data_pipe_producer_handle, | 117 MojoResult BeginWriteData(MojoHandle data_pipe_producer_handle, |
| 105 UserPointer<void*> buffer, | 118 UserPointer<void*> buffer, |
| 106 UserPointer<uint32_t> buffer_num_bytes, | 119 UserPointer<uint32_t> buffer_num_bytes, |
| 107 MojoWriteDataFlags flags); | 120 MojoWriteDataFlags flags); |
| 108 MojoResult EndWriteData(MojoHandle data_pipe_producer_handle, | 121 MojoResult EndWriteData(MojoHandle data_pipe_producer_handle, |
| 109 uint32_t num_bytes_written); | 122 uint32_t num_bytes_written); |
| 110 MojoResult ReadData(MojoHandle data_pipe_consumer_handle, | 123 MojoResult ReadData(MojoHandle data_pipe_consumer_handle, |
| 111 UserPointer<void> elements, | 124 UserPointer<void> elements, |
| 112 UserPointer<uint32_t> num_bytes, | 125 UserPointer<uint32_t> num_bytes, |
| 113 MojoReadDataFlags flags); | 126 MojoReadDataFlags flags); |
| 114 MojoResult BeginReadData(MojoHandle data_pipe_consumer_handle, | 127 MojoResult BeginReadData(MojoHandle data_pipe_consumer_handle, |
| 115 UserPointer<const void*> buffer, | 128 UserPointer<const void*> buffer, |
| 116 UserPointer<uint32_t> buffer_num_bytes, | 129 UserPointer<uint32_t> buffer_num_bytes, |
| 117 MojoReadDataFlags flags); | 130 MojoReadDataFlags flags); |
| 118 MojoResult EndReadData(MojoHandle data_pipe_consumer_handle, | 131 MojoResult EndReadData(MojoHandle data_pipe_consumer_handle, |
| 119 uint32_t num_bytes_read); | 132 uint32_t num_bytes_read); |
| 133 |
| 134 // These methods correspond to the API functions defined in |
| 135 // "mojo/public/c/system/buffer.h": |
| 120 MojoResult CreateSharedBuffer( | 136 MojoResult CreateSharedBuffer( |
| 121 UserPointer<const MojoCreateSharedBufferOptions> options, | 137 UserPointer<const MojoCreateSharedBufferOptions> options, |
| 122 uint64_t num_bytes, | 138 uint64_t num_bytes, |
| 123 UserPointer<MojoHandle> shared_buffer_handle); | 139 UserPointer<MojoHandle> shared_buffer_handle); |
| 124 MojoResult DuplicateBufferHandle( | 140 MojoResult DuplicateBufferHandle( |
| 125 MojoHandle buffer_handle, | 141 MojoHandle buffer_handle, |
| 126 UserPointer<const MojoDuplicateBufferHandleOptions> options, | 142 UserPointer<const MojoDuplicateBufferHandleOptions> options, |
| 127 UserPointer<MojoHandle> new_buffer_handle); | 143 UserPointer<MojoHandle> new_buffer_handle); |
| 128 MojoResult MapBuffer(MojoHandle buffer_handle, | 144 MojoResult MapBuffer(MojoHandle buffer_handle, |
| 129 uint64_t offset, | 145 uint64_t offset, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 156 base::Lock mapping_table_lock_; // Protects |mapping_table_|. | 172 base::Lock mapping_table_lock_; // Protects |mapping_table_|. |
| 157 MappingTable mapping_table_; | 173 MappingTable mapping_table_; |
| 158 | 174 |
| 159 DISALLOW_COPY_AND_ASSIGN(Core); | 175 DISALLOW_COPY_AND_ASSIGN(Core); |
| 160 }; | 176 }; |
| 161 | 177 |
| 162 } // namespace system | 178 } // namespace system |
| 163 } // namespace mojo | 179 } // namespace mojo |
| 164 | 180 |
| 165 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 181 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
| OLD | NEW |