| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <windows.h> | 8 #include <windows.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| 11 #include <iostream> | 11 #include <iostream> |
| 12 #include <fstream> | 12 #include <fstream> |
| 13 | 13 |
| 14 #include "chrome/common/logging_chrome.h" | 14 #include "chrome/common/logging_chrome.h" |
| 15 | 15 |
| 16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
| 17 #include "base/compiler_specific.h" |
| 17 #include "base/debug_util.h" | 18 #include "base/debug_util.h" |
| 18 #include "base/file_util.h" | 19 #include "base/file_util.h" |
| 19 #include "base/logging.h" | 20 #include "base/logging.h" |
| 20 #include "base/path_service.h" | 21 #include "base/path_service.h" |
| 21 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 22 #include "base/sys_info.h" | 23 #include "base/sys_info.h" |
| 23 #include "chrome/common/chrome_paths.h" | 24 #include "chrome/common/chrome_paths.h" |
| 24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
| 25 #include "chrome/common/env_vars.h" | 26 #include "chrome/common/env_vars.h" |
| 26 | 27 |
| 27 // When true, this means that error dialogs should not be shown. | 28 // When true, this means that error dialogs should not be shown. |
| 28 static bool dialogs_are_suppressed_ = false; | 29 static bool dialogs_are_suppressed_ = false; |
| 29 | 30 |
| 30 // This should be true for exactly the period between the end of | 31 // This should be true for exactly the period between the end of |
| 31 // InitChromeLogging() and the beginning of CleanupChromeLogging(). | 32 // InitChromeLogging() and the beginning of CleanupChromeLogging(). |
| 32 static bool chrome_logging_initialized_ = false; | 33 static bool chrome_logging_initialized_ = false; |
| 33 | 34 |
| 34 // Assertion handler for logging errors that occur when dialogs are | 35 // Assertion handler for logging errors that occur when dialogs are |
| 35 // silenced. To record a new error, pass the log string associated | 36 // silenced. To record a new error, pass the log string associated |
| 36 // with that error in the str parameter. | 37 // with that error in the str parameter. |
| 37 #pragma optimize("", off) | 38 MSVC_DISABLE_OPTIMIZE(); |
| 38 static void SilentRuntimeAssertHandler(const std::string& str) { | 39 static void SilentRuntimeAssertHandler(const std::string& str) { |
| 39 DebugUtil::BreakDebugger(); | 40 DebugUtil::BreakDebugger(); |
| 40 } | 41 } |
| 41 #pragma optimize("", on) | 42 MSVC_ENABLE_OPTIMIZE(); |
| 42 | 43 |
| 43 // Suppresses error/assertion dialogs and enables the logging of | 44 // Suppresses error/assertion dialogs and enables the logging of |
| 44 // those errors into silenced_errors_. | 45 // those errors into silenced_errors_. |
| 45 static void SuppressDialogs() { | 46 static void SuppressDialogs() { |
| 46 if (dialogs_are_suppressed_) | 47 if (dialogs_are_suppressed_) |
| 47 return; | 48 return; |
| 48 | 49 |
| 49 logging::SetLogAssertHandler(SilentRuntimeAssertHandler); | 50 logging::SetLogAssertHandler(SilentRuntimeAssertHandler); |
| 50 | 51 |
| 51 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 ++assertion_count; | 191 ++assertion_count; |
| 191 } | 192 } |
| 192 } | 193 } |
| 193 log_file.close(); | 194 log_file.close(); |
| 194 | 195 |
| 195 return assertion_count; | 196 return assertion_count; |
| 196 } | 197 } |
| 197 | 198 |
| 198 } // namespace logging | 199 } // namespace logging |
| 199 | 200 |
| OLD | NEW |