#include "base/check.h"
#include <optional>
#include "base/check_op.h"
#include "base/check_version_internal.h"
#include "base/debug/alias.h"
#include "base/debug/dump_without_crashing.h"
#include "base/logging.h"
#include "base/thread_annotations.h"
#include "base/types/cxx23_to_underlying.h"
#include "build/build_config.h"
#if BUILDFLAG(IS_NACL)
namespace base::debug {
class CrashKeyString;
}
#else
#include "base/debug/crash_logging.h"
#endif
namespace logging {
namespace {
LogSeverity GetDumpSeverity() { … }
LogSeverity GetNotFatalUntilSeverity(base::NotFatalUntil fatal_milestone) { … }
LogSeverity GetCheckSeverity(base::NotFatalUntil fatal_milestone) { … }
base::debug::CrashKeyString* GetNotReachedCrashKey() { … }
base::debug::CrashKeyString* GetDCheckCrashKey() { … }
base::debug::CrashKeyString* GetDumpWillBeCheckCrashKey() { … }
void DumpWithoutCrashing(base::debug::CrashKeyString* message_key,
const std::string& crash_string,
const base::Location& location,
base::NotFatalUntil fatal_milestone) { … }
class NotReachedLogMessage : public LogMessage { … };
class DCheckLogMessage : public LogMessage { … };
class CheckLogMessage : public LogMessage { … };
#if BUILDFLAG(IS_WIN)
class DCheckWin32ErrorLogMessage : public Win32ErrorLogMessage {
public:
DCheckWin32ErrorLogMessage(const base::Location& location,
SystemErrorCode err)
: Win32ErrorLogMessage(location.file_name(),
location.line_number(),
LOGGING_DCHECK,
err),
location_(location) {}
~DCheckWin32ErrorLogMessage() override {
if (severity() != logging::LOGGING_FATAL) {
DumpWithoutCrashing(GetDCheckCrashKey(), BuildCrashString(), location_,
base::NotFatalUntil::NoSpecifiedMilestoneInternal);
}
}
private:
const base::Location location_;
};
#elif BUILDFLAG(IS_POSIX) || BUILDFLAG(IS_FUCHSIA)
class DCheckErrnoLogMessage : public ErrnoLogMessage { … };
#endif
}
CheckError CheckError::Check(const char* condition,
base::NotFatalUntil fatal_milestone,
const base::Location& location) { … }
CheckError CheckError::CheckOp(char* log_message_str,
base::NotFatalUntil fatal_milestone,
const base::Location& location) { … }
CheckError CheckError::DCheck(const char* condition,
const base::Location& location) { … }
CheckError CheckError::DCheckOp(char* log_message_str,
const base::Location& location) { … }
CheckError CheckError::DumpWillBeCheck(const char* condition,
const base::Location& location) { … }
CheckError CheckError::DumpWillBeCheckOp(char* log_message_str,
const base::Location& location) { … }
CheckError CheckError::PCheck(const char* condition,
const base::Location& location) { … }
CheckError CheckError::PCheck(const base::Location& location) { … }
CheckError CheckError::DPCheck(const char* condition,
const base::Location& location) { … }
CheckError CheckError::DumpWillBeNotReachedNoreturn(
const base::Location& location) { … }
CheckError CheckError::NotImplemented(const char* function,
const base::Location& location) { … }
std::ostream& CheckError::stream() { … }
CheckError::~CheckError() { … }
CheckError::CheckError(LogMessage* log_message) : … { … }
NotReachedError NotReachedError::NotReached(base::NotFatalUntil fatal_milestone,
const base::Location& location) { … }
void NotReachedError::TriggerNotReached() { … }
NotReachedError::~NotReachedError() = default;
NotReachedNoreturnError::NotReachedNoreturnError(const base::Location& location)
: … { … }
NotReachedNoreturnError::~NotReachedNoreturnError() { … }
void RawCheckFailure(const char* message) { … }
}