OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_message.h" // For IPC_MESSAGE_LOG_ENABLED. | 5 #include "ipc/ipc_message.h" // For IPC_MESSAGE_LOG_ENABLED. |
6 | 6 |
7 #if defined(IPC_MESSAGE_LOG_ENABLED) | 7 #if defined(IPC_MESSAGE_LOG_ENABLED) |
8 #define IPC_MESSAGE_MACROS_LOG_ENABLED | 8 #define IPC_MESSAGE_MACROS_LOG_ENABLED |
9 #include "content/public/common/content_ipc_logging.h" | 9 #include "content/public/common/content_ipc_logging.h" |
10 #define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) \ | 10 #define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) \ |
11 content::RegisterIPCLogger(msg_id, logger) | 11 content::RegisterIPCLogger(msg_id, logger) |
12 #include "content/common/all_messages.h" | 12 #include "content/common/all_messages.h" |
13 #endif | 13 #endif |
14 | 14 |
15 #if defined(IPC_MESSAGE_LOG_ENABLED) | 15 #if defined(IPC_MESSAGE_LOG_ENABLED) |
16 | 16 |
17 #include "base/hash_tables.h" | 17 #include "base/containers/hash_tables.h" |
18 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 | 21 |
22 namespace { | 22 namespace { |
23 | 23 |
24 base::LazyInstance<base::hash_map<uint32, LogFunction> >::Leaky | 24 base::LazyInstance<base::hash_map<uint32, LogFunction> >::Leaky |
25 g_log_function_mapping = LAZY_INSTANCE_INITIALIZER; | 25 g_log_function_mapping = LAZY_INSTANCE_INITIALIZER; |
26 | 26 |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 void RegisterIPCLogger(uint32 msg_id, LogFunction logger) { | 29 void RegisterIPCLogger(uint32 msg_id, LogFunction logger) { |
30 if (g_log_function_mapping == NULL) | 30 if (g_log_function_mapping == NULL) |
31 IPC::Logging::set_log_function_map(g_log_function_mapping.Pointer()); | 31 IPC::Logging::set_log_function_map(g_log_function_mapping.Pointer()); |
32 g_log_function_mapping.Get()[msg_id] = logger; | 32 g_log_function_mapping.Get()[msg_id] = logger; |
33 } | 33 } |
34 | 34 |
35 } // content | 35 } // content |
36 | 36 |
37 #endif | 37 #endif |
OLD | NEW |