diff options
author | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 21:53:05 +0000 |
---|---|---|
committer | akalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-07 21:53:05 +0000 |
commit | bf97033addc8e72499652f64886ef89c7b062c39 (patch) | |
tree | c20ae214eb4ffe605e0292299e1e93935272e482 | |
parent | 8ffd052ba929d94eb587e4d55efc74557cd7454d (diff) | |
download | chromium_src-bf97033addc8e72499652f64886ef89c7b062c39.zip chromium_src-bf97033addc8e72499652f64886ef89c7b062c39.tar.gz chromium_src-bf97033addc8e72499652f64886ef89c7b062c39.tar.bz2 |
Revert 70782 - Made logging not look up --enable-dcheck from command line
Made --enable-dcheck a parameter to InitLogging() and fixed up all
callsites.
BUG=62736
TEST=Manual
Review URL: http://codereview.chromium.org/6070006
TBR=akalin@chromium.org
Review URL: http://codereview.chromium.org/6100007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70783 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/logging.cc | 8 | ||||
-rw-r--r-- | base/logging.h | 23 | ||||
-rw-r--r-- | base/test/test_suite.cc | 10 | ||||
-rw-r--r-- | ceee/ie/broker/broker_module.cc | 3 | ||||
-rw-r--r-- | ceee/ie/plugin/toolband/toolband_module.cc | 3 | ||||
-rw-r--r-- | ceee/installer_dll/installer_helper.cc | 3 | ||||
-rw-r--r-- | chrome/browser/sync/tools/sync_listen_notifications.cc | 8 | ||||
-rw-r--r-- | chrome/common/logging_chrome.cc | 8 | ||||
-rw-r--r-- | chrome/installer/util/logging_installer.cc | 10 | ||||
-rw-r--r-- | chrome/tools/crash_service/main.cc | 8 | ||||
-rw-r--r-- | chrome_frame/chrome_tab.cc | 8 | ||||
-rw-r--r-- | chrome_frame/crash_reporting/minidump_test.cc | 10 | ||||
-rw-r--r-- | chrome_frame/test/net/fake_external_tab.cc | 10 | ||||
-rw-r--r-- | courgette/courgette_tool.cc | 10 | ||||
-rw-r--r-- | net/tools/flip_server/flip_in_mem_edsm_server.cc | 3 | ||||
-rw-r--r-- | net/tools/testserver/run_testserver.cc | 10 | ||||
-rw-r--r-- | net/tools/tld_cleanup/tld_cleanup.cc | 10 | ||||
-rw-r--r-- | webkit/support/webkit_support.cc | 3 | ||||
-rw-r--r-- | webkit/tools/test_shell/test_shell.cc | 10 |
19 files changed, 55 insertions, 103 deletions
diff --git a/base/logging.cc b/base/logging.cc index bdce7b3..cfb1065 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -64,7 +64,7 @@ typedef pthread_mutex_t* MutexHandle; namespace logging { -DcheckState g_dcheck_state = DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; +bool g_enable_dcheck = false; VlogInfo* g_vlog_info = NULL; const char* const log_severity_names[LOG_NUM_SEVERITIES] = { @@ -353,10 +353,10 @@ bool InitializeLogFileHandle() { bool BaseInitLoggingImpl(const PathChar* new_log_file, LoggingDestination logging_dest, LogLockingState lock_log, - OldFileDeletionState delete_old, - DcheckState dcheck_state) { + OldFileDeletionState delete_old) { CommandLine* command_line = CommandLine::ForCurrentProcess(); - g_dcheck_state = dcheck_state; + g_enable_dcheck = + command_line->HasSwitch(switches::kEnableDCHECK); delete g_vlog_info; g_vlog_info = NULL; // Don't bother initializing g_vlog_info unless we use one of the diff --git a/base/logging.h b/base/logging.h index 72e6d8d..a097568 100644 --- a/base/logging.h +++ b/base/logging.h @@ -165,11 +165,6 @@ enum LogLockingState { LOCK_LOG_FILE, DONT_LOCK_LOG_FILE }; // Defaults to APPEND_TO_OLD_LOG_FILE. enum OldFileDeletionState { DELETE_OLD_LOG_FILE, APPEND_TO_OLD_LOG_FILE }; -enum DcheckState { - DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS, - ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS -}; - // TODO(avi): do we want to do a unification of character types here? #if defined(OS_WIN) typedef wchar_t PathChar; @@ -193,8 +188,7 @@ typedef char PathChar; bool BaseInitLoggingImpl(const PathChar* log_file, LoggingDestination logging_dest, LogLockingState lock_log, - OldFileDeletionState delete_old, - DcheckState dcheck_state); + OldFileDeletionState delete_old); // Sets the log file name and other global logging state. Calling this function // is recommended, and is normally done at the beginning of application init. @@ -209,10 +203,8 @@ bool BaseInitLoggingImpl(const PathChar* log_file, inline bool InitLogging(const PathChar* log_file, LoggingDestination logging_dest, LogLockingState lock_log, - OldFileDeletionState delete_old, - DcheckState dcheck_state) { - return BaseInitLoggingImpl(log_file, logging_dest, lock_log, - delete_old, dcheck_state); + OldFileDeletionState delete_old) { + return BaseInitLoggingImpl(log_file, logging_dest, lock_log, delete_old); } // Sets the log level. Anything at or above this level will be written to the @@ -608,11 +600,10 @@ enum { DEBUG_MODE = ENABLE_DLOG }; COMPACT_GOOGLE_LOG_EX_ERROR_REPORT(ClassName , ##__VA_ARGS__) #define COMPACT_GOOGLE_LOG_DCHECK COMPACT_GOOGLE_LOG_ERROR_REPORT const LogSeverity LOG_DCHECK = LOG_ERROR_REPORT; -extern DcheckState g_dcheck_state; -#define DCHECK_IS_ON() \ - ((::logging::g_dcheck_state == \ - ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS) && \ - LOG_IS_ON(DCHECK)) +// This is set to true in InitLogging when we want to enable the +// DCHECKs in release. +extern bool g_enable_dcheck; +#define DCHECK_IS_ON() (::logging::g_enable_dcheck && LOG_IS_ON(DCHECK)) #else // defined(NDEBUG) diff --git a/base/test/test_suite.cc b/base/test/test_suite.cc index 5f8a616..aa23f04 100644 --- a/base/test/test_suite.cc +++ b/base/test/test_suite.cc @@ -175,12 +175,10 @@ void TestSuite::Initialize() { FilePath exe; PathService::Get(base::FILE_EXE, &exe); FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); - logging::InitLogging( - log_filename.value().c_str(), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(log_filename.value().c_str(), + logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, + logging::LOCK_LOG_FILE, + logging::DELETE_OLD_LOG_FILE); // We want process and thread IDs because we may have multiple processes. // Note: temporarily enabled timestamps in an effort to catch bug 6361. logging::SetLogItems(true, true, true, true); diff --git a/ceee/ie/broker/broker_module.cc b/ceee/ie/broker/broker_module.cc index d90cf70..71a007a 100644 --- a/ceee/ie/broker/broker_module.cc +++ b/ceee/ie/broker/broker_module.cc @@ -110,8 +110,7 @@ CeeeBrokerModule::CeeeBrokerModule() logfile_path, logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::APPEND_TO_OLD_LOG_FILE); // Initialize ETW logging. logging::LogEventProvider::Initialize(kCeeeBrokerLogProviderName); diff --git a/ceee/ie/plugin/toolband/toolband_module.cc b/ceee/ie/plugin/toolband/toolband_module.cc index c41bd23..bb5ee4a 100644 --- a/ceee/ie/plugin/toolband/toolband_module.cc +++ b/ceee/ie/plugin/toolband/toolband_module.cc @@ -98,8 +98,7 @@ ToolbandModule::ToolbandModule() logfile_path, logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::APPEND_TO_OLD_LOG_FILE); // Initialize ETW logging. logging::LogEventProvider::Initialize(kCeeeIeLogProviderName); diff --git a/ceee/installer_dll/installer_helper.cc b/ceee/installer_dll/installer_helper.cc index 2128228..f20c8e8 100644 --- a/ceee/installer_dll/installer_helper.cc +++ b/ceee/installer_dll/installer_helper.cc @@ -46,8 +46,7 @@ InstallerHelperModule::InstallerHelperModule() { logfile_path, logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::APPEND_TO_OLD_LOG_FILE); } InstallerHelperModule _AtlModule; diff --git a/chrome/browser/sync/tools/sync_listen_notifications.cc b/chrome/browser/sync/tools/sync_listen_notifications.cc index 27e3010..0f66c27 100644 --- a/chrome/browser/sync/tools/sync_listen_notifications.cc +++ b/chrome/browser/sync/tools/sync_listen_notifications.cc @@ -222,12 +222,8 @@ class ServerNotifierDelegate int main(int argc, char* argv[]) { base::AtExitManager exit_manager; CommandLine::Init(argc, argv); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, + logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE); logging::SetMinLogLevel(logging::LOG_INFO); // TODO(akalin): Make sure that all log messages are printed to the // console, even on Windows (SetMinLogLevel isn't enough). diff --git a/chrome/common/logging_chrome.cc b/chrome/common/logging_chrome.cc index f8418ac..c607f21 100644 --- a/chrome/common/logging_chrome.cc +++ b/chrome/common/logging_chrome.cc @@ -262,16 +262,10 @@ void InitChromeLogging(const CommandLine& command_line, delete_old_log_file = logging::APPEND_TO_OLD_LOG_FILE; #endif - logging::DcheckState dcheck_state = - command_line.HasSwitch(switches::kEnableDCHECK) ? - logging::ENABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS : - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS; - bool success = InitLogging(log_path.value().c_str(), DetermineLogMode(command_line), logging::LOCK_LOG_FILE, - delete_old_log_file, - dcheck_state); + delete_old_log_file); #if defined(OS_CHROMEOS) if (!success) { diff --git a/chrome/installer/util/logging_installer.cc b/chrome/installer/util/logging_installer.cc index 73e1719..d91ca70 100644 --- a/chrome/installer/util/logging_installer.cc +++ b/chrome/installer/util/logging_installer.cc @@ -38,12 +38,10 @@ void InitInstallerLogging(const installer::MasterPreferences& prefs) { return; } - logging::InitLogging( - GetLogFilePath(prefs).value().c_str(), - logging::LOG_ONLY_TO_FILE, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(GetLogFilePath(prefs).value().c_str(), + logging::LOG_ONLY_TO_FILE, + logging::LOCK_LOG_FILE, + logging::DELETE_OLD_LOG_FILE); if (prefs.GetBool(installer::master_preferences::kVerboseLogging, &value) && value) { diff --git a/chrome/tools/crash_service/main.cc b/chrome/tools/crash_service/main.cc index b9cabec6..4a8e56a 100644 --- a/chrome/tools/crash_service/main.cc +++ b/chrome/tools/crash_service/main.cc @@ -45,12 +45,8 @@ int __stdcall wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd_line, FilePath log_file = operating_dir.Append(kStandardLogFile); // Logging to a file with pid, tid and timestamp. - logging::InitLogging( - log_file.value().c_str(), - logging::LOG_ONLY_TO_FILE, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(log_file.value().c_str(), logging::LOG_ONLY_TO_FILE, + logging::LOCK_LOG_FILE, logging::APPEND_TO_OLD_LOG_FILE); logging::SetLogItems(true, true, true, false); VLOG(1) << "session start. cmdline is [" << cmd_line << "]"; diff --git a/chrome_frame/chrome_tab.cc b/chrome_frame/chrome_tab.cc index 5e65160..b966e5c 100644 --- a/chrome_frame/chrome_tab.cc +++ b/chrome_frame/chrome_tab.cc @@ -209,12 +209,8 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, g_exit_manager = new base::AtExitManager(); CommandLine::Init(0, NULL); InitializeCrashReporting(); - logging::InitLogging( - NULL, - logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(NULL, logging::LOG_ONLY_TO_SYSTEM_DEBUG_LOG, + logging::LOCK_LOG_FILE, logging::DELETE_OLD_LOG_FILE); DllRedirector* dll_redirector = DllRedirector::GetInstance(); DCHECK(dll_redirector); diff --git a/chrome_frame/crash_reporting/minidump_test.cc b/chrome_frame/crash_reporting/minidump_test.cc index 14db48ea..9b4ef22 100644 --- a/chrome_frame/crash_reporting/minidump_test.cc +++ b/chrome_frame/crash_reporting/minidump_test.cc @@ -433,11 +433,9 @@ int main(int argc, char** argv) { testing::InitGoogleTest(&argc, argv); CommandLine::Init(argc, argv); - logging::InitLogging( - L"CON", - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::DONT_LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(L"CON", + logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, + logging::DONT_LOCK_LOG_FILE, + logging::APPEND_TO_OLD_LOG_FILE); return RUN_ALL_TESTS(); } diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index fc38252..0cb72d1 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -383,12 +383,10 @@ void CFUrlRequestUnittestRunner::InitializeLogging() { FilePath exe; PathService::Get(base::FILE_EXE, &exe); FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); - logging::InitLogging( - log_filename.value().c_str(), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(log_filename.value().c_str(), + logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, + logging::LOCK_LOG_FILE, + logging::DELETE_OLD_LOG_FILE); // We want process and thread IDs because we may have multiple processes. // Note: temporarily enabled timestamps in an effort to catch bug 6361. logging::SetLogItems(true, true, true, true); diff --git a/courgette/courgette_tool.cc b/courgette/courgette_tool.cc index 7176442..5e37f30 100644 --- a/courgette/courgette_tool.cc +++ b/courgette/courgette_tool.cc @@ -346,12 +346,10 @@ int main(int argc, const char* argv[]) { CommandLine::Init(argc, argv); const CommandLine& command_line = *CommandLine::ForCurrentProcess(); - (void)logging::InitLogging( - FILE_PATH_LITERAL("courgette.log"), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + (void)logging::InitLogging(FILE_PATH_LITERAL("courgette.log"), + logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, + logging::LOCK_LOG_FILE, + logging::APPEND_TO_OLD_LOG_FILE); logging::SetMinLogLevel(logging::LOG_VERBOSE); bool cmd_dis = command_line.HasSwitch("dis"); diff --git a/net/tools/flip_server/flip_in_mem_edsm_server.cc b/net/tools/flip_server/flip_in_mem_edsm_server.cc index 6d4ed8f..a378e72 100644 --- a/net/tools/flip_server/flip_in_mem_edsm_server.cc +++ b/net/tools/flip_server/flip_in_mem_edsm_server.cc @@ -3057,8 +3057,7 @@ int main (int argc, char**argv) InitLogging(g_proxy_config.log_filename_.c_str(), g_proxy_config.log_destination_, logging::DONT_LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::APPEND_TO_OLD_LOG_FILE); LOG(INFO) << "Flip SPDY proxy started with configuration:"; LOG(INFO) << "Logging destination : " << g_proxy_config.log_destination_; diff --git a/net/tools/testserver/run_testserver.cc b/net/tools/testserver/run_testserver.cc index bfaa682..650b415 100644 --- a/net/tools/testserver/run_testserver.cc +++ b/net/tools/testserver/run_testserver.cc @@ -24,12 +24,10 @@ int main(int argc, const char* argv[]) { CommandLine::Init(argc, argv); CommandLine* command_line = CommandLine::ForCurrentProcess(); - if (!logging::InitLogging( - FILE_PATH_LITERAL("testserver.log"), - logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, - logging::LOCK_LOG_FILE, - logging::APPEND_TO_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS)) { + if (!logging::InitLogging(FILE_PATH_LITERAL("testserver.log"), + logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, + logging::LOCK_LOG_FILE, + logging::APPEND_TO_OLD_LOG_FILE)) { printf("Error: could not initialize logging. Exiting.\n"); return -1; } diff --git a/net/tools/tld_cleanup/tld_cleanup.cc b/net/tools/tld_cleanup/tld_cleanup.cc index be723c4..e055577 100644 --- a/net/tools/tld_cleanup/tld_cleanup.cc +++ b/net/tools/tld_cleanup/tld_cleanup.cc @@ -266,12 +266,10 @@ int main(int argc, const char* argv[]) { FilePath log_filename; PathService::Get(base::DIR_EXE, &log_filename); log_filename = log_filename.AppendASCII("tld_cleanup.log"); - logging::InitLogging( - log_filename.value().c_str(), - destination, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(log_filename.value().c_str(), + destination, + logging::LOCK_LOG_FILE, + logging::DELETE_OLD_LOG_FILE); icu_util::Initialize(); diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index 52a2a34..e9eed2e 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -93,8 +93,7 @@ void InitLogging(bool enable_gp_fault_error_box) { logging::LOG_ONLY_TO_FILE, // We might have multiple DumpRenderTree processes going at once. logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::DELETE_OLD_LOG_FILE); // We want process and thread IDs because we may have multiple processes. const bool kProcessId = true; diff --git a/webkit/tools/test_shell/test_shell.cc b/webkit/tools/test_shell/test_shell.cc index a1a6927..ce83655 100644 --- a/webkit/tools/test_shell/test_shell.cc +++ b/webkit/tools/test_shell/test_shell.cc @@ -417,12 +417,10 @@ void TestShell::InitLogging(bool suppress_error_dialogs, FilePath log_filename; PathService::Get(base::DIR_EXE, &log_filename); log_filename = log_filename.AppendASCII("test_shell.log"); - logging::InitLogging( - log_filename.value().c_str(), - destination, - logging::LOCK_LOG_FILE, - logging::DELETE_OLD_LOG_FILE, - logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); + logging::InitLogging(log_filename.value().c_str(), + destination, + logging::LOCK_LOG_FILE, + logging::DELETE_OLD_LOG_FILE); // we want process and thread IDs because we may have multiple processes logging::SetLogItems(true, true, false, true); |