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

Side by Side Diff: components/nacl/loader/nonsfi/nonsfi_listener.cc

Issue 649603004: Non-SFI NaCl: Batch-open resource files (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: code review Created 5 years, 10 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
OLDNEW
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
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;
161 for (size_t i = 0; i < params.resource_files.size(); ++i) {
162 key_fd_map.insert(std::make_pair(
Mark Seaborn 2015/02/12 03:57:33 Can you add a check analogous to CHECK(params.ne
Yusuke Sato 2015/02/13 23:01:17 Done.
163 params.resource_files[i].file_key,
164 IPC::PlatformFileForTransitToPlatformFile(
165 params.resource_files[i].file)));
166 }
167 ppapi::RegisterPreopenedDescriptorsNonSfi(key_fd_map);
168
159 MainStart(IPC::PlatformFileForTransitToPlatformFile(params.nexe_file)); 169 MainStart(IPC::PlatformFileForTransitToPlatformFile(params.nexe_file));
160 } 170 }
161 171
162 } // namespace nonsfi 172 } // namespace nonsfi
163 } // namespace nacl 173 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698