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" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/memory/shared_memory_handle.h" | 14 #include "base/memory/shared_memory_handle.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
16 #include "base/task_runner.h" | 16 #include "base/task_runner.h" |
17 #include "mojo/edk/embedder/scoped_platform_handle.h" | 17 #include "mojo/edk/embedder/scoped_platform_handle.h" |
18 #include "mojo/edk/system/dispatcher.h" | 18 #include "mojo/edk/system/dispatcher.h" |
19 #include "mojo/edk/system/handle_signals_state.h" | 19 #include "mojo/edk/system/handle_signals_state.h" |
20 #include "mojo/edk/system/handle_table.h" | 20 #include "mojo/edk/system/handle_table.h" |
21 #include "mojo/edk/system/mapping_table.h" | 21 #include "mojo/edk/system/mapping_table.h" |
22 #include "mojo/edk/system/node_controller.h" | 22 #include "mojo/edk/system/node_controller.h" |
23 #include "mojo/edk/system/system_impl_export.h" | 23 #include "mojo/edk/system/system_impl_export.h" |
24 #include "mojo/public/c/system/buffer.h" | 24 #include "mojo/public/c/system/buffer.h" |
25 #include "mojo/public/c/system/data_pipe.h" | 25 #include "mojo/public/c/system/data_pipe.h" |
26 #include "mojo/public/c/system/message_pipe.h" | 26 #include "mojo/public/c/system/message_pipe.h" |
27 #include "mojo/public/c/system/types.h" | 27 #include "mojo/public/c/system/types.h" |
28 #include "mojo/public/cpp/system/message_pipe.h" | 28 #include "mojo/public/cpp/system/message_pipe.h" |
29 | 29 |
| 30 namespace base { |
| 31 class PortProvider; |
| 32 } |
| 33 |
30 namespace mojo { | 34 namespace mojo { |
31 namespace edk { | 35 namespace edk { |
32 | 36 |
33 // |Core| is an object that implements the Mojo system calls. All public methods | 37 // |Core| is an object that implements the Mojo system calls. All public methods |
34 // are thread-safe. | 38 // are thread-safe. |
35 class MOJO_SYSTEM_IMPL_EXPORT Core { | 39 class MOJO_SYSTEM_IMPL_EXPORT Core { |
36 public: | 40 public: |
37 explicit Core(); | 41 explicit Core(); |
38 virtual ~Core(); | 42 virtual ~Core(); |
39 | 43 |
(...skipping 20 matching lines...) Expand all Loading... |
60 ScopedPlatformHandle platform_handle); | 64 ScopedPlatformHandle platform_handle); |
61 | 65 |
62 // Creates a message pipe endpoint associated with |token|, which a child | 66 // Creates a message pipe endpoint associated with |token|, which a child |
63 // holding the token can later locate and connect to. | 67 // holding the token can later locate and connect to. |
64 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token); | 68 ScopedMessagePipeHandle CreateParentMessagePipe(const std::string& token); |
65 | 69 |
66 // Creates a message pipe endpoint and connects it to a pipe the parent has | 70 // Creates a message pipe endpoint and connects it to a pipe the parent has |
67 // associated with |token|. | 71 // associated with |token|. |
68 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token); | 72 ScopedMessagePipeHandle CreateChildMessagePipe(const std::string& token); |
69 | 73 |
| 74 // Sets the mach port provider for this process. |
| 75 void SetMachPortProviderIfNeeded(base::PortProvider* port_provider); |
| 76 |
70 MojoHandle AddDispatcher(scoped_refptr<Dispatcher> dispatcher); | 77 MojoHandle AddDispatcher(scoped_refptr<Dispatcher> dispatcher); |
71 | 78 |
72 // Adds new dispatchers for non-message-pipe handles received in a message. | 79 // Adds new dispatchers for non-message-pipe handles received in a message. |
73 // |dispatchers| and |handles| should be the same size. | 80 // |dispatchers| and |handles| should be the same size. |
74 bool AddDispatchersFromTransit( | 81 bool AddDispatchersFromTransit( |
75 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers, | 82 const std::vector<Dispatcher::DispatcherInTransit>& dispatchers, |
76 MojoHandle* handles); | 83 MojoHandle* handles); |
77 | 84 |
78 // See "mojo/edk/embedder/embedder.h" for more information on these functions. | 85 // See "mojo/edk/embedder/embedder.h" for more information on these functions. |
79 MojoResult CreatePlatformHandleWrapper(ScopedPlatformHandle platform_handle, | 86 MojoResult CreatePlatformHandleWrapper(ScopedPlatformHandle platform_handle, |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 base::Lock mapping_table_lock_; // Protects |mapping_table_|. | 257 base::Lock mapping_table_lock_; // Protects |mapping_table_|. |
251 MappingTable mapping_table_; | 258 MappingTable mapping_table_; |
252 | 259 |
253 DISALLOW_COPY_AND_ASSIGN(Core); | 260 DISALLOW_COPY_AND_ASSIGN(Core); |
254 }; | 261 }; |
255 | 262 |
256 } // namespace edk | 263 } // namespace edk |
257 } // namespace mojo | 264 } // namespace mojo |
258 | 265 |
259 #endif // MOJO_EDK_SYSTEM_CORE_H_ | 266 #endif // MOJO_EDK_SYSTEM_CORE_H_ |
OLD | NEW |