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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "components/nacl/common/nacl_messages.h" | 12 #include "components/nacl/common/nacl_messages.h" |
13 #include "components/nacl/common/nacl_types.h" | 13 #include "components/nacl/common/nacl_types.h" |
14 #include "components/nacl/loader/nacl_trusted_listener.h" | 14 #include "components/nacl/loader/nacl_trusted_listener.h" |
15 #include "components/nacl/loader/nonsfi/irt_random.h" | 15 #include "components/nacl/loader/nonsfi/irt_random.h" |
16 #include "components/nacl/loader/nonsfi/nonsfi_main.h" | 16 #include "components/nacl/loader/nonsfi/nonsfi_main.h" |
17 #include "ipc/ipc_channel.h" | 17 #include "ipc/ipc_channel.h" |
18 #include "ipc/ipc_channel_handle.h" | 18 #include "ipc/ipc_channel_handle.h" |
19 #include "ipc/ipc_switches.h" | 19 #include "ipc/ipc_switches.h" |
20 #include "ipc/ipc_sync_channel.h" | 20 #include "ipc/ipc_sync_channel.h" |
21 #include "ppapi/nacl_irt/irt_manifest.h" | |
21 #include "ppapi/nacl_irt/plugin_startup.h" | 22 #include "ppapi/nacl_irt/plugin_startup.h" |
22 | 23 |
23 #if defined(OS_NACL_NONSFI) | 24 #if defined(OS_NACL_NONSFI) |
24 #include "native_client/src/public/nonsfi/irt_random.h" | 25 #include "native_client/src/public/nonsfi/irt_random.h" |
25 #else | 26 #else |
26 #include "components/nacl/loader/nonsfi/irt_random.h" | 27 #include "components/nacl/loader/nonsfi/irt_random.h" |
27 #endif | 28 #endif |
28 | 29 |
29 #if !defined(OS_LINUX) && !defined(OS_NACL_NONSFI) | 30 #if !defined(OS_LINUX) && !defined(OS_NACL_NONSFI) |
30 # error "non-SFI mode is supported only on linux." | 31 # error "non-SFI mode is supported only on linux." |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 CHECK(params.debug_stub_server_bound_socket.fd == -1); | 150 CHECK(params.debug_stub_server_bound_socket.fd == -1); |
150 | 151 |
151 CHECK(params.handles.empty()); | 152 CHECK(params.handles.empty()); |
152 // We are only expecting non-SFI mode to be used with NaCl for now, | 153 // We are only expecting non-SFI mode to be used with NaCl for now, |
153 // not PNaCl processes. | 154 // not PNaCl processes. |
154 CHECK(params.process_type == kNativeNaClProcessType); | 155 CHECK(params.process_type == kNativeNaClProcessType); |
155 | 156 |
156 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); | 157 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); |
157 CHECK(params.nexe_file_path_metadata.empty()); | 158 CHECK(params.nexe_file_path_metadata.empty()); |
158 | 159 |
160 std::map<std::string, int> key_fd_map; | |
Mark Seaborn
2015/02/25 20:01:24
Why not use "new" to allocate this here and pass i
Yusuke Sato
2015/03/01 06:59:37
Done.
| |
161 for (size_t i = 0; i < params.prefetched_resource_files.size(); ++i) { | |
162 CHECK(params.prefetched_resource_files[i].file_path.empty()); | |
163 key_fd_map.insert(std::make_pair( | |
164 params.prefetched_resource_files[i].file_key, | |
165 IPC::PlatformFileForTransitToPlatformFile( | |
166 params.prefetched_resource_files[i].file))); | |
167 } | |
168 ppapi::RegisterPreopenedDescriptorsNonSfi(key_fd_map); | |
169 | |
159 MainStart(IPC::PlatformFileForTransitToPlatformFile(params.nexe_file)); | 170 MainStart(IPC::PlatformFileForTransitToPlatformFile(params.nexe_file)); |
160 } | 171 } |
161 | 172 |
162 } // namespace nonsfi | 173 } // namespace nonsfi |
163 } // namespace nacl | 174 } // namespace nacl |
OLD | NEW |