OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
811 LogFunctionMap g_log_function_mapping; | 811 LogFunctionMap g_log_function_mapping; |
812 | 812 |
813 #endif // IPC_LOG_TABLE_CREATED | 813 #endif // IPC_LOG_TABLE_CREATED |
814 | 814 |
815 // "Log table" inclusion produces extra logging registration code. | 815 // "Log table" inclusion produces extra logging registration code. |
816 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ | 816 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ |
817 in_cnt, out_cnt, in_list, out_list) \ | 817 in_cnt, out_cnt, in_list, out_list) \ |
818 class LoggerRegisterHelper##msg_class { \ | 818 class LoggerRegisterHelper##msg_class { \ |
819 public: \ | 819 public: \ |
820 LoggerRegisterHelper##msg_class() { \ | 820 LoggerRegisterHelper##msg_class() { \ |
821 g_log_function_mapping[msg_class::ID] = msg_class::Log; \ | 821 const uint32 msg_id = static_cast<uint32>(msg_class::ID); \ |
| 822 g_log_function_mapping[msg_id] = msg_class::Log; \ |
822 } \ | 823 } \ |
823 }; \ | 824 }; \ |
824 LoggerRegisterHelper##msg_class g_LoggerRegisterHelper##msg_class; | 825 LoggerRegisterHelper##msg_class g_LoggerRegisterHelper##msg_class; |
825 | 826 |
826 #else | 827 #else |
827 | 828 |
828 // Normal inclusion produces nothing extra. | 829 // Normal inclusion produces nothing extra. |
829 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ | 830 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ |
830 in_cnt, out_cnt, in_list, out_list) | 831 in_cnt, out_cnt, in_list, out_list) |
831 | 832 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 // This corresponds to an enum value from IPCMessageStart. | 992 // This corresponds to an enum value from IPCMessageStart. |
992 #define IPC_MESSAGE_CLASS(message) \ | 993 #define IPC_MESSAGE_CLASS(message) \ |
993 IPC_MESSAGE_ID_CLASS(message.type()) | 994 IPC_MESSAGE_ID_CLASS(message.type()) |
994 | 995 |
995 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 996 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
996 | 997 |
997 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 998 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
998 // XXX_messages.h files need not do so themselves. This makes the | 999 // XXX_messages.h files need not do so themselves. This makes the |
999 // XXX_messages.h files easier to write. | 1000 // XXX_messages.h files easier to write. |
1000 #undef IPC_MESSAGE_START | 1001 #undef IPC_MESSAGE_START |
OLD | NEW |