OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/nacl/loader/nonsfi/nonsfi_listener.h" | 5 #include "components/nacl/loader/nonsfi/nonsfi_listener.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_descriptor_posix.h" | 8 #include "base/file_descriptor_posix.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| 11 #include "base/run_loop.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "components/nacl/common/nacl_messages.h" | 13 #include "components/nacl/common/nacl_messages.h" |
13 #include "components/nacl/common/nacl_types.h" | 14 #include "components/nacl/common/nacl_types.h" |
14 #include "components/nacl/loader/nacl_trusted_listener.h" | 15 #include "components/nacl/loader/nacl_trusted_listener.h" |
15 #include "components/nacl/loader/nonsfi/nonsfi_main.h" | 16 #include "components/nacl/loader/nonsfi/nonsfi_main.h" |
16 #include "ipc/ipc_channel.h" | 17 #include "ipc/ipc_channel.h" |
17 #include "ipc/ipc_channel_handle.h" | 18 #include "ipc/ipc_channel_handle.h" |
18 #include "ipc/ipc_switches.h" | 19 #include "ipc/ipc_switches.h" |
19 #include "ipc/ipc_sync_channel.h" | 20 #include "ipc/ipc_sync_channel.h" |
20 #include "native_client/src/public/nonsfi/irt_random.h" | 21 #include "native_client/src/public/nonsfi/irt_random.h" |
(...skipping 21 matching lines...) Expand all Loading... |
42 | 43 |
43 void NonSfiListener::Listen() { | 44 void NonSfiListener::Listen() { |
44 channel_ = IPC::SyncChannel::Create( | 45 channel_ = IPC::SyncChannel::Create( |
45 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 46 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
46 switches::kProcessChannelID), | 47 switches::kProcessChannelID), |
47 IPC::Channel::MODE_CLIENT, | 48 IPC::Channel::MODE_CLIENT, |
48 this, // As a Listener. | 49 this, // As a Listener. |
49 io_thread_.task_runner().get(), | 50 io_thread_.task_runner().get(), |
50 true, // Create pipe now. | 51 true, // Create pipe now. |
51 &shutdown_event_); | 52 &shutdown_event_); |
52 base::MessageLoop::current()->Run(); | 53 base::RunLoop().Run(); |
53 } | 54 } |
54 | 55 |
55 bool NonSfiListener::OnMessageReceived(const IPC::Message& msg) { | 56 bool NonSfiListener::OnMessageReceived(const IPC::Message& msg) { |
56 bool handled = true; | 57 bool handled = true; |
57 IPC_BEGIN_MESSAGE_MAP(NonSfiListener, msg) | 58 IPC_BEGIN_MESSAGE_MAP(NonSfiListener, msg) |
58 IPC_MESSAGE_HANDLER(NaClProcessMsg_AddPrefetchedResource, | 59 IPC_MESSAGE_HANDLER(NaClProcessMsg_AddPrefetchedResource, |
59 OnAddPrefetchedResource) | 60 OnAddPrefetchedResource) |
60 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStart) | 61 IPC_MESSAGE_HANDLER(NaClProcessMsg_Start, OnStart) |
61 IPC_MESSAGE_UNHANDLED(handled = false) | 62 IPC_MESSAGE_UNHANDLED(handled = false) |
62 IPC_END_MESSAGE_MAP() | 63 IPC_END_MESSAGE_MAP() |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); | 126 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); |
126 CHECK(params.nexe_file_path_metadata.empty()); | 127 CHECK(params.nexe_file_path_metadata.empty()); |
127 | 128 |
128 ppapi::RegisterPreopenedDescriptorsNonSfi(key_fd_map_.release()); | 129 ppapi::RegisterPreopenedDescriptorsNonSfi(key_fd_map_.release()); |
129 | 130 |
130 MainStart(IPC::PlatformFileForTransitToPlatformFile(params.nexe_file)); | 131 MainStart(IPC::PlatformFileForTransitToPlatformFile(params.nexe_file)); |
131 } | 132 } |
132 | 133 |
133 } // namespace nonsfi | 134 } // namespace nonsfi |
134 } // namespace nacl | 135 } // namespace nacl |
OLD | NEW |