diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-05 23:17:24 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-05 23:17:24 +0000 |
commit | f858847015d6d50b52a542491ff52fee52ff9997 (patch) | |
tree | 041917d9c6245b67be8ae3237ee665faa95acf0c /base | |
parent | 9fe90b765b5500b3bc0ce5af44b9edf420fef97c (diff) | |
download | chromium_src-f858847015d6d50b52a542491ff52fee52ff9997.zip chromium_src-f858847015d6d50b52a542491ff52fee52ff9997.tar.gz chromium_src-f858847015d6d50b52a542491ff52fee52ff9997.tar.bz2 |
revert 9391
Review URL: http://codereview.chromium.org/9607
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4837 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/logging.cc | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/base/logging.cc b/base/logging.cc index 98b2619..3a6f928 100644 --- a/base/logging.cc +++ b/base/logging.cc @@ -36,13 +36,10 @@ typedef pthread_mutex_t* MutexHandle; #include "base/command_line.h" #include "base/debug_util.h" #include "base/lock_impl.h" -#include "base/platform_thread.h" -#include "base/process_util.h" #include "base/string_piece.h" #include "base/string_util.h" #include "base/sys_string_conversions.h" -#include "base/time.h" - + namespace logging { bool g_enable_dcheck = false; @@ -109,6 +106,36 @@ pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER; // Helper functions to wrap platform differences. +int32 CurrentProcessId() { +#if defined(OS_WIN) + return GetCurrentProcessId(); +#elif defined(OS_POSIX) + return getpid(); +#endif +} + +int32 CurrentThreadId() { +#if defined(OS_WIN) + return GetCurrentThreadId(); +#elif defined(OS_MACOSX) + return mach_thread_self(); +#else + NOTIMPLEMENTED(); + return 0; +#endif +} + +uint64 TickCount() { +#if defined(OS_WIN) + return GetTickCount(); +#elif defined(OS_MACOSX) + return mach_absolute_time(); +#else + NOTIMPLEMENTED(); + return 0; +#endif +} + void CloseFile(FileHandle log) { #if defined(OS_WIN) CloseHandle(log); @@ -335,9 +362,9 @@ void LogMessage::Init(const char* file, int line) { stream_ << '['; if (log_process_id) - stream_ << process_util::GetCurrentProcId() << ':'; + stream_ << CurrentProcessId() << ':'; if (log_thread_id) - stream_ << PlatformThread::CurrentId() << ':'; + stream_ << CurrentThreadId() << ':'; if (log_timestamp) { time_t t = time(NULL); #if _MSC_VER >= 1400 @@ -357,7 +384,7 @@ void LogMessage::Init(const char* file, int line) { << ':'; } if (log_tickcount) - stream_ << base::TimeTicks::Now().ToInternalValue() << ':'; + stream_ << TickCount() << ':'; stream_ << log_severity_names[severity_] << ":" << file << "(" << line << ")] "; message_start_ = stream_.tellp(); |