Commit 798fc420 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Add check to keep chrome::ResultCode in sync with enums.xml.

Otherwise, it is too easy to accidentally change the enum value and make
it go out of sync. In fact, that is the current state. Update enums.xml
so the values line up again.

Also add a comment to remind readers to keep the enum values constant,
and mark a chrome::ResultCode enum as unused.

BUG=805754

Change-Id: I66efe023d5b8f5caa9f279641aea0f52a667ab0f
Reviewed-on: https://chromium-review.googlesource.com/885090Reviewed-by: default avatarScott Violet <sky@chromium.org>
Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Reviewed-by: default avatarWill Harris <wfh@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532203}
parent 734de963
......@@ -9,6 +9,11 @@
namespace chrome {
// IMPORTANT: This needs to stay in sync with <enum name="CrashExitCodes"> and
// <enum name="WindowsExitCode"> in tools/metrics/histograms/enums.xml. So do
// not remove any entries, and always append entries to the bottom just above
// RESULT_CODE_CHROME_LAST_CODE.
enum ResultCode {
RESULT_CODE_CHROME_START = content::RESULT_CODE_LAST_CODE,
......@@ -89,7 +94,7 @@ enum ResultCode {
// Failed to migrate user data directory for side-by-side package support
// (Linux-only).
RESULT_CODE_SXS_MIGRATION_FAILED,
RESULT_CODE_SXS_MIGRATION_FAILED_NOT_USED,
// The action is not allowed by a policy.
RESULT_CODE_ACTION_DISALLOWED_BY_POLICY,
......@@ -98,9 +103,12 @@ enum ResultCode {
RESULT_CODE_INVALID_SANDBOX_STATE,
// Last return code (keep this last).
RESULT_CODE_CHROME_LAST_CODE,
RESULT_CODE_CHROME_LAST_CODE
};
static_assert(RESULT_CODE_CHROME_LAST_CODE == 32,
"Please make sure the enum values are in sync with enums.xml");
} // namespace chrome
#endif // CHROME_COMMON_CHROME_RESULT_CODES_H_
......@@ -19,6 +19,14 @@ namespace content {
//
// A Java counterpart will be generated for this enum.
// GENERATED_JAVA_ENUM_PACKAGE: org.chromium.content_public.common
//
// IMPORTANT: This needs to stay in sync with <enum name="CrashExitCodes"> and
// <enum name="WindowsExitCode"> in tools/metrics/histograms/enums.xml. Due to
// chrome::ResultCode's dependency on the enum values, do not add any new values
// here, and mark obsolete values are unused instead of removing them. See
// https://crrev.com/c/885090 for context.
// TODO(wfh): Break the dependency so it is possible to add more values.
enum ResultCode {
// Process terminated normally.
RESULT_CODE_NORMAL_EXIT,
......@@ -39,6 +47,9 @@ enum ResultCode {
RESULT_CODE_LAST_CODE
};
static_assert(RESULT_CODE_LAST_CODE == 5,
"This enum is frozen - see the IMPORTANT note above.");
} // namespace content
#endif // CONTENT_PUBLIC_COMMON_RESULT_CODES_H_
......@@ -7210,31 +7210,32 @@ Called by update_net_error_codes.py.-->
<int value="1" label="RESULT_CODE_KILLED"/>
<int value="2" label="RESULT_CODE_HUNG"/>
<int value="3" label="RESULT_CODE_KILLED_BAD_MESSAGE"/>
<int value="4" label="RESULT_CODE_INVALID_CMDLINE_URL"/>
<int value="5" label="RESULT_CODE_BAD_PROCESS_TYPE"/>
<int value="6" label="RESULT_CODE_MISSING_DATA"/>
<int value="7" label="RESULT_CODE_SHELL_INTEGRATION_FAILED"/>
<int value="8" label="RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS"/>
<int value="9" label="RESULT_CODE_UNINSTALL_CHROME_ALIVE"/>
<int value="10" label="RESULT_CODE_UNINSTALL_USER_CANCEL"/>
<int value="11" label="RESULT_CODE_UNINSTALL_DELETE_PROFILE"/>
<int value="12" label="RESULT_CODE_UNSUPPORTED_PARAM"/>
<int value="13" label="RESULT_CODE_IMPORTER_HUNG"/>
<int value="14" label="RESULT_CODE_RESPAWN_FAILED"/>
<int value="15" label="RESULT_CODE_NORMAL_EXIT_EXP1"/>
<int value="16" label="RESULT_CODE_NORMAL_EXIT_EXP2"/>
<int value="17" label="RESULT_CODE_NORMAL_EXIT_EXP3"/>
<int value="18" label="RESULT_CODE_NORMAL_EXIT_EXP4"/>
<int value="19" label="RESULT_CODE_NORMAL_EXIT_CANCEL"/>
<int value="20" label="RESULT_CODE_PROFILE_IN_USE"/>
<int value="21" label="RESULT_CODE_PACK_EXTENSION_ERROR"/>
<int value="22" label="RESULT_CODE_UNINSTALL_EXTENSION_ERROR"/>
<int value="23" label="RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED"/>
<int value="25" label="RESULT_CODE_INSTALL_FROM_WEBSTORE_ERROR_2"/>
<int value="27" label="RESULT_CODE_EULA_REFUSED"/>
<int value="28" label="RESULT_CODE_SXS_MIGRATION_FAILED"/>
<int value="29" label="RESULT_CODE_ACTION_DISALLOWED_BY_POLICY"/>
<int value="30" label="RESULT_CODE_INVALID_SANDBOX_STATE"/>
<int value="4" label="RESULT_CODE_GPU_DEAD_ON_ARRIVAL"/>
<int value="5" label="RESULT_CODE_INVALID_CMDLINE_URL"/>
<int value="6" label="RESULT_CODE_BAD_PROCESS_TYPE"/>
<int value="7" label="RESULT_CODE_MISSING_DATA"/>
<int value="8" label="RESULT_CODE_SHELL_INTEGRATION_FAILED"/>
<int value="9" label="RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS"/>
<int value="10" label="RESULT_CODE_UNINSTALL_CHROME_ALIVE"/>
<int value="11" label="RESULT_CODE_UNINSTALL_USER_CANCEL"/>
<int value="12" label="RESULT_CODE_UNINSTALL_DELETE_PROFILE"/>
<int value="13" label="RESULT_CODE_UNSUPPORTED_PARAM"/>
<int value="14" label="RESULT_CODE_IMPORTER_HUNG"/>
<int value="15" label="RESULT_CODE_RESPAWN_FAILED"/>
<int value="16" label="RESULT_CODE_NORMAL_EXIT_EXP1"/>
<int value="17" label="RESULT_CODE_NORMAL_EXIT_EXP2"/>
<int value="18" label="RESULT_CODE_NORMAL_EXIT_EXP3"/>
<int value="19" label="RESULT_CODE_NORMAL_EXIT_EXP4"/>
<int value="20" label="RESULT_CODE_NORMAL_EXIT_CANCEL"/>
<int value="21" label="RESULT_CODE_PROFILE_IN_USE"/>
<int value="22" label="RESULT_CODE_PACK_EXTENSION_ERROR"/>
<int value="23" label="RESULT_CODE_UNINSTALL_EXTENSION_ERROR"/>
<int value="24" label="RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED"/>
<int value="26" label="RESULT_CODE_INSTALL_FROM_WEBSTORE_ERROR_2"/>
<int value="28" label="RESULT_CODE_EULA_REFUSED"/>
<int value="29" label="RESULT_CODE_SXS_MIGRATION_FAILED_NOT_USED"/>
<int value="30" label="RESULT_CODE_ACTION_DISALLOWED_BY_POLICY"/>
<int value="31" label="RESULT_CODE_INVALID_SANDBOX_STATE"/>
<int value="131" label="SIGQUIT"/>
<int value="132" label="SIGILL"/>
<int value="133" label="SIGTRAP"/>
......@@ -45541,33 +45542,34 @@ Called by update_traffic_annotation_histograms.py.-->
<int value="1" label="content::RESULT_CODE_KILLED"/>
<int value="2" label="content::RESULT_CODE_HUNG"/>
<int value="3" label="content::RESULT_CODE_KILLED_BAD_MESSAGE"/>
<int value="4" label="chrome::RESULT_CODE_INVALID_CMDLINE_URL"/>
<int value="5" label="chrome::RESULT_CODE_BAD_PROCESS_TYPE"/>
<int value="6" label="chrome::RESULT_CODE_MISSING_DATA"/>
<int value="7" label="chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED"/>
<int value="8" label="chrome::RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS"/>
<int value="9" label="chrome::RESULT_CODE_UNINSTALL_CHROME_ALIVE"/>
<int value="10" label="chrome::RESULT_CODE_UNINSTALL_USER_CANCEL"/>
<int value="11" label="chrome::RESULT_CODE_UNINSTALL_DELETE_PROFILE"/>
<int value="12" label="chrome::RESULT_CODE_UNSUPPORTED_PARAM"/>
<int value="13" label="chrome::RESULT_CODE_IMPORTER_HUNG"/>
<int value="14" label="chrome::RESULT_CODE_RESPAWN_FAILED"/>
<int value="15" label="chrome::RESULT_CODE_NORMAL_EXIT_EXP1"/>
<int value="16" label="chrome::RESULT_CODE_NORMAL_EXIT_EXP2"/>
<int value="17" label="chrome::RESULT_CODE_NORMAL_EXIT_EXP3"/>
<int value="18" label="chrome::RESULT_CODE_NORMAL_EXIT_EXP4"/>
<int value="19" label="chrome::RESULT_CODE_NORMAL_EXIT_CANCEL"/>
<int value="20" label="chrome::RESULT_CODE_PROFILE_IN_USE"/>
<int value="21" label="chrome::RESULT_CODE_PACK_EXTENSION_ERROR"/>
<int value="22" label="chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR"/>
<int value="23" label="chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED"/>
<int value="24" label="chrome::RESULT_CODE_NOTUSED_1"/>
<int value="25" label="chrome::RESULT_CODE_INSTALL_FROM_WEBSTORE_ERROR_2"/>
<int value="26" label="chrome::RESULT_CODE_NOTUSED_2"/>
<int value="27" label="chrome::RESULT_CODE_EULA_REFUSED"/>
<int value="28" label="chrome::RESULT_CODE_SXS_MIGRATION_FAILED"/>
<int value="29" label="chrome::RESULT_CODE_ACTION_DISALLOWED_BY_POLICY"/>
<int value="30" label="chrome::RESULT_CODE_INVALID_SANDBOX_STATE"/>
<int value="4" label="content::RESULT_CODE_GPU_DEAD_ON_ARRIVAL"/>
<int value="5" label="chrome::RESULT_CODE_INVALID_CMDLINE_URL"/>
<int value="6" label="chrome::RESULT_CODE_BAD_PROCESS_TYPE"/>
<int value="7" label="chrome::RESULT_CODE_MISSING_DATA"/>
<int value="8" label="chrome::RESULT_CODE_SHELL_INTEGRATION_FAILED"/>
<int value="9" label="chrome::RESULT_CODE_MACHINE_LEVEL_INSTALL_EXISTS"/>
<int value="10" label="chrome::RESULT_CODE_UNINSTALL_CHROME_ALIVE"/>
<int value="11" label="chrome::RESULT_CODE_UNINSTALL_USER_CANCEL"/>
<int value="12" label="chrome::RESULT_CODE_UNINSTALL_DELETE_PROFILE"/>
<int value="13" label="chrome::RESULT_CODE_UNSUPPORTED_PARAM"/>
<int value="14" label="chrome::RESULT_CODE_IMPORTER_HUNG"/>
<int value="15" label="chrome::RESULT_CODE_RESPAWN_FAILED"/>
<int value="16" label="chrome::RESULT_CODE_NORMAL_EXIT_EXP1"/>
<int value="17" label="chrome::RESULT_CODE_NORMAL_EXIT_EXP2"/>
<int value="18" label="chrome::RESULT_CODE_NORMAL_EXIT_EXP3"/>
<int value="19" label="chrome::RESULT_CODE_NORMAL_EXIT_EXP4"/>
<int value="20" label="chrome::RESULT_CODE_NORMAL_EXIT_CANCEL"/>
<int value="21" label="chrome::RESULT_CODE_PROFILE_IN_USE"/>
<int value="22" label="chrome::RESULT_CODE_PACK_EXTENSION_ERROR"/>
<int value="23" label="chrome::RESULT_CODE_UNINSTALL_EXTENSION_ERROR"/>
<int value="24" label="chrome::RESULT_CODE_NORMAL_EXIT_PROCESS_NOTIFIED"/>
<int value="25" label="chrome::RESULT_CODE_NOTUSED_1"/>
<int value="26" label="chrome::RESULT_CODE_INSTALL_FROM_WEBSTORE_ERROR_2"/>
<int value="27" label="chrome::RESULT_CODE_NOTUSED_2"/>
<int value="28" label="chrome::RESULT_CODE_EULA_REFUSED"/>
<int value="29" label="chrome::RESULT_CODE_SXS_MIGRATION_FAILED"/>
<int value="30" label="chrome::RESULT_CODE_ACTION_DISALLOWED_BY_POLICY"/>
<int value="31" label="chrome::RESULT_CODE_INVALID_SANDBOX_STATE"/>
<int value="259" label="0x103 - STILL_ACTIVE."/>
<int value="85436397" label="0x517a7ed - Crashpad simulated exception"/>
<int value="1073807364" label="0x40010004 - DBG_TERMINATE_PROCESS"/>
......@@ -12211,12 +12211,18 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
<histogram name="CrashExitCodes.Extension" enum="CrashExitCodes">
<owner>wfh@chromium.org</owner>
<summary>The exit codes for crashed extension processes.</summary>
<summary>
The exit codes for crashed extension processes. Note: Due to
https://crbug.com/805754, the enum labels are off by 1 for M56 and earlier.
</summary>
</histogram>
<histogram name="CrashExitCodes.Renderer" enum="CrashExitCodes">
<owner>wfh@chromium.org</owner>
<summary>The exit codes for crashed renderer processes.</summary>
<summary>
The exit codes for crashed renderer processes. Note: Due to
https://crbug.com/805754, the enum labels are off by 1 for M56 and earlier.
</summary>
</histogram>
<histogram name="Crashpad.CrashReportPending" enum="CrashpadReportPending">
......@@ -84906,7 +84912,8 @@ http://cs/file:chrome/histograms.xml - but prefer this file for new entries.
Records the exit code of the browser process (on Windows) from the previous
launch. On crash, the exit code will indicate the exception code of the
crash. This is emitted in stability data with the first report on a
subsequent launch.
subsequent launch. Note: Due to https://crbug.com/805754, the enum labels
for RESULT_CODE_* are off by 1 for M56 and earlier.
</summary>
</histogram>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment