Add a switch to enable DCHECKs in release builds (issue #790).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@930 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-11-28 19:03:15 +00:00
parent cc2801d1d5
commit faf218df4a
6 changed files with 20 additions and 5 deletions

View File

@ -335,6 +335,7 @@ void CefContentBrowserClient::AppendExtraCommandLineSwitches(
switches::kLocalesDirPath,
switches::kLogFile,
switches::kLogSeverity,
switches::kReleaseDcheckEnabled,
switches::kPackLoadingDisabled,
switches::kResourcesDirPath,
};

View File

@ -21,6 +21,9 @@ const char kLogSeverity_Error[] = "error";
const char kLogSeverity_ErrorReport[] = "error-report";
const char kLogSeverity_Disable[] = "disable";
// Enable DCHECK for release mode.
const char kReleaseDcheckEnabled[] = "release-dcheck-enabled";
// Path to resources directory.
const char kResourcesDirPath[] = "resources-dir-path";

View File

@ -19,6 +19,7 @@ extern const char kLogSeverity_Warning[];
extern const char kLogSeverity_Error[];
extern const char kLogSeverity_ErrorReport[];
extern const char kLogSeverity_Disable[];
extern const char kReleaseDcheckEnabled[];
extern const char kResourcesDirPath[];
extern const char kLocalesDirPath[];
extern const char kPackLoadingDisabled[];

View File

@ -223,6 +223,9 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
command_line->AppendSwitchASCII(switches::kLogSeverity, log_severity);
}
if (settings.release_dcheck_enabled)
command_line->AppendSwitch(switches::kReleaseDcheckEnabled);
if (settings.javascript_flags.length > 0) {
command_line->AppendSwitchASCII(switches::kJavaScriptFlags,
CefString(&settings.javascript_flags));
@ -305,17 +308,18 @@ bool CefMainDelegate::BasicStartupComplete(int* exit_code) {
if (log_severity == LOGSEVERITY_DISABLE) {
logging_dest = logging::LOG_NONE;
} else {
#if defined(OS_WIN)
logging_dest = logging::LOG_ONLY_TO_FILE;
#else
logging_dest = logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG;
#endif
logging::SetMinLogLevel(log_severity);
}
logging::DcheckState dcheck_state =
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
if (command_line->HasSwitch(switches::kReleaseDcheckEnabled))
dcheck_state = logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS;
logging::InitLogging(log_file.value().c_str(), logging_dest,
logging::DONT_LOCK_LOG_FILE, logging::APPEND_TO_OLD_LOG_FILE,
logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS);
dcheck_state);
content::SetContentClient(&content_client_);