tedvessenes@gmail.com | 30dbbaa | 2012-01-13 09:11:01 +0900 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "ipc/ipc_logging.h" |
| 6 | |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 7 | #ifdef IPC_MESSAGE_LOG_ENABLED |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 8 | #define IPC_MESSAGE_MACROS_LOG_ENABLED |
| 9 | #endif |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 10 | |
jhawkins@chromium.org | 9827bd1 | 2011-11-13 06:16:41 +0900 | [diff] [blame] | 11 | #include "base/bind.h" |
| 12 | #include "base/bind_helpers.h" |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 13 | #include "base/command_line.h" |
ajwong@chromium.org | 8e2e300 | 2011-09-22 03:05:41 +0900 | [diff] [blame] | 14 | #include "base/location.h" |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 15 | #include "base/logging.h" |
skyostil | e468e66 | 2015-05-12 20:29:21 +0900 | [diff] [blame] | 16 | #include "base/single_thread_task_runner.h" |
avi@chromium.org | e7eaf39 | 2013-06-11 15:32:18 +0900 | [diff] [blame] | 17 | #include "base/strings/string_number_conversions.h" |
| 18 | #include "base/strings/string_util.h" |
skyostil | e468e66 | 2015-05-12 20:29:21 +0900 | [diff] [blame] | 19 | #include "base/thread_task_runner_handle.h" |
brettw@chromium.org | 5b5f5e0 | 2011-01-01 10:01:06 +0900 | [diff] [blame] | 20 | #include "base/threading/thread.h" |
avi@chromium.org | 78a7e7b | 2013-06-29 00:20:02 +0900 | [diff] [blame] | 21 | #include "base/time/time.h" |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 22 | #include "ipc/ipc_message_utils.h" |
viettrungluu@chromium.org | 5254ca0 | 2012-12-15 07:56:28 +0900 | [diff] [blame] | 23 | #include "ipc/ipc_sender.h" |
avi@chromium.org | e7eaf39 | 2013-06-11 15:32:18 +0900 | [diff] [blame] | 24 | #include "ipc/ipc_switches.h" |
| 25 | #include "ipc/ipc_sync_message.h" |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 26 | |
| 27 | #if defined(OS_POSIX) |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 28 | #include <unistd.h> |
| 29 | #endif |
| 30 | |
| 31 | #ifdef IPC_MESSAGE_LOG_ENABLED |
| 32 | |
| 33 | using base::Time; |
| 34 | |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 35 | namespace IPC { |
| 36 | |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 37 | const int kLogSendDelayMs = 100; |
| 38 | |
| 39 | // We use a pointer to the function table to avoid any linker dependencies on |
| 40 | // all the traits used as IPC message parameters. |
jam@chromium.org | 86a8de1 | 2010-12-09 08:34:16 +0900 | [diff] [blame] | 41 | LogFunctionMap* Logging::log_function_map_; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 42 | |
| 43 | Logging::Logging() |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 44 | : enabled_(false), |
| 45 | enabled_on_stderr_(false), |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 46 | enabled_color_(false), |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 47 | queue_invoke_later_pending_(false), |
| 48 | sender_(NULL), |
xhwang@chromium.org | 0b2c2a5 | 2013-05-01 05:55:03 +0900 | [diff] [blame] | 49 | main_thread_(base::MessageLoop::current()), |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 50 | consumer_(NULL) { |
thomasvl@google.com | 9a24207 | 2010-07-23 23:18:59 +0900 | [diff] [blame] | 51 | #if defined(OS_WIN) |
| 52 | // getenv triggers an unsafe warning. Simply check how big of a buffer |
| 53 | // would be needed to fetch the value to see if the enviornment variable is |
| 54 | // set. |
| 55 | size_t requiredSize = 0; |
| 56 | getenv_s(&requiredSize, NULL, 0, "CHROME_IPC_LOGGING"); |
| 57 | bool logging_env_var_set = (requiredSize != 0); |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 58 | if (requiredSize <= 6) { |
| 59 | char buffer[6]; |
| 60 | getenv_s(&requiredSize, buffer, sizeof(buffer), "CHROME_IPC_LOGGING"); |
| 61 | if (requiredSize && !strncmp("color", buffer, 6)) |
| 62 | enabled_color_ = true; |
| 63 | } |
thomasvl@google.com | 9a24207 | 2010-07-23 23:18:59 +0900 | [diff] [blame] | 64 | #else // !defined(OS_WIN) |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 65 | const char* ipc_logging = getenv("CHROME_IPC_LOGGING"); |
| 66 | bool logging_env_var_set = (ipc_logging != NULL); |
| 67 | if (ipc_logging && !strcmp(ipc_logging, "color")) |
| 68 | enabled_color_ = true; |
thomasvl@google.com | 9a24207 | 2010-07-23 23:18:59 +0900 | [diff] [blame] | 69 | #endif //defined(OS_WIN) |
| 70 | if (logging_env_var_set) { |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 71 | enabled_ = true; |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 72 | enabled_on_stderr_ = true; |
| 73 | } |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 74 | } |
| 75 | |
| 76 | Logging::~Logging() { |
| 77 | } |
| 78 | |
satish@chromium.org | aa87060 | 2010-12-13 17:18:55 +0900 | [diff] [blame] | 79 | Logging* Logging::GetInstance() { |
olli.raula | 5ba9489 | 2015-09-10 20:14:22 +0900 | [diff] [blame] | 80 | return base::Singleton<Logging>::get(); |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 81 | } |
| 82 | |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 83 | void Logging::SetConsumer(Consumer* consumer) { |
| 84 | consumer_ = consumer; |
| 85 | } |
| 86 | |
| 87 | void Logging::Enable() { |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 88 | enabled_ = true; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 89 | } |
| 90 | |
| 91 | void Logging::Disable() { |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 92 | enabled_ = false; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 93 | } |
| 94 | |
| 95 | void Logging::OnSendLogs() { |
| 96 | queue_invoke_later_pending_ = false; |
| 97 | if (!sender_) |
| 98 | return; |
| 99 | |
bbudge@chromium.org | ab4c6bc | 2013-11-05 07:28:12 +0900 | [diff] [blame] | 100 | Message* msg = new Message( |
| 101 | MSG_ROUTING_CONTROL, IPC_LOGGING_ID, Message::PRIORITY_NORMAL); |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 102 | WriteParam(msg, queued_logs_); |
| 103 | queued_logs_.clear(); |
| 104 | sender_->Send(msg); |
| 105 | } |
| 106 | |
brettw@chromium.org | f947ed0 | 2012-06-12 07:35:26 +0900 | [diff] [blame] | 107 | void Logging::SetIPCSender(IPC::Sender* sender) { |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 108 | sender_ = sender; |
| 109 | } |
| 110 | |
| 111 | void Logging::OnReceivedLoggingMessage(const Message& message) { |
| 112 | std::vector<LogData> data; |
brettw | f314620 | 2015-06-03 13:29:25 +0900 | [diff] [blame] | 113 | base::PickleIterator iter(message); |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 114 | if (!ReadParam(&message, &iter, &data)) |
| 115 | return; |
| 116 | |
| 117 | for (size_t i = 0; i < data.size(); ++i) { |
| 118 | Log(data[i]); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | void Logging::OnSendMessage(Message* message, const std::string& channel_id) { |
| 123 | if (!Enabled()) |
| 124 | return; |
| 125 | |
| 126 | if (message->is_reply()) { |
| 127 | LogData* data = message->sync_log_data(); |
| 128 | if (!data) |
| 129 | return; |
| 130 | |
| 131 | // This is actually the delayed reply to a sync message. Create a string |
| 132 | // of the output parameters, add it to the LogData that was earlier stashed |
| 133 | // with the reply, and log the result. |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 134 | GenerateLogData("", *message, data, true); |
samuel.xu@intel.com | 434073f | 2012-07-03 11:24:32 +0900 | [diff] [blame] | 135 | data->channel = channel_id; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 136 | Log(*data); |
| 137 | delete data; |
| 138 | message->set_sync_log_data(NULL); |
| 139 | } else { |
| 140 | // If the time has already been set (i.e. by ChannelProxy), keep that time |
| 141 | // instead as it's more accurate. |
| 142 | if (!message->sent_time()) |
| 143 | message->set_sent_time(Time::Now().ToInternalValue()); |
| 144 | } |
| 145 | } |
| 146 | |
| 147 | void Logging::OnPreDispatchMessage(const Message& message) { |
| 148 | message.set_received_time(Time::Now().ToInternalValue()); |
| 149 | } |
| 150 | |
| 151 | void Logging::OnPostDispatchMessage(const Message& message, |
| 152 | const std::string& channel_id) { |
| 153 | if (!Enabled() || |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 154 | !message.sent_time() || |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 155 | !message.received_time() || |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 156 | message.dont_log()) |
| 157 | return; |
| 158 | |
| 159 | LogData data; |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 160 | GenerateLogData(channel_id, message, &data, true); |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 161 | |
xhwang@chromium.org | 0b2c2a5 | 2013-05-01 05:55:03 +0900 | [diff] [blame] | 162 | if (base::MessageLoop::current() == main_thread_) { |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 163 | Log(data); |
| 164 | } else { |
skyostil | e468e66 | 2015-05-12 20:29:21 +0900 | [diff] [blame] | 165 | main_thread_->task_runner()->PostTask( |
jhawkins@chromium.org | 9827bd1 | 2011-11-13 06:16:41 +0900 | [diff] [blame] | 166 | FROM_HERE, base::Bind(&Logging::Log, base::Unretained(this), data)); |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 167 | } |
| 168 | } |
| 169 | |
tfarina | 1cbfa08 | 2015-09-05 03:47:57 +0900 | [diff] [blame] | 170 | void Logging::GetMessageText(uint32_t type, std::string* name, |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 171 | const Message* message, |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 172 | std::string* params) { |
jam@chromium.org | 86a8de1 | 2010-12-09 08:34:16 +0900 | [diff] [blame] | 173 | if (!log_function_map_) |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 174 | return; |
| 175 | |
jam@chromium.org | 86a8de1 | 2010-12-09 08:34:16 +0900 | [diff] [blame] | 176 | LogFunctionMap::iterator it = log_function_map_->find(type); |
| 177 | if (it == log_function_map_->end()) { |
| 178 | if (name) { |
| 179 | *name = "[UNKNOWN MSG "; |
| 180 | *name += base::IntToString(type); |
| 181 | *name += " ]"; |
| 182 | } |
| 183 | return; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 184 | } |
jam@chromium.org | 86a8de1 | 2010-12-09 08:34:16 +0900 | [diff] [blame] | 185 | |
| 186 | (*it->second)(name, message, params); |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 187 | } |
| 188 | |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 189 | const char* Logging::ANSIEscape(ANSIColor color) { |
| 190 | if (!enabled_color_) |
| 191 | return ""; |
| 192 | switch (color) { |
| 193 | case ANSI_COLOR_RESET: |
| 194 | return "\033[m"; |
| 195 | case ANSI_COLOR_BLACK: |
| 196 | return "\033[0;30m"; |
| 197 | case ANSI_COLOR_RED: |
| 198 | return "\033[0;31m"; |
| 199 | case ANSI_COLOR_GREEN: |
| 200 | return "\033[0;32m"; |
| 201 | case ANSI_COLOR_YELLOW: |
| 202 | return "\033[0;33m"; |
| 203 | case ANSI_COLOR_BLUE: |
| 204 | return "\033[0;34m"; |
| 205 | case ANSI_COLOR_MAGENTA: |
| 206 | return "\033[0;35m"; |
| 207 | case ANSI_COLOR_CYAN: |
| 208 | return "\033[0;36m"; |
| 209 | case ANSI_COLOR_WHITE: |
| 210 | return "\033[0;37m"; |
| 211 | } |
| 212 | return ""; |
| 213 | } |
| 214 | |
| 215 | Logging::ANSIColor Logging::DelayColor(double delay) { |
| 216 | if (delay < 0.1) |
| 217 | return ANSI_COLOR_GREEN; |
| 218 | if (delay < 0.25) |
| 219 | return ANSI_COLOR_BLACK; |
| 220 | if (delay < 0.5) |
| 221 | return ANSI_COLOR_YELLOW; |
| 222 | return ANSI_COLOR_RED; |
| 223 | } |
| 224 | |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 225 | void Logging::Log(const LogData& data) { |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 226 | if (consumer_) { |
| 227 | // We're in the browser process. |
| 228 | consumer_->Log(data); |
| 229 | } else { |
| 230 | // We're in the renderer or plugin processes. |
| 231 | if (sender_) { |
| 232 | queued_logs_.push_back(data); |
| 233 | if (!queue_invoke_later_pending_) { |
| 234 | queue_invoke_later_pending_ = true; |
skyostil | e468e66 | 2015-05-12 20:29:21 +0900 | [diff] [blame] | 235 | base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 236 | FROM_HERE, base::Bind(&Logging::OnSendLogs, base::Unretained(this)), |
tedvessenes@gmail.com | 30dbbaa | 2012-01-13 09:11:01 +0900 | [diff] [blame] | 237 | base::TimeDelta::FromMilliseconds(kLogSendDelayMs)); |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 238 | } |
| 239 | } |
| 240 | } |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 241 | if (enabled_on_stderr_) { |
| 242 | std::string message_name; |
| 243 | if (data.message_name.empty()) { |
groby@chromium.org | 6b4dc5e | 2013-03-19 07:33:04 +0900 | [diff] [blame] | 244 | message_name = base::StringPrintf("[unknown type %d]", data.type); |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 245 | } else { |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 246 | message_name = data.message_name; |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 247 | } |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 248 | double receive_delay = |
| 249 | (Time::FromInternalValue(data.receive) - |
| 250 | Time::FromInternalValue(data.sent)).InSecondsF(); |
| 251 | double dispatch_delay = |
| 252 | (Time::FromInternalValue(data.dispatch) - |
| 253 | Time::FromInternalValue(data.sent)).InSecondsF(); |
| 254 | fprintf(stderr, |
| 255 | "ipc %s %d %s %s%s %s%s\n %18.5f %s%18.5f %s%18.5f%s\n", |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 256 | data.channel.c_str(), |
| 257 | data.routing_id, |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 258 | data.flags.c_str(), |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 259 | ANSIEscape(sender_ ? ANSI_COLOR_BLUE : ANSI_COLOR_CYAN), |
jrg@chromium.org | f2b21be | 2009-09-29 06:08:04 +0900 | [diff] [blame] | 260 | message_name.c_str(), |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 261 | ANSIEscape(ANSI_COLOR_RESET), |
| 262 | data.params.c_str(), |
| 263 | Time::FromInternalValue(data.sent).ToDoubleT(), |
| 264 | ANSIEscape(DelayColor(receive_delay)), |
| 265 | Time::FromInternalValue(data.receive).ToDoubleT(), |
| 266 | ANSIEscape(DelayColor(dispatch_delay)), |
| 267 | Time::FromInternalValue(data.dispatch).ToDoubleT(), |
| 268 | ANSIEscape(ANSI_COLOR_RESET) |
| 269 | ); |
evan@chromium.org | 4bdd5df | 2009-07-29 02:04:37 +0900 | [diff] [blame] | 270 | } |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 271 | } |
| 272 | |
| 273 | void GenerateLogData(const std::string& channel, const Message& message, |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 274 | LogData* data, bool get_params) { |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 275 | if (message.is_reply()) { |
| 276 | // "data" should already be filled in. |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 277 | std::string params; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 278 | Logging::GetMessageText(data->type, NULL, &message, ¶ms); |
| 279 | |
| 280 | if (!data->params.empty() && !params.empty()) |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 281 | data->params += ", "; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 282 | |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 283 | data->flags += " DR"; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 284 | |
| 285 | data->params += params; |
| 286 | } else { |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 287 | std::string flags; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 288 | if (message.is_sync()) |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 289 | flags = "S"; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 290 | |
| 291 | if (message.is_reply()) |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 292 | flags += "R"; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 293 | |
| 294 | if (message.is_reply_error()) |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 295 | flags += "E"; |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 296 | |
erg@google.com | 8aca727 | 2010-08-19 03:33:57 +0900 | [diff] [blame] | 297 | std::string params, message_name; |
scottbyer@chromium.org | f0cf0b7 | 2011-10-21 04:34:43 +0900 | [diff] [blame] | 298 | Logging::GetMessageText(message.type(), &message_name, &message, |
| 299 | get_params ? ¶ms : NULL); |
agl@chromium.org | 1c6dcf2 | 2009-07-23 08:57:21 +0900 | [diff] [blame] | 300 | |
| 301 | data->channel = channel; |
| 302 | data->routing_id = message.routing_id(); |
| 303 | data->type = message.type(); |
| 304 | data->flags = flags; |
| 305 | data->sent = message.sent_time(); |
| 306 | data->receive = message.received_time(); |
| 307 | data->dispatch = Time::Now().ToInternalValue(); |
| 308 | data->params = params; |
| 309 | data->message_name = message_name; |
| 310 | } |
| 311 | } |
| 312 | |
| 313 | } |
| 314 | |
| 315 | #endif // IPC_MESSAGE_LOG_ENABLED |