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" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/synchronization/lock.h" | 13 #include "base/synchronization/lock.h" |
14 #include "mojo/edk/system/handle_table.h" | 14 #include "mojo/edk/system/handle_table.h" |
15 #include "mojo/edk/system/mapping_table.h" | 15 #include "mojo/edk/system/mapping_table.h" |
16 #include "mojo/edk/system/system_impl_export.h" | 16 #include "mojo/edk/system/system_impl_export.h" |
17 #include "third_party/mojo/src/mojo/public/c/system/buffer.h" | 17 #include "mojo/public/c/system/buffer.h" |
18 #include "third_party/mojo/src/mojo/public/c/system/data_pipe.h" | 18 #include "mojo/public/c/system/data_pipe.h" |
19 #include "third_party/mojo/src/mojo/public/c/system/message_pipe.h" | 19 #include "mojo/public/c/system/message_pipe.h" |
20 #include "third_party/mojo/src/mojo/public/c/system/types.h" | 20 #include "mojo/public/c/system/types.h" |
21 #include "third_party/mojo/src/mojo/public/cpp/system/macros.h" | 21 #include "mojo/public/cpp/system/macros.h" |
22 | 22 |
23 namespace mojo { | 23 namespace mojo { |
24 | 24 |
25 namespace edk { | 25 namespace edk { |
26 | 26 |
27 class Dispatcher; | 27 class Dispatcher; |
28 class PlatformSupport; | 28 class PlatformSupport; |
29 struct HandleSignalsState; | 29 struct HandleSignalsState; |
30 | 30 |
31 // |Core| is an object that implements the Mojo system calls. All public methods | 31 // |Core| is an object that implements the Mojo system calls. All public methods |
(...skipping 30 matching lines...) Expand all Loading... |
62 | 62 |
63 // --------------------------------------------------------------------------- | 63 // --------------------------------------------------------------------------- |
64 | 64 |
65 // The following methods are essentially implementations of the Mojo Core | 65 // The following methods are essentially implementations of the Mojo Core |
66 // functions of the Mojo API, with the C interface translated to C++ by | 66 // functions of the Mojo API, with the C interface translated to C++ by |
67 // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract | 67 // "mojo/edk/embedder/entrypoints.cc". The best way to understand the contract |
68 // of these methods is to look at the header files defining the corresponding | 68 // of these methods is to look at the header files defining the corresponding |
69 // API functions, referenced below. | 69 // API functions, referenced below. |
70 | 70 |
71 // These methods correspond to the API functions defined in | 71 // These methods correspond to the API functions defined in |
72 // "third_party/mojo/src/mojo/public/c/system/functions.h": | 72 // "mojo/public/c/system/functions.h": |
73 MojoTimeTicks GetTimeTicksNow(); | 73 MojoTimeTicks GetTimeTicksNow(); |
74 MojoResult Close(MojoHandle handle); | 74 MojoResult Close(MojoHandle handle); |
75 MojoResult Wait(MojoHandle handle, | 75 MojoResult Wait(MojoHandle handle, |
76 MojoHandleSignals signals, | 76 MojoHandleSignals signals, |
77 MojoDeadline deadline, | 77 MojoDeadline deadline, |
78 MojoHandleSignalsState* signals_state); | 78 MojoHandleSignalsState* signals_state); |
79 MojoResult WaitMany(const MojoHandle* handles, | 79 MojoResult WaitMany(const MojoHandle* handles, |
80 const MojoHandleSignals* signals, | 80 const MojoHandleSignals* signals, |
81 uint32_t num_handles, | 81 uint32_t num_handles, |
82 MojoDeadline deadline, | 82 MojoDeadline deadline, |
83 uint32_t* result_index, | 83 uint32_t* result_index, |
84 MojoHandleSignalsState* signals_states); | 84 MojoHandleSignalsState* signals_states); |
85 | 85 |
86 // These methods correspond to the API functions defined in | 86 // These methods correspond to the API functions defined in |
87 // "third_party/mojo/src/mojo/public/c/system/message_pipe.h": | 87 // "mojo/public/c/system/message_pipe.h": |
88 MojoResult CreateMessagePipe( | 88 MojoResult CreateMessagePipe( |
89 const MojoCreateMessagePipeOptions* options, | 89 const MojoCreateMessagePipeOptions* options, |
90 MojoHandle* message_pipe_handle0, | 90 MojoHandle* message_pipe_handle0, |
91 MojoHandle* message_pipe_handle1); | 91 MojoHandle* message_pipe_handle1); |
92 MojoResult WriteMessage(MojoHandle message_pipe_handle, | 92 MojoResult WriteMessage(MojoHandle message_pipe_handle, |
93 const void* bytes, | 93 const void* bytes, |
94 uint32_t num_bytes, | 94 uint32_t num_bytes, |
95 const MojoHandle* handles, | 95 const MojoHandle* handles, |
96 uint32_t num_handles, | 96 uint32_t num_handles, |
97 MojoWriteMessageFlags flags); | 97 MojoWriteMessageFlags flags); |
98 MojoResult ReadMessage(MojoHandle message_pipe_handle, | 98 MojoResult ReadMessage(MojoHandle message_pipe_handle, |
99 void* bytes, | 99 void* bytes, |
100 uint32_t* num_bytes, | 100 uint32_t* num_bytes, |
101 MojoHandle* handles, | 101 MojoHandle* handles, |
102 uint32_t* num_handles, | 102 uint32_t* num_handles, |
103 MojoReadMessageFlags flags); | 103 MojoReadMessageFlags flags); |
104 | 104 |
105 // These methods correspond to the API functions defined in | 105 // These methods correspond to the API functions defined in |
106 // "third_party/mojo/src/mojo/public/c/system/data_pipe.h": | 106 // "mojo/public/c/system/data_pipe.h": |
107 MojoResult CreateDataPipe( | 107 MojoResult CreateDataPipe( |
108 const MojoCreateDataPipeOptions* options, | 108 const MojoCreateDataPipeOptions* options, |
109 MojoHandle* data_pipe_producer_handle, | 109 MojoHandle* data_pipe_producer_handle, |
110 MojoHandle* data_pipe_consumer_handle); | 110 MojoHandle* data_pipe_consumer_handle); |
111 MojoResult WriteData(MojoHandle data_pipe_producer_handle, | 111 MojoResult WriteData(MojoHandle data_pipe_producer_handle, |
112 const void* elements, | 112 const void* elements, |
113 uint32_t* num_bytes, | 113 uint32_t* num_bytes, |
114 MojoWriteDataFlags flags); | 114 MojoWriteDataFlags flags); |
115 MojoResult BeginWriteData(MojoHandle data_pipe_producer_handle, | 115 MojoResult BeginWriteData(MojoHandle data_pipe_producer_handle, |
116 void** buffer, | 116 void** buffer, |
117 uint32_t* buffer_num_bytes, | 117 uint32_t* buffer_num_bytes, |
118 MojoWriteDataFlags flags); | 118 MojoWriteDataFlags flags); |
119 MojoResult EndWriteData(MojoHandle data_pipe_producer_handle, | 119 MojoResult EndWriteData(MojoHandle data_pipe_producer_handle, |
120 uint32_t num_bytes_written); | 120 uint32_t num_bytes_written); |
121 MojoResult ReadData(MojoHandle data_pipe_consumer_handle, | 121 MojoResult ReadData(MojoHandle data_pipe_consumer_handle, |
122 void* elements, | 122 void* elements, |
123 uint32_t* num_bytes, | 123 uint32_t* num_bytes, |
124 MojoReadDataFlags flags); | 124 MojoReadDataFlags flags); |
125 MojoResult BeginReadData(MojoHandle data_pipe_consumer_handle, | 125 MojoResult BeginReadData(MojoHandle data_pipe_consumer_handle, |
126 const void** buffer, | 126 const void** buffer, |
127 uint32_t* buffer_num_bytes, | 127 uint32_t* buffer_num_bytes, |
128 MojoReadDataFlags flags); | 128 MojoReadDataFlags flags); |
129 MojoResult EndReadData(MojoHandle data_pipe_consumer_handle, | 129 MojoResult EndReadData(MojoHandle data_pipe_consumer_handle, |
130 uint32_t num_bytes_read); | 130 uint32_t num_bytes_read); |
131 | 131 |
132 // These methods correspond to the API functions defined in | 132 // These methods correspond to the API functions defined in |
133 // "third_party/mojo/src/mojo/public/c/system/buffer.h": | 133 // "mojo/public/c/system/buffer.h": |
134 MojoResult CreateSharedBuffer( | 134 MojoResult CreateSharedBuffer( |
135 const MojoCreateSharedBufferOptions* options, | 135 const MojoCreateSharedBufferOptions* options, |
136 uint64_t num_bytes, | 136 uint64_t num_bytes, |
137 MojoHandle* shared_buffer_handle); | 137 MojoHandle* shared_buffer_handle); |
138 MojoResult DuplicateBufferHandle( | 138 MojoResult DuplicateBufferHandle( |
139 MojoHandle buffer_handle, | 139 MojoHandle buffer_handle, |
140 const MojoDuplicateBufferHandleOptions* options, | 140 const MojoDuplicateBufferHandleOptions* options, |
141 MojoHandle* new_buffer_handle); | 141 MojoHandle* new_buffer_handle); |
142 MojoResult MapBuffer(MojoHandle buffer_handle, | 142 MojoResult MapBuffer(MojoHandle buffer_handle, |
143 uint64_t offset, | 143 uint64_t offset, |
(...skipping 26 matching lines...) Expand all Loading... |
170 base::Lock mapping_table_lock_; // Protects |mapping_table_|. | 170 base::Lock mapping_table_lock_; // Protects |mapping_table_|. |
171 MappingTable mapping_table_; | 171 MappingTable mapping_table_; |
172 | 172 |
173 MOJO_DISALLOW_COPY_AND_ASSIGN(Core); | 173 MOJO_DISALLOW_COPY_AND_ASSIGN(Core); |
174 }; | 174 }; |
175 | 175 |
176 } // namespace edk | 176 } // namespace edk |
177 } // namespace mojo | 177 } // namespace mojo |
178 | 178 |
179 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 179 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
OLD | NEW |