diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 23:34:16 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-08 23:34:16 +0000 |
commit | 21fa3a157739a857f1882072179f1bd3d978c368 (patch) | |
tree | 731cee107cd53590baf4f6f97e273d5378e03e7e /ipc/ipc_logging.cc | |
parent | 6df403010254c73428c83e553654ce5dafa7dc00 (diff) | |
download | chromium_src-21fa3a157739a857f1882072179f1bd3d978c368.zip chromium_src-21fa3a157739a857f1882072179f1bd3d978c368.tar.gz chromium_src-21fa3a157739a857f1882072179f1bd3d978c368.tar.bz2 |
ipc: Simplify the magic required to create IPC message headers.This gets rid of having to include the files in a magic place because of xcode dependency issues, and just makes it simpler to create new IPC message classes. It also gets rid of including the X_messages_internal.h file multiple times, which simplifies things and should make the build a little faster.
In a future change, I will remove the "internal.h" files since they're no longer needed.
Review URL: http://codereview.chromium.org/5526008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68664 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_logging.cc')
-rw-r--r-- | ipc/ipc_logging.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/ipc/ipc_logging.cc b/ipc/ipc_logging.cc index 905f097..3b26cdc 100644 --- a/ipc/ipc_logging.cc +++ b/ipc/ipc_logging.cc @@ -5,7 +5,6 @@ #include "ipc/ipc_logging.h" #ifdef IPC_MESSAGE_LOG_ENABLED -// This will cause render_messages.h etc to define ViewMsgLog and friends. #define IPC_MESSAGE_MACROS_LOG_ENABLED #endif @@ -13,6 +12,7 @@ #include "base/logging.h" #include "base/message_loop.h" #include "base/process_util.h" +#include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/thread.h" #include "base/time.h" @@ -38,7 +38,7 @@ const int kLogSendDelayMs = 100; // We use a pointer to the function table to avoid any linker dependencies on // all the traits used as IPC message parameters. -Logging::LogFunction *Logging::log_function_mapping_; +LogFunctionMap* Logging::log_function_map_; Logging::Logging() : enabled_(false), @@ -70,10 +70,6 @@ Logging* Logging::current() { return Singleton<Logging>::get(); } -void Logging::SetLoggerFunctions(LogFunction *functions) { - log_function_mapping_ = functions; -} - void Logging::SetConsumer(Consumer* consumer) { consumer_ = consumer; } @@ -164,16 +160,20 @@ void Logging::OnPostDispatchMessage(const Message& message, void Logging::GetMessageText(uint32 type, std::string* name, const Message* message, std::string* params) { - if (!log_function_mapping_) + if (!log_function_map_) return; - int message_class = type >> 16; - if (log_function_mapping_[message_class] != NULL) { - log_function_mapping_[message_class](type, name, message, params); - } else { - DVLOG(1) << "No logger function associated with message class " - << message_class; + LogFunctionMap::iterator it = log_function_map_->find(type); + if (it == log_function_map_->end()) { + if (name) { + *name = "[UNKNOWN MSG "; + *name += base::IntToString(type); + *name += " ]"; + } + return; } + + (*it->second)(name, message, params); } void Logging::Log(const LogData& data) { |