Remove fragile check in DidProcessCrash
- the numbers were out of sync with result_codes.h - can't use result_codes.h in base project so I extracted the generic part of it. Rahul: I hope I don't break installer assumptions here. Dan: don't feel obligated to review. Review URL: http://codereview.chromium.org/9012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4519 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -46,13 +46,22 @@ struct IoCounters {
|
|||||||
|
|
||||||
namespace process_util {
|
namespace process_util {
|
||||||
|
|
||||||
|
// A minimalistic but hopefully cross-platform set of exit codes.
|
||||||
|
// Do not change the enumeration values or you will break third-party
|
||||||
|
// installers.
|
||||||
|
enum {
|
||||||
|
PROCESS_END_NORMAL_TERMINATON = 0,
|
||||||
|
PROCESS_END_KILLED_BY_USER = 1,
|
||||||
|
PROCESS_END_PROCESS_WAS_HUNG = 2
|
||||||
|
};
|
||||||
|
|
||||||
// Returns the id of the current process.
|
// Returns the id of the current process.
|
||||||
int GetCurrentProcId();
|
int GetCurrentProcId();
|
||||||
|
|
||||||
// Returns the ProcessHandle of the current process.
|
// Returns the ProcessHandle of the current process.
|
||||||
ProcessHandle GetCurrentProcessHandle();
|
ProcessHandle GetCurrentProcessHandle();
|
||||||
|
|
||||||
// Returns the unique ID for the specified process. This is functionally the
|
// Returns the unique ID for the specified process. This is functionally the
|
||||||
// same as Windows' GetProcessId(), but works on versions of Windows before
|
// same as Windows' GetProcessId(), but works on versions of Windows before
|
||||||
// Win XP SP1 as well.
|
// Win XP SP1 as well.
|
||||||
int GetProcId(ProcessHandle process);
|
int GetProcId(ProcessHandle process);
|
||||||
|
@@ -187,10 +187,9 @@ bool DidProcessCrash(ProcessHandle handle) {
|
|||||||
// Warning, this is not generic code; it heavily depends on the way
|
// Warning, this is not generic code; it heavily depends on the way
|
||||||
// the rest of the code kills a process.
|
// the rest of the code kills a process.
|
||||||
|
|
||||||
if (exitcode == 0 || // Normal termination.
|
if (exitcode == PROCESS_END_NORMAL_TERMINATON ||
|
||||||
exitcode == 1 || // Killed by task manager.
|
exitcode == PROCESS_END_KILLED_BY_USER ||
|
||||||
exitcode == 14 || // Killed because of a bad message.
|
exitcode == PROCESS_END_PROCESS_WAS_HUNG ||
|
||||||
exitcode == 16 || // Killed by hung detector (see ResultCodes)
|
|
||||||
exitcode == 0xC0000354 || // STATUS_DEBUGGER_INACTIVE.
|
exitcode == 0xC0000354 || // STATUS_DEBUGGER_INACTIVE.
|
||||||
exitcode == 0xC000013A || // Control-C/end session.
|
exitcode == 0xC000013A || // Control-C/end session.
|
||||||
exitcode == 0x40010004) { // Debugger terminated process/end session.
|
exitcode == 0x40010004) { // Debugger terminated process/end session.
|
||||||
|
@@ -5,6 +5,8 @@
|
|||||||
#ifndef CHROME_APP_RESULT_CODES_H__
|
#ifndef CHROME_APP_RESULT_CODES_H__
|
||||||
#define CHROME_APP_RESULT_CODES_H__
|
#define CHROME_APP_RESULT_CODES_H__
|
||||||
|
|
||||||
|
#include "base/process_util.h"
|
||||||
|
|
||||||
// This file consolidates all the return codes for the browser and renderer
|
// This file consolidates all the return codes for the browser and renderer
|
||||||
// process. The return code is the value that:
|
// process. The return code is the value that:
|
||||||
// a) is returned by main() or winmain(), or
|
// a) is returned by main() or winmain(), or
|
||||||
@@ -18,7 +20,9 @@
|
|||||||
class ResultCodes {
|
class ResultCodes {
|
||||||
public:
|
public:
|
||||||
enum ExitCode {
|
enum ExitCode {
|
||||||
NORMAL_EXIT = 0, // Normal termination. Keep it *always* zero.
|
NORMAL_EXIT = process_util::PROCESS_END_NORMAL_TERMINATON,
|
||||||
|
TASKMAN_KILL = process_util::PROCESS_END_KILLED_BY_USER,
|
||||||
|
HUNG = process_util::PROCESS_END_PROCESS_WAS_HUNG,
|
||||||
INVALID_CMDLINE_URL, // An invalid command line url was given.
|
INVALID_CMDLINE_URL, // An invalid command line url was given.
|
||||||
SBOX_INIT_FAILED, // The sandbox could not be initialized.
|
SBOX_INIT_FAILED, // The sandbox could not be initialized.
|
||||||
GOOGLE_UPDATE_INIT_FAILED, // The Google Update client stub init failed.
|
GOOGLE_UPDATE_INIT_FAILED, // The Google Update client stub init failed.
|
||||||
@@ -35,7 +39,6 @@ class ResultCodes {
|
|||||||
UNSUPPORTED_PARAM, // Command line parameter is not supported.
|
UNSUPPORTED_PARAM, // Command line parameter is not supported.
|
||||||
KILLED_BAD_MESSAGE, // A bad message caused the process termination.
|
KILLED_BAD_MESSAGE, // A bad message caused the process termination.
|
||||||
IMPORTER_CANCEL, // The user canceled the browser import.
|
IMPORTER_CANCEL, // The user canceled the browser import.
|
||||||
HUNG, // Browser was hung and killed.
|
|
||||||
IMPORTER_HUNG, // Browser import hung and was killed.
|
IMPORTER_HUNG, // Browser import hung and was killed.
|
||||||
EXIT_LAST_CODE // Last return code (keep it last).
|
EXIT_LAST_CODE // Last return code (keep it last).
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user