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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 | 45 |
46 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); | 46 scoped_refptr<Dispatcher> GetDispatcher(MojoHandle handle); |
47 | 47 |
48 // Called in the parent process any time a new child is launched. | 48 // Called in the parent process any time a new child is launched. |
49 void AddChild(base::ProcessHandle process_handle, | 49 void AddChild(base::ProcessHandle process_handle, |
50 ScopedPlatformHandle platform_handle); | 50 ScopedPlatformHandle platform_handle); |
51 | 51 |
52 // Called in a child process exactly once during early initialization. | 52 // Called in a child process exactly once during early initialization. |
53 void InitChild(ScopedPlatformHandle platform_handle); | 53 void InitChild(ScopedPlatformHandle platform_handle); |
54 | 54 |
55 // Creates a message pipe endpoint connected to an endpoint in a remote | 55 // This creates a message pipe endpoint connected to an endpoint in a remote |
56 // embedder. |platform_handle| is used as a channel to negotiate the | 56 // embedder. |platform_handle| is used as a channel to negotiate the |
57 // connection. | 57 // connection. This is only here to facilitate legacy embedder code. See |
58 ScopedMessagePipeHandle CreateMessagePipe( | 58 // mojo::edk::CreateMessagePipe in mojo/edk/embedder/embedder.h. |
59 ScopedPlatformHandle platform_handle); | 59 void CreateMessagePipe( |
| 60 ScopedPlatformHandle platform_handle, |
| 61 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
60 | 62 |
61 // Creates a message pipe endpoint associated with |token|, which a child | 63 // Creates a message pipe endpoint associated with |token|, which a child |
62 // holding the token can later locate and connect to. | 64 // holding the token can later locate and connect to. |
63 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token); | 65 void CreateParentMessagePipe( |
| 66 const std::string& token, |
| 67 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
64 | 68 |
65 // Creates a message pipe endpoint and connects it to a pipe the parent has | 69 // Creates a message pipe endpoint associated with |token|, which will be |
66 // associated with |token|. | 70 // passed to the parent in order to find an associated remote port and connect |
67 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token); | 71 // to it. |
| 72 void CreateChildMessagePipe( |
| 73 const std::string& token, |
| 74 const base::Callback<void(ScopedMessagePipeHandle)>& callback); |
68 | 75 |
69 MojoHandle AddDispatcher(scoped_refptr<Dispatcher> dispatcher); | 76 MojoHandle AddDispatcher(scoped_refptr<Dispatcher> dispatcher); |
70 | 77 |
71 // Adds new dispatchers for non-message-pipe handles received in a message. | 78 // Adds new dispatchers for non-message-pipe handles received in a message. |
72 // |dispatchers| and |handles| should be the same size. | 79 // |dispatchers| and |handles| should be the same size. |
73 bool AddDispatchersFromTransit( | 80 bool AddDispatchersFromTransit( |
74 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers, | 81 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers, |
75 MojoHandle* handles); | 82 MojoHandle* handles); |
76 | 83 |
77 MojoResult CreatePlatformHandleWrapper(ScopedPlatformHandle platform_handle, | 84 MojoResult CreatePlatformHandleWrapper(ScopedPlatformHandle platform_handle, |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 base::Lock mapping_table_lock_; // Protects |mapping_table_|. | 228 base::Lock mapping_table_lock_; // Protects |mapping_table_|. |
222 MappingTable mapping_table_; | 229 MappingTable mapping_table_; |
223 | 230 |
224 DISALLOW_COPY_AND_ASSIGN(Core); | 231 DISALLOW_COPY_AND_ASSIGN(Core); |
225 }; | 232 }; |
226 | 233 |
227 } // namespace edk | 234 } // namespace edk |
228 } // namespace mojo | 235 } // namespace mojo |
229 | 236 |
230 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 237 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
OLD | NEW |