Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2740)

Unified Diff: chrome/common/ipc_logging.cc

Issue 21039: Revert my change to get the tree green. Not sure why the tests became flaky.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/ipc_logging.h ('k') | chrome/common/ipc_message_macros.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/ipc_logging.cc
===================================================================
--- chrome/common/ipc_logging.cc (revision 9131)
+++ chrome/common/ipc_logging.cc (working copy)
@@ -41,8 +41,6 @@
consumer_(NULL),
queue_invoke_later_pending_(false),
main_thread_(MessageLoop::current()) {
- memset(log_function_mapping_, sizeof(log_function_mapping_), 0);
-
// Create an event for this browser instance that's set when logging is
// enabled, so child processes can know when logging is enabled.
int browser_pid;
@@ -90,18 +88,8 @@
RegisterWaitForEvent(!enabled_);
}
-void Logging::RegisterMessageLogger(int msg_start, LogFunction* func) {
- int msg_class = msg_start >> 12;
- if (msg_class > arraysize(log_function_mapping_)) {
- NOTREACHED();
- return;
- }
-
- log_function_mapping_[msg_class] = func;
-}
-
std::wstring Logging::GetEventName(bool enabled) {
- return current()->GetEventName(GetCurrentProcessId(), enabled);
+ return Logging::current()->GetEventName(GetCurrentProcessId(), enabled);
}
std::wstring Logging::GetEventName(int browser_pid, bool enabled) {
@@ -200,12 +188,24 @@
}
}
+// static
+LogFunction* g_log_function_mapping[16];
+void RegisterMessageLogger(int msg_start, LogFunction* func) {
+ int msg_class = msg_start >> 12;
+ if (msg_class > arraysize(g_log_function_mapping)) {
+ NOTREACHED();
+ return;
+ }
+
+ g_log_function_mapping[msg_class] = func;
+}
+
void Logging::GetMessageText(uint16 type, std::wstring* name,
const Message* message,
std::wstring* params) {
int message_class = type >> 12;
- if (current()->log_function_mapping_[message_class] != NULL) {
- current()->log_function_mapping_[message_class](type, name, message, params);
+ if (g_log_function_mapping[message_class] != NULL) {
+ g_log_function_mapping[message_class](type, name, message, params);
} else {
DLOG(INFO) << "No logger function associated with message class " <<
message_class;
« no previous file with comments | « chrome/common/ipc_logging.h ('k') | chrome/common/ipc_message_macros.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698