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