OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 pickle.WriteInt(mapping.size()); | 193 pickle.WriteInt(mapping.size()); |
194 | 194 |
195 std::vector<int> fds; | 195 std::vector<int> fds; |
196 for (base::GlobalDescriptors::Mapping::const_iterator | 196 for (base::GlobalDescriptors::Mapping::const_iterator |
197 i = mapping.begin(); i != mapping.end(); ++i) { | 197 i = mapping.begin(); i != mapping.end(); ++i) { |
198 pickle.WriteUInt32(i->first); | 198 pickle.WriteUInt32(i->first); |
199 fds.push_back(i->second); | 199 fds.push_back(i->second); |
200 } | 200 } |
201 | 201 |
202 if (!base::SendMsg(control_fd_, pickle.data(), pickle.size(), fds)) | 202 if (!base::SendMsg(control_fd_, pickle.data(), pickle.size(), fds)) |
203 return -1; | 203 return base::kNullProcessHandle; |
204 | 204 |
205 pid_t pid; | 205 pid_t pid; |
206 if (HANDLE_EINTR(read(control_fd_, &pid, sizeof(pid))) != sizeof(pid)) | 206 if (HANDLE_EINTR(read(control_fd_, &pid, sizeof(pid))) != sizeof(pid)) |
207 return -1; | 207 return base::kNullProcessHandle; |
208 | 208 |
209 return pid; | 209 return pid; |
210 } | 210 } |
211 | 211 |
212 void ZygoteHost::EnsureProcessTerminated(pid_t process) { | 212 void ZygoteHost::EnsureProcessTerminated(pid_t process) { |
213 DCHECK(init_); | 213 DCHECK(init_); |
214 Pickle pickle; | 214 Pickle pickle; |
215 | 215 |
216 pickle.WriteInt(kCmdReap); | 216 pickle.WriteInt(kCmdReap); |
217 pickle.WriteInt(process); | 217 pickle.WriteInt(process); |
(...skipping 29 matching lines...) Expand all Loading... |
247 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { | 247 !read_pickle.ReadBool(&iter, &tmp_child_exited)) { |
248 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; | 248 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote."; |
249 return false; | 249 return false; |
250 } | 250 } |
251 | 251 |
252 if (child_exited) | 252 if (child_exited) |
253 *child_exited = tmp_child_exited; | 253 *child_exited = tmp_child_exited; |
254 | 254 |
255 return did_crash; | 255 return did_crash; |
256 } | 256 } |
OLD | NEW |