OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/zygote_host_linux.h" | 5 #include "chrome/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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 } | 60 } |
61 | 61 |
62 void ZygoteHost::Init(const std::string& sandbox_cmd) { | 62 void ZygoteHost::Init(const std::string& sandbox_cmd) { |
63 DCHECK(!init_); | 63 DCHECK(!init_); |
64 init_ = true; | 64 init_ = true; |
65 | 65 |
66 FilePath chrome_path; | 66 FilePath chrome_path; |
67 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); | 67 CHECK(PathService::Get(base::FILE_EXE, &chrome_path)); |
68 CommandLine cmd_line(chrome_path); | 68 CommandLine cmd_line(chrome_path); |
69 | 69 |
70 cmd_line.AppendSwitchWithValue(switches::kProcessType, | 70 cmd_line.AppendSwitchASCII(switches::kProcessType, switches::kZygoteProcess); |
71 switches::kZygoteProcess); | |
72 | 71 |
73 int fds[2]; | 72 int fds[2]; |
74 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); | 73 CHECK(socketpair(PF_UNIX, SOCK_SEQPACKET, 0, fds) == 0); |
75 base::file_handle_mapping_vector fds_to_map; | 74 base::file_handle_mapping_vector fds_to_map; |
76 fds_to_map.push_back(std::make_pair(fds[1], 3)); | 75 fds_to_map.push_back(std::make_pair(fds[1], 3)); |
77 | 76 |
78 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); | 77 const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); |
79 if (browser_command_line.HasSwitch(switches::kZygoteCmdPrefix)) { | 78 if (browser_command_line.HasSwitch(switches::kZygoteCmdPrefix)) { |
80 const std::wstring prefix = | 79 const std::wstring prefix = |
81 browser_command_line.GetSwitchValue(switches::kZygoteCmdPrefix); | 80 browser_command_line.GetSwitchValue(switches::kZygoteCmdPrefix); |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { | 331 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { |
333 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; | 332 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; |
334 return false; | 333 return false; |
335 } | 334 } |
336 | 335 |
337 if (child_exited) | 336 if (child_exited) |
338 *child_exited = tmp_child_exited; | 337 *child_exited = tmp_child_exited; |
339 | 338 |
340 return did_crash; | 339 return did_crash; |
341 } | 340 } |
OLD | NEW |