Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(751)

Side by Side Diff: mojo/edk/system/core.cc

Issue 2039713004: [mojo-edk] Make the Mojo EDK compile under NaCl. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « mojo/edk/system/channel_posix.cc ('k') | mojo/edk/system/node_channel.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/bind.h" 11 #include "base/bind.h"
12 #include "base/containers/stack_container.h" 12 #include "base/containers/stack_container.h"
13 #include "base/location.h" 13 #include "base/location.h"
14 #include "base/logging.h" 14 #include "base/logging.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/message_loop/message_loop.h" 17 #include "base/message_loop/message_loop.h"
18 #include "base/rand_util.h" 18 #include "base/rand_util.h"
19 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
20 #include "base/time/time.h" 20 #include "base/time/time.h"
21 #include "crypto/random.h"
22 #include "mojo/edk/embedder/embedder.h" 21 #include "mojo/edk/embedder/embedder.h"
23 #include "mojo/edk/embedder/embedder_internal.h" 22 #include "mojo/edk/embedder/embedder_internal.h"
24 #include "mojo/edk/embedder/platform_shared_buffer.h" 23 #include "mojo/edk/embedder/platform_shared_buffer.h"
25 #include "mojo/edk/system/async_waiter.h" 24 #include "mojo/edk/system/async_waiter.h"
26 #include "mojo/edk/system/channel.h" 25 #include "mojo/edk/system/channel.h"
27 #include "mojo/edk/system/configuration.h" 26 #include "mojo/edk/system/configuration.h"
28 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h" 27 #include "mojo/edk/system/data_pipe_consumer_dispatcher.h"
29 #include "mojo/edk/system/data_pipe_producer_dispatcher.h" 28 #include "mojo/edk/system/data_pipe_producer_dispatcher.h"
30 #include "mojo/edk/system/handle_signals_state.h" 29 #include "mojo/edk/system/handle_signals_state.h"
31 #include "mojo/edk/system/message_for_transit.h" 30 #include "mojo/edk/system/message_for_transit.h"
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 base::ThreadTaskRunnerHandle::Get(), 308 base::ThreadTaskRunnerHandle::Get(),
310 FROM_HERE, callback); 309 FROM_HERE, callback);
311 } else { 310 } else {
312 on_shutdown = callback; 311 on_shutdown = callback;
313 } 312 }
314 GetNodeController()->RequestShutdown(on_shutdown); 313 GetNodeController()->RequestShutdown(on_shutdown);
315 } 314 }
316 315
317 ScopedMessagePipeHandle Core::CreateMessagePipe( 316 ScopedMessagePipeHandle Core::CreateMessagePipe(
318 ScopedPlatformHandle platform_handle) { 317 ScopedPlatformHandle platform_handle) {
318 #if defined(OS_NACL)
319 NOTREACHED();
320 return ScopedMessagePipeHandle();
321 #else
319 ports::PortRef port0, port1; 322 ports::PortRef port0, port1;
320 GetNodeController()->node()->CreatePortPair(&port0, &port1); 323 GetNodeController()->node()->CreatePortPair(&port0, &port1);
321 MojoHandle handle = AddDispatcher( 324 MojoHandle handle = AddDispatcher(
322 new MessagePipeDispatcher(GetNodeController(), port0, 325 new MessagePipeDispatcher(GetNodeController(), port0,
323 kUnknownPipeIdForDebug, 0)); 326 kUnknownPipeIdForDebug, 0));
324 RemoteMessagePipeBootstrap::Create( 327 RemoteMessagePipeBootstrap::Create(
325 GetNodeController(), std::move(platform_handle), port1); 328 GetNodeController(), std::move(platform_handle), port1);
326 return ScopedMessagePipeHandle(MessagePipeHandle(handle)); 329 return ScopedMessagePipeHandle(MessagePipeHandle(handle));
330 #endif
327 } 331 }
328 332
329 ScopedMessagePipeHandle Core::CreateParentMessagePipe( 333 ScopedMessagePipeHandle Core::CreateParentMessagePipe(
330 const std::string& token) { 334 const std::string& token) {
331 RequestContext request_context; 335 RequestContext request_context;
332 ports::PortRef port0, port1; 336 ports::PortRef port0, port1;
333 GetNodeController()->node()->CreatePortPair(&port0, &port1); 337 GetNodeController()->node()->CreatePortPair(&port0, &port1);
334 MojoHandle handle = AddDispatcher( 338 MojoHandle handle = AddDispatcher(
335 new MessagePipeDispatcher(GetNodeController(), port0, 339 new MessagePipeDispatcher(GetNodeController(), port0,
336 kUnknownPipeIdForDebug, 0)); 340 kUnknownPipeIdForDebug, 0));
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1133 std::unique_ptr<NodeController> node_controller) { 1137 std::unique_ptr<NodeController> node_controller) {
1134 // It's OK to leak this reference. At this point we know the IO loop is still 1138 // It's OK to leak this reference. At this point we know the IO loop is still
1135 // running, and we know the NodeController will observe its eventual 1139 // running, and we know the NodeController will observe its eventual
1136 // destruction. This tells the NodeController to delete itself when that 1140 // destruction. This tells the NodeController to delete itself when that
1137 // happens. 1141 // happens.
1138 node_controller.release()->DestroyOnIOThreadShutdown(); 1142 node_controller.release()->DestroyOnIOThreadShutdown();
1139 } 1143 }
1140 1144
1141 } // namespace edk 1145 } // namespace edk
1142 } // namespace mojo 1146 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/system/channel_posix.cc ('k') | mojo/edk/system/node_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698