diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-04 03:15:58 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-04 03:15:58 +0000 |
commit | 39b7b06790a776ee2247f391b1b2e3af1a335503 (patch) | |
tree | 8813c8831c92e6f00e8e72bbeaa95693e695c683 /chrome/common/ipc_logging.h | |
parent | d718a62d075bdd6f45a128bd5d82358d73799300 (diff) | |
download | chromium_src-39b7b06790a776ee2247f391b1b2e3af1a335503.zip chromium_src-39b7b06790a776ee2247f391b1b2e3af1a335503.tar.gz chromium_src-39b7b06790a776ee2247f391b1b2e3af1a335503.tar.bz2 |
Make it easier/less work/less error-prone to create new IPC channel types (i.e. renderer/plugin).Instead of having each message file include the internal one several times with different ifdefs, move that logic to ipc_message_macros.h. Also make the message class starting IDs come from an enum to ensure we don't use a value twice. I simplified the logging code a bit so we don't need X_messages.cc files.Clean up places that we were doing manual packing/unpacking. Most of this was in the automation code. I added a few new template functions to make it convenient to read the parameters from a message, and updated the code to use them.I also removed unnecessary includes of render/plugin_messages.h from headers to speed up compiling.I moved the traits of IPC structs beside the struct definition to make it more apparent what's going on, so we avoid people modifying the struct and forgetting to update the traits.Amit: please look at chrome/test/automation/tab_proxy.ccMarc-Antoine: chrome/browser/printing/*Matt: the rest
Review URL: http://codereview.chromium.org/20015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@9123 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/ipc_logging.h')
-rw-r--r-- | chrome/common/ipc_logging.h | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/chrome/common/ipc_logging.h b/chrome/common/ipc_logging.h index 567ba84..bf49595 100644 --- a/chrome/common/ipc_logging.h +++ b/chrome/common/ipc_logging.h @@ -12,6 +12,7 @@ #include "base/lock.h" #include "base/object_watcher.h" #include "base/singleton.h" +#include "chrome/common/ipc_message_utils.h" class MessageLoop; @@ -27,7 +28,7 @@ class Logging : public base::ObjectWatcher::Delegate { // Implemented by consumers of log messages. class Consumer { public: - virtual void Log(const IPC::LogData& data) = 0; + virtual void Log(const LogData& data) = 0; }; void SetConsumer(Consumer* consumer); @@ -41,7 +42,7 @@ class Logging : public base::ObjectWatcher::Delegate { // Called by child processes to give the logger object the channel to send // logging data to the browser process. - void SetIPCSender(IPC::Message::Sender* sender); + void SetIPCSender(Message::Sender* sender); // Called in the browser process when logging data from a child process is // received. @@ -66,8 +67,14 @@ class Logging : public base::ObjectWatcher::Delegate { // ObjectWatcher::Delegate implementation void OnObjectSignaled(HANDLE object); + typedef void (LogFunction)(uint16 type, + std::wstring* name, + const Message* msg, + std::wstring* params); + void RegisterMessageLogger(int msg_start, LogFunction* func); + private: - friend struct DefaultSingletonTraits<IPC::Logging>; + friend struct DefaultSingletonTraits<Logging>; Logging(); std::wstring GetEventName(int browser_pid, bool enabled); @@ -85,10 +92,12 @@ class Logging : public base::ObjectWatcher::Delegate { std::vector<LogData> queued_logs_; bool queue_invoke_later_pending_; - IPC::Message::Sender* sender_; + Message::Sender* sender_; MessageLoop* main_thread_; Consumer* consumer_; + + LogFunction* log_function_mapping_[LastMsgIndex]; }; } // namespace IPC |