| 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 #include "mojo/edk/system/core.h" | 5 #include "mojo/edk/system/core.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "mojo/edk/system/channel.h" | 24 #include "mojo/edk/system/channel.h" |
| 25 #include "mojo/edk/system/configuration.h" | 25 #include "mojo/edk/system/configuration.h" |
| 26 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" | 26 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" |
| 27 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" | 27 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" |
| 28 #include "mojo/edk/system/handle_signals_state.h" | 28 #include "mojo/edk/system/handle_signals_state.h" |
| 29 #include "mojo/edk/system/message_for_transit.h" | 29 #include "mojo/edk/system/message_for_transit.h" |
| 30 #include "mojo/edk/system/message_pipe_dispatcher.h" | 30 #include "mojo/edk/system/message_pipe_dispatcher.h" |
| 31 #include "mojo/edk/system/platform_handle_dispatcher.h" | 31 #include "mojo/edk/system/platform_handle_dispatcher.h" |
| 32 #include "mojo/edk/system/ports/name.h" | 32 #include "mojo/edk/system/ports/name.h" |
| 33 #include "mojo/edk/system/ports/node.h" | 33 #include "mojo/edk/system/ports/node.h" |
| 34 #include "mojo/edk/system/remote_message_pipe_bootstrap.h" | |
| 35 #include "mojo/edk/system/request_context.h" | 34 #include "mojo/edk/system/request_context.h" |
| 36 #include "mojo/edk/system/shared_buffer_dispatcher.h" | 35 #include "mojo/edk/system/shared_buffer_dispatcher.h" |
| 37 #include "mojo/edk/system/wait_set_dispatcher.h" | 36 #include "mojo/edk/system/wait_set_dispatcher.h" |
| 38 #include "mojo/edk/system/waiter.h" | 37 #include "mojo/edk/system/waiter.h" |
| 39 | 38 |
| 40 namespace mojo { | 39 namespace mojo { |
| 41 namespace edk { | 40 namespace edk { |
| 42 | 41 |
| 43 namespace { | 42 namespace { |
| 44 | 43 |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 328 *shared_memory_handle = platform_shared_buffer->DuplicateSharedMemoryHandle(); | 327 *shared_memory_handle = platform_shared_buffer->DuplicateSharedMemoryHandle(); |
| 329 | 328 |
| 330 shm_dispatcher->Close(); | 329 shm_dispatcher->Close(); |
| 331 return result; | 330 return result; |
| 332 } | 331 } |
| 333 | 332 |
| 334 void Core::RequestShutdown(const base::Closure& callback) { | 333 void Core::RequestShutdown(const base::Closure& callback) { |
| 335 GetNodeController()->RequestShutdown(callback); | 334 GetNodeController()->RequestShutdown(callback); |
| 336 } | 335 } |
| 337 | 336 |
| 338 ScopedMessagePipeHandle Core::CreateMessagePipe( | |
| 339 ScopedPlatformHandle platform_handle) { | |
| 340 #if defined(OS_NACL) | |
| 341 NOTREACHED(); | |
| 342 return ScopedMessagePipeHandle(); | |
| 343 #else | |
| 344 ports::PortRef port0, port1; | |
| 345 GetNodeController()->node()->CreatePortPair(&port0, &port1); | |
| 346 MojoHandle handle = AddDispatcher( | |
| 347 new MessagePipeDispatcher(GetNodeController(), port0, | |
| 348 kUnknownPipeIdForDebug, 0)); | |
| 349 RemoteMessagePipeBootstrap::Create( | |
| 350 GetNodeController(), std::move(platform_handle), port1); | |
| 351 return ScopedMessagePipeHandle(MessagePipeHandle(handle)); | |
| 352 #endif | |
| 353 } | |
| 354 | |
| 355 ScopedMessagePipeHandle Core::CreateParentMessagePipe( | 337 ScopedMessagePipeHandle Core::CreateParentMessagePipe( |
| 356 const std::string& token, const std::string& child_token) { | 338 const std::string& token, const std::string& child_token) { |
| 357 RequestContext request_context; | 339 RequestContext request_context; |
| 358 ports::PortRef port0, port1; | 340 ports::PortRef port0, port1; |
| 359 GetNodeController()->node()->CreatePortPair(&port0, &port1); | 341 GetNodeController()->node()->CreatePortPair(&port0, &port1); |
| 360 MojoHandle handle = AddDispatcher( | 342 MojoHandle handle = AddDispatcher( |
| 361 new MessagePipeDispatcher(GetNodeController(), port0, | 343 new MessagePipeDispatcher(GetNodeController(), port0, |
| 362 kUnknownPipeIdForDebug, 0)); | 344 kUnknownPipeIdForDebug, 0)); |
| 363 GetNodeController()->ReservePort(token, port1, child_token); | 345 GetNodeController()->ReservePort(token, port1, child_token); |
| 364 return ScopedMessagePipeHandle(MessagePipeHandle(handle)); | 346 return ScopedMessagePipeHandle(MessagePipeHandle(handle)); |
| (...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1187 std::unique_ptr<NodeController> node_controller) { | 1169 std::unique_ptr<NodeController> node_controller) { |
| 1188 // It's OK to leak this reference. At this point we know the IO loop is still | 1170 // It's OK to leak this reference. At this point we know the IO loop is still |
| 1189 // running, and we know the NodeController will observe its eventual | 1171 // running, and we know the NodeController will observe its eventual |
| 1190 // destruction. This tells the NodeController to delete itself when that | 1172 // destruction. This tells the NodeController to delete itself when that |
| 1191 // happens. | 1173 // happens. |
| 1192 node_controller.release()->DestroyOnIOThreadShutdown(); | 1174 node_controller.release()->DestroyOnIOThreadShutdown(); |
| 1193 } | 1175 } |
| 1194 | 1176 |
| 1195 } // namespace edk | 1177 } // namespace edk |
| 1196 } // namespace mojo | 1178 } // namespace mojo |
| OLD | NEW |