| 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 // Defining IPC Messages | 5 // Defining IPC Messages |
| 6 // | 6 // |
| 7 // Your IPC messages will be defined by macros inside of an XXX_messages.h | 7 // Your IPC messages will be defined by macros inside of an XXX_messages.h |
| 8 // header file. Most of the time, the system can automatically generate all | 8 // header file. Most of the time, the system can automatically generate all |
| 9 // of messaging mechanism from these definitions, but sometimes some manual | 9 // of messaging mechanism from these definitions, but sometimes some manual |
| 10 // coding is required. In these cases, you will also have an XXX_messages.cc | 10 // coding is required. In these cases, you will also have an XXX_messages.cc |
| (...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 793 AddOutputParamsToLog(msg, l); \ | 793 AddOutputParamsToLog(msg, l); \ |
| 794 } else { \ | 794 } else { \ |
| 795 TupleTypes<Schema::ReplyParam>::ValueTuple p; \ | 795 TupleTypes<Schema::ReplyParam>::ValueTuple p; \ |
| 796 if (Schema::ReadReplyParam(msg, &p)) \ | 796 if (Schema::ReadReplyParam(msg, &p)) \ |
| 797 IPC::LogParam(p, l); \ | 797 IPC::LogParam(p, l); \ |
| 798 } \ | 798 } \ |
| 799 } | 799 } |
| 800 | 800 |
| 801 #elif defined(IPC_MESSAGE_MACROS_LOG_ENABLED) | 801 #elif defined(IPC_MESSAGE_MACROS_LOG_ENABLED) |
| 802 | 802 |
| 803 #ifndef IPC_LOG_TABLE_CREATED | 803 #ifndef IPC_LOG_TABLE_ADD_ENTRY |
| 804 #define IPC_LOG_TABLE_CREATED | 804 #error You need to define IPC_LOG_TABLE_ADD_ENTRY(msg_id, logger) |
| 805 | 805 #endif |
| 806 #include "base/hash_tables.h" | |
| 807 | |
| 808 typedef void (*LogFunction)(std::string* name, | |
| 809 const IPC::Message* msg, | |
| 810 std::string* params); | |
| 811 | |
| 812 typedef base::hash_map<uint32, LogFunction > LogFunctionMap; | |
| 813 LogFunctionMap g_log_function_mapping; | |
| 814 | |
| 815 #endif // IPC_LOG_TABLE_CREATED | |
| 816 | 806 |
| 817 // "Log table" inclusion produces extra logging registration code. | 807 // "Log table" inclusion produces extra logging registration code. |
| 818 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ | 808 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ |
| 819 in_cnt, out_cnt, in_list, out_list) \ | 809 in_cnt, out_cnt, in_list, out_list) \ |
| 820 class LoggerRegisterHelper##msg_class { \ | 810 class LoggerRegisterHelper##msg_class { \ |
| 821 public: \ | 811 public: \ |
| 822 LoggerRegisterHelper##msg_class() { \ | 812 LoggerRegisterHelper##msg_class() { \ |
| 823 const uint32 msg_id = static_cast<uint32>(msg_class::ID); \ | 813 const uint32 msg_id = static_cast<uint32>(msg_class::ID); \ |
| 824 g_log_function_mapping[msg_id] = msg_class::Log; \ | 814 IPC_LOG_TABLE_ADD_ENTRY(msg_id, msg_class::Log); \ |
| 825 } \ | 815 } \ |
| 826 }; \ | 816 }; \ |
| 827 LoggerRegisterHelper##msg_class g_LoggerRegisterHelper##msg_class; | 817 LoggerRegisterHelper##msg_class g_LoggerRegisterHelper##msg_class; |
| 828 | 818 |
| 829 #else | 819 #else |
| 830 | 820 |
| 831 // Normal inclusion produces nothing extra. | 821 // Normal inclusion produces nothing extra. |
| 832 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ | 822 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ |
| 833 in_cnt, out_cnt, in_list, out_list) | 823 in_cnt, out_cnt, in_list, out_list) |
| 834 | 824 |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1004 // This corresponds to an enum value from IPCMessageStart. | 994 // This corresponds to an enum value from IPCMessageStart. |
| 1005 #define IPC_MESSAGE_CLASS(message) \ | 995 #define IPC_MESSAGE_CLASS(message) \ |
| 1006 IPC_MESSAGE_ID_CLASS(message.type()) | 996 IPC_MESSAGE_ID_CLASS(message.type()) |
| 1007 | 997 |
| 1008 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 998 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
| 1009 | 999 |
| 1010 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 1000 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
| 1011 // XXX_messages.h files need not do so themselves. This makes the | 1001 // XXX_messages.h files need not do so themselves. This makes the |
| 1012 // XXX_messages.h files easier to write. | 1002 // XXX_messages.h files easier to write. |
| 1013 #undef IPC_MESSAGE_START | 1003 #undef IPC_MESSAGE_START |
| OLD | NEW |