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

Unified Diff: chrome/browser/zygote_main_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.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/zygote_main_linux.cc
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index 6d15c0f30bd6fa5649f9e7f962bd376acaf9c938..ba550d92699922f7b4eb3a6bdfc38816d0ae4173 100644
--- a/chrome/browser/zygote_main_linux.cc
+++ b/chrome/browser/zygote_main_linux.cc
@@ -77,18 +77,24 @@ class Zygote {
void* iter = NULL;
int kind;
- if (!pickle.ReadInt(&iter, &kind))
- goto error;
-
- if (kind == ZygoteHost::kCmdFork) {
- return HandleForkRequest(fd, pickle, iter, fds);
- } else if (kind == ZygoteHost::kCmdReap) {
- if (fds.size())
- goto error;
- return HandleReapRequest(fd, pickle, iter);
+ if (pickle.ReadInt(&iter, &kind)) {
+ switch (kind) {
+ case ZygoteHost::kCmdFork:
+ return HandleForkRequest(fd, pickle, iter, fds);
+ case ZygoteHost::kCmdReap:
+ if (!fds.empty())
+ break;
+ return HandleReapRequest(fd, pickle, iter);
+ case ZygoteHost::kCmdDidProcessCrash:
+ if (!fds.empty())
+ break;
+ return HandleDidProcessCrash(fd, pickle, iter);
+ default:
+ NOTREACHED();
+ break;
+ }
}
- error:
LOG(WARNING) << "Error parsing message from browser";
for (std::vector<int>::const_iterator
i = fds.begin(); i != fds.end(); ++i)
@@ -109,6 +115,25 @@ class Zygote {
return false;
}
+ bool HandleDidProcessCrash(int fd, Pickle& pickle, void* iter) {
+ base::ProcessHandle child;
+
+ if (!pickle.ReadInt(&iter, &child)) {
+ LOG(WARNING) << "Error parsing DidProcessCrash request from browser";
+ return false;
+ }
+
+ bool child_exited;
+ bool did_crash = base::DidProcessCrash(&child_exited, child);
+
+ Pickle write_pickle;
+ write_pickle.WriteBool(did_crash);
+ write_pickle.WriteBool(child_exited);
+ HANDLE_EINTR(write(fd, write_pickle.data(), write_pickle.size()));
+
+ return false;
+ }
+
// Handle a 'fork' request from the browser: this means that the browser
// wishes to start a new renderer.
bool HandleForkRequest(int fd, Pickle& pickle, void* iter,
« no previous file with comments | « chrome/browser/zygote_host_linux.cc ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698