summaryrefslogtreecommitdiffstats
path: root/chrome/browser/zygote_main_linux.cc
diff options
context:
space:
mode:
authorwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-18 02:23:16 +0000
committerwillchan@chromium.org <willchan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-18 02:23:16 +0000
commit57113eacd955181e1267f3f20b889bc6fbfd07f2 (patch)
tree6577b6941409f45cb0215c92f37c4497e62fa87a /chrome/browser/zygote_main_linux.cc
parente6dbc8c4542c677d6d1a01806535274c1865f69f (diff)
downloadchromium_src-57113eacd955181e1267f3f20b889bc6fbfd07f2.zip
chromium_src-57113eacd955181e1267f3f20b889bc6fbfd07f2.tar.gz
chromium_src-57113eacd955181e1267f3f20b889bc6fbfd07f2.tar.bz2
Linux: Enable metrics_service_uitest.cc. Take 2.
Relands r18641, original code review: http://codereview.chromium.org/125268 Expect a crash on Windows. The old method of crashing was flawed on posix (KillProcess just does a SIGTERM). On Windows though, it would terminate the process with the desired exit code, in order to make DidProcessCrash() return true. This process termination does not dump crash information though, since it just forcibly terminates the process, like a SIGKILL on posix. When I switched it to navigate to about:crash though, it actually crashes, and dumps crash information, which the UITest in windows (but not linux/mac) detects. Therefore, until those platforms can detect, we just use #if defined(OS_WIN) around the expected_crashes = 1. Review URL: http://codereview.chromium.org/131007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/zygote_main_linux.cc')
-rw-r--r--chrome/browser/zygote_main_linux.cc45
1 files changed, 35 insertions, 10 deletions
diff --git a/chrome/browser/zygote_main_linux.cc b/chrome/browser/zygote_main_linux.cc
index 6d15c0f..ba550d9 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,