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

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: Remove ipc/ and mojo/ changes following Mark's suggestion Created 6 years 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"
(...skipping 15 matching lines...) Expand all
26 #include "components/nacl/loader/nonsfi/irt_random.h" 26 #include "components/nacl/loader/nonsfi/irt_random.h"
27 #endif 27 #endif
28 28
29 #if !defined(OS_LINUX) && !defined(OS_NACL_NONSFI) 29 #if !defined(OS_LINUX) && !defined(OS_NACL_NONSFI)
30 # error "non-SFI mode is supported only on linux." 30 # error "non-SFI mode is supported only on linux."
31 #endif 31 #endif
32 32
33 namespace nacl { 33 namespace nacl {
34 namespace nonsfi { 34 namespace nonsfi {
35 35
36 void RegisterPreopenedDescriptors(
37 const std::vector<std::pair<std::string, int> >& key_fd_pairs);
38
36 NonSfiListener::NonSfiListener() : io_thread_("NaCl_IOThread"), 39 NonSfiListener::NonSfiListener() : io_thread_("NaCl_IOThread"),
37 shutdown_event_(true, false) { 40 shutdown_event_(true, false) {
38 io_thread_.StartWithOptions( 41 io_thread_.StartWithOptions(
39 base::Thread::Options(base::MessageLoop::TYPE_IO, 0)); 42 base::Thread::Options(base::MessageLoop::TYPE_IO, 0));
40 } 43 }
41 44
42 NonSfiListener::~NonSfiListener() { 45 NonSfiListener::~NonSfiListener() {
43 } 46 }
44 47
45 void NonSfiListener::Listen() { 48 void NonSfiListener::Listen() {
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 CHECK(params.debug_stub_server_bound_socket.fd == -1); 152 CHECK(params.debug_stub_server_bound_socket.fd == -1);
150 153
151 CHECK(params.handles.empty()); 154 CHECK(params.handles.empty());
152 // We are only expecting non-SFI mode to be used with NaCl for now, 155 // We are only expecting non-SFI mode to be used with NaCl for now,
153 // not PNaCl processes. 156 // not PNaCl processes.
154 CHECK(params.process_type == kNativeNaClProcessType); 157 CHECK(params.process_type == kNativeNaClProcessType);
155 158
156 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit()); 159 CHECK(params.nexe_file != IPC::InvalidPlatformFileForTransit());
157 CHECK(params.nexe_file_path_metadata.empty()); 160 CHECK(params.nexe_file_path_metadata.empty());
158 161
162 #if !defined(OS_NACL_NONSFI)
hidehiko 2015/01/28 09:05:19 When we move the irt implementation to ppapi/nacl_
Mark Seaborn 2015/02/02 23:21:50 I don't understand why you need to conditionalise
Yusuke Sato 2015/02/04 02:00:29 removed
Yusuke Sato 2015/02/04 02:00:29 removed
163 std::vector<std::pair<std::string, int> > key_fd_pairs;
Mark Seaborn 2015/02/02 23:21:50 You're converting to a std::vector here only to ha
Yusuke Sato 2015/02/04 02:00:29 Since params.resource_files is a struct defined in
Mark Seaborn 2015/02/04 18:52:16 I think it would be OK to add components/nacl/comm
Yusuke Sato 2015/02/05 07:21:13 Done.
164 for (size_t i = 0; i < params.resource_files.size(); ++i) {
165 key_fd_pairs.push_back(std::make_pair(
166 params.resource_files[i].file_key,
167 IPC::PlatformFileForTransitToPlatformFile(
168 params.resource_files[i].file)));
169 }
170
171 RegisterPreopenedDescriptors(key_fd_pairs);
172 #endif
173
159 MainStart(IPC::PlatformFileForTransitToPlatformFile(params.nexe_file)); 174 MainStart(IPC::PlatformFileForTransitToPlatformFile(params.nexe_file));
160 } 175 }
161 176
162 } // namespace nonsfi 177 } // namespace nonsfi
163 } // namespace nacl 178 } // namespace nacl
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698