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

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

Issue 125268: Revert r18641: "Linux: Enable metrics_service_uitest.cc." (Closed)
Patch Set: Created 11 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
« no previous file with comments | « chrome/browser/zygote_host_linux.h ('k') | chrome/browser/zygote_main_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <unistd.h> 7 #include <unistd.h>
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/socket.h> 9 #include <sys/socket.h>
10 10
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 } 87 }
88 88
89 void ZygoteHost::EnsureProcessTerminated(pid_t process) { 89 void ZygoteHost::EnsureProcessTerminated(pid_t process) {
90 Pickle pickle; 90 Pickle pickle;
91 91
92 pickle.WriteInt(kCmdReap); 92 pickle.WriteInt(kCmdReap);
93 pickle.WriteInt(process); 93 pickle.WriteInt(process);
94 94
95 HANDLE_EINTR(write(control_fd_, pickle.data(), pickle.size())); 95 HANDLE_EINTR(write(control_fd_, pickle.data(), pickle.size()));
96 } 96 }
97
98 bool ZygoteHost::DidProcessCrash(base::ProcessHandle handle,
99 bool* child_exited) {
100 Pickle pickle;
101 pickle.WriteInt(kCmdDidProcessCrash);
102 pickle.WriteInt(handle);
103
104 HANDLE_EINTR(write(control_fd_, pickle.data(), pickle.size()));
105
106 static const unsigned kMaxMessageLength = 128;
107 char buf[kMaxMessageLength];
108 const ssize_t len = HANDLE_EINTR(read(control_fd_, buf, sizeof(buf)));
109
110 if (len == -1) {
111 LOG(WARNING) << "Error reading message from zygote: " << errno;
112 return false;
113 } else if (len == 0) {
114 LOG(WARNING) << "Socket closed prematurely.";
115 return false;
116 }
117
118 Pickle read_pickle(buf, len);
119 bool did_crash, tmp_child_exited;
120 void* iter = NULL;
121 if (!read_pickle.ReadBool(&iter, &did_crash) ||
122 !read_pickle.ReadBool(&iter, &tmp_child_exited)) {
123 LOG(WARNING) << "Error parsing DidProcessCrash response from zygote.";
124 return false;
125 }
126
127 if (child_exited)
128 *child_exited = tmp_child_exited;
129
130 return did_crash;
131 }
OLDNEW
« no previous file with comments | « chrome/browser/zygote_host_linux.h ('k') | chrome/browser/zygote_main_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698