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

Side by Side Diff: content/browser/zygote_host_linux.cc

Issue 6995121: New NaCl zygote implementation 2 (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Dropping mods to content/browser/DEPS Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 free(saved_envvar); 50 free(saved_envvar);
51 } 51 }
52 } 52 }
53 53
54 ZygoteHost::ZygoteHost() 54 ZygoteHost::ZygoteHost()
55 : control_fd_(-1), 55 : control_fd_(-1),
56 pid_(-1), 56 pid_(-1),
57 init_(false), 57 init_(false),
58 using_suid_sandbox_(false), 58 using_suid_sandbox_(false),
59 have_read_sandbox_status_word_(false), 59 have_read_sandbox_status_word_(false),
60 sandbox_status_(0) { 60 sandbox_status_(0) {}
61 }
62 61
63 ZygoteHost::~ZygoteHost() { 62 ZygoteHost::~ZygoteHost() {
64 if (init_) 63 if (init_)
65 close(control_fd_); 64 close(control_fd_);
66 } 65 }
67 66
68 // static 67 // static
69 ZygoteHost* ZygoteHost::GetInstance() { 68 ZygoteHost* ZygoteHost::GetInstance() {
70 return Singleton<ZygoteHost>::get(); 69 return Singleton<ZygoteHost>::get();
71 } 70 }
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 sizeof(sandbox_status_))) != 208 sizeof(sandbox_status_))) !=
210 sizeof(sandbox_status_)) { 209 sizeof(sandbox_status_)) {
211 return -1; 210 return -1;
212 } 211 }
213 have_read_sandbox_status_word_ = true; 212 have_read_sandbox_status_word_ = true;
214 } 213 }
215 214
216 return HANDLE_EINTR(read(control_fd_, buf, buf_len)); 215 return HANDLE_EINTR(read(control_fd_, buf, buf_len));
217 } 216 }
218 217
219 pid_t ZygoteHost::ForkRenderer( 218 pid_t ZygoteHost::ForkRequest(
220 const std::vector<std::string>& argv, 219 const std::vector<std::string>& argv,
221 const base::GlobalDescriptors::Mapping& mapping) { 220 const base::GlobalDescriptors::Mapping& mapping,
221 const std::string& process_type) {
222 DCHECK(init_); 222 DCHECK(init_);
223 Pickle pickle; 223 Pickle pickle;
224 224
225 pickle.WriteInt(kCmdFork); 225 pickle.WriteInt(kCmdFork);
226 pickle.WriteString(process_type);
226 pickle.WriteInt(argv.size()); 227 pickle.WriteInt(argv.size());
227 for (std::vector<std::string>::const_iterator 228 for (std::vector<std::string>::const_iterator
228 i = argv.begin(); i != argv.end(); ++i) 229 i = argv.begin(); i != argv.end(); ++i)
229 pickle.WriteString(*i); 230 pickle.WriteString(*i);
230 231
231 pickle.WriteInt(mapping.size()); 232 pickle.WriteInt(mapping.size());
232 233
233 std::vector<int> fds; 234 std::vector<int> fds;
234 for (base::GlobalDescriptors::Mapping::const_iterator 235 for (base::GlobalDescriptors::Mapping::const_iterator
235 i = mapping.begin(); i != mapping.end(); ++i) { 236 i = mapping.begin(); i != mapping.end(); ++i) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 !read_pickle.ReadInt(&iter, &tmp_exit_code)) { 358 !read_pickle.ReadInt(&iter, &tmp_exit_code)) {
358 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote."; 359 LOG(WARNING) << "Error parsing GetTerminationStatus response from zygote.";
359 return base::TERMINATION_STATUS_NORMAL_TERMINATION; 360 return base::TERMINATION_STATUS_NORMAL_TERMINATION;
360 } 361 }
361 362
362 if (exit_code) 363 if (exit_code)
363 *exit_code = tmp_exit_code; 364 *exit_code = tmp_exit_code;
364 365
365 return static_cast<base::TerminationStatus>(status); 366 return static_cast<base::TerminationStatus>(status);
366 } 367 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698