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

Unified Diff: chrome/browser/zygote_host_linux.cc

Issue 131007: Linux: Enable metrics_service_uitest.cc. Take 2. (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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/zygote_host_linux.cc
diff --git a/chrome/browser/zygote_host_linux.cc b/chrome/browser/zygote_host_linux.cc
index 1c582a38057bcaf0865dcc77f1f978e4718b765e..230373c0db015b31534d77e709c4b732fd285961 100644
--- a/chrome/browser/zygote_host_linux.cc
+++ b/chrome/browser/zygote_host_linux.cc
@@ -94,3 +94,38 @@ void ZygoteHost::EnsureProcessTerminated(pid_t process) {
HANDLE_EINTR(write(control_fd_, pickle.data(), pickle.size()));
}
+
+bool ZygoteHost::DidProcessCrash(base::ProcessHandle handle,
+ bool* child_exited) {
+ Pickle pickle;
+ pickle.WriteInt(kCmdDidProcessCrash);
+ pickle.WriteInt(handle);
+
+ HANDLE_EINTR(write(control_fd_, pickle.data(), pickle.size()));
+
+ static const unsigned kMaxMessageLength = 128;
+ char buf[kMaxMessageLength];
+ const ssize_t len = HANDLE_EINTR(read(control_fd_, buf, sizeof(buf)));
+
+ if (len == -1) {
+ LOG(WARNING) << "Error reading message from zygote: " << errno;
+ return false;
+ } else if (len == 0) {
+ LOG(WARNING) << "Socket closed prematurely.";
+ return false;
+ }
+
+ Pickle read_pickle(buf, len);
+ bool did_crash, tmp_child_exited;
+ void* iter = NULL;
+ if (!read_pickle.ReadBool(&iter, &did_crash) ||
+ !read_pickle.ReadBool(&iter, &tmp_child_exited)) {
+ LOG(WARNING) << "Error parsing DidProcessCrash response from zygote.";
+ return false;
+ }
+
+ if (child_exited)
+ *child_exited = tmp_child_exited;
+
+ return did_crash;
+}
« 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