OLD | NEW |
---|---|
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ipc/ipc_logging.h" | 5 #include "ipc/ipc_logging.h" |
6 | 6 |
7 #ifdef IPC_MESSAGE_LOG_ENABLED | 7 #ifdef IPC_MESSAGE_LOG_ENABLED |
8 // This will cause render_messages.h etc to define ViewMsgLog and friends. | 8 // This will cause render_messages.h etc to define ViewMsgLog and friends. |
9 #define IPC_MESSAGE_MACROS_LOG_ENABLED | 9 #define IPC_MESSAGE_MACROS_LOG_ENABLED |
10 #endif | 10 #endif |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 // all the traits used as IPC message parameters. | 42 // all the traits used as IPC message parameters. |
43 Logging::LogFunction *Logging::log_function_mapping_; | 43 Logging::LogFunction *Logging::log_function_mapping_; |
44 | 44 |
45 Logging::Logging() | 45 Logging::Logging() |
46 : enabled_(false), | 46 : enabled_(false), |
47 enabled_on_stderr_(false), | 47 enabled_on_stderr_(false), |
48 queue_invoke_later_pending_(false), | 48 queue_invoke_later_pending_(false), |
49 sender_(NULL), | 49 sender_(NULL), |
50 main_thread_(MessageLoop::current()), | 50 main_thread_(MessageLoop::current()), |
51 consumer_(NULL) { | 51 consumer_(NULL) { |
52 if (getenv("CHROME_IPC_LOGGING")) { | 52 #if defined(OS_WIN) |
53 // getenv triggers an unsafe warning. Simply check how big of a buffer | |
54 // would be needed to fetch the value to see if the enviornment variable is | |
55 // set. | |
56 size_t requiredSize = 0; | |
57 getenv_s(&requiredSize, NULL, 0, "CHROME_IPC_LOGGING"); | |
58 bool logging_env_var_set = (requiredSize != 0); | |
Mark Mentovai
2010/07/23 15:07:28
I don’t know if requiredSize will be 0 (or somethi
TVL
2010/07/23 15:26:55
From what msdn says, if you fetch the value, it wi
| |
59 #else // !defined(OS_WIN) | |
60 bool logging_env_var_set = (getenv("CHROME_IPC_LOGGING") != NULL); | |
Mark Mentovai
2010/07/23 15:07:28
You could have a const char* just outside the #if
| |
61 #endif //defined(OS_WIN) | |
62 if (logging_env_var_set) { | |
53 enabled_ = true; | 63 enabled_ = true; |
54 enabled_on_stderr_ = true; | 64 enabled_on_stderr_ = true; |
55 } | 65 } |
56 } | 66 } |
57 | 67 |
58 Logging::~Logging() { | 68 Logging::~Logging() { |
59 } | 69 } |
60 | 70 |
61 Logging* Logging::current() { | 71 Logging* Logging::current() { |
62 return Singleton<Logging>::get(); | 72 return Singleton<Logging>::get(); |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
234 data->receive = message.received_time(); | 244 data->receive = message.received_time(); |
235 data->dispatch = Time::Now().ToInternalValue(); | 245 data->dispatch = Time::Now().ToInternalValue(); |
236 data->params = params; | 246 data->params = params; |
237 data->message_name = message_name; | 247 data->message_name = message_name; |
238 } | 248 } |
239 } | 249 } |
240 | 250 |
241 } | 251 } |
242 | 252 |
243 #endif // IPC_MESSAGE_LOG_ENABLED | 253 #endif // IPC_MESSAGE_LOG_ENABLED |
OLD | NEW |