OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/zygote_host_linux.h" | 5 #include "content/browser/zygote_host_linux.h" |
6 | 6 |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 sizeof(sandbox_status_))) != | 209 sizeof(sandbox_status_))) != |
210 sizeof(sandbox_status_)) { | 210 sizeof(sandbox_status_)) { |
211 return -1; | 211 return -1; |
212 } | 212 } |
213 have_read_sandbox_status_word_ = true; | 213 have_read_sandbox_status_word_ = true; |
214 } | 214 } |
215 | 215 |
216 return HANDLE_EINTR(read(control_fd_, buf, buf_len)); | 216 return HANDLE_EINTR(read(control_fd_, buf, buf_len)); |
217 } | 217 } |
218 | 218 |
219 pid_t ZygoteHost::ForkRenderer( | 219 pid_t ZygoteHost::ForkRequest( |
220 const std::vector<std::string>& argv, | 220 const std::vector<std::string>& argv, |
221 const base::GlobalDescriptors::Mapping& mapping) { | 221 const base::GlobalDescriptors::Mapping& mapping, |
| 222 const std::string& process_type) { |
222 DCHECK(init_); | 223 DCHECK(init_); |
223 Pickle pickle; | 224 Pickle pickle; |
224 | 225 |
225 pickle.WriteInt(kCmdFork); | 226 if (process_type == switches::kNaClLoaderProcess) { |
| 227 pickle.WriteInt(kCmdNaClFork); |
| 228 } else { |
| 229 pickle.WriteInt(kCmdFork); |
| 230 } |
226 pickle.WriteInt(argv.size()); | 231 pickle.WriteInt(argv.size()); |
227 for (std::vector<std::string>::const_iterator | 232 for (std::vector<std::string>::const_iterator |
228 i = argv.begin(); i != argv.end(); ++i) | 233 i = argv.begin(); i != argv.end(); ++i) |
229 pickle.WriteString(*i); | 234 pickle.WriteString(*i); |
230 | 235 |
231 pickle.WriteInt(mapping.size()); | 236 pickle.WriteInt(mapping.size()); |
232 | 237 |
233 std::vector<int> fds; | 238 std::vector<int> fds; |
234 for (base::GlobalDescriptors::Mapping::const_iterator | 239 for (base::GlobalDescriptors::Mapping::const_iterator |
235 i = mapping.begin(); i != mapping.end(); ++i) { | 240 i = mapping.begin(); i != mapping.end(); ++i) { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 !read_pickle.ReadInt(&iter, &tmp_exit_code)) { | 362 !read_pickle.ReadInt(&iter, &tmp_exit_code)) { |
358 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; | 363 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; |
359 return base::TERMINATION_STATUS_NORMAL_TERMINATION; | 364 return base::TERMINATION_STATUS_NORMAL_TERMINATION; |
360 } | 365 } |
361 | 366 |
362 if (exit_code) | 367 if (exit_code) |
363 *exit_code = tmp_exit_code; | 368 *exit_code = tmp_exit_code; |
364 | 369 |
365 return static_cast<base::TerminationStatus>(status); | 370 return static_cast<base::TerminationStatus>(status); |
366 } | 371 } |
OLD | NEW |