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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 in_cnt, out_cnt, in_list, out_list) \ | 593 in_cnt, out_cnt, in_list, out_list) \ |
594 IPC_##sync##_##kind##_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 594 IPC_##sync##_##kind##_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
595 IPC_MESSAGE_EXTRA(sync, kind, msg_class, in_cnt, out_cnt, in_list, out_list) | 595 IPC_MESSAGE_EXTRA(sync, kind, msg_class, in_cnt, out_cnt, in_list, out_list) |
596 | 596 |
597 #define IPC_EMPTY_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 597 #define IPC_EMPTY_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
598 class msg_class : public IPC::Message { \ | 598 class msg_class : public IPC::Message { \ |
599 public: \ | 599 public: \ |
600 typedef IPC::Message Schema; \ | 600 typedef IPC::Message Schema; \ |
601 enum { ID = IPC_MESSAGE_ID() }; \ | 601 enum { ID = IPC_MESSAGE_ID() }; \ |
602 msg_class() : IPC::Message(MSG_ROUTING_CONTROL, ID, PRIORITY_NORMAL) {} \ | 602 msg_class() : IPC::Message(MSG_ROUTING_CONTROL, ID, PRIORITY_NORMAL) {} \ |
| 603 static void Log(std::string* name, const Message* msg, std::string* l); \ |
603 }; | 604 }; |
604 | 605 |
605 #define IPC_EMPTY_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 606 #define IPC_EMPTY_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
606 class msg_class : public IPC::Message { \ | 607 class msg_class : public IPC::Message { \ |
607 public: \ | 608 public: \ |
608 typedef IPC::Message Schema; \ | 609 typedef IPC::Message Schema; \ |
609 enum { ID = IPC_MESSAGE_ID() }; \ | 610 enum { ID = IPC_MESSAGE_ID() }; \ |
610 msg_class(int32 routing_id) \ | 611 msg_class(int32 routing_id) \ |
611 : IPC::Message(routing_id, ID, PRIORITY_NORMAL) {} \ | 612 : IPC::Message(routing_id, ID, PRIORITY_NORMAL) {} \ |
| 613 static void Log(std::string* name, const Message* msg, std::string* l); \ |
612 }; | 614 }; |
613 | 615 |
614 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 616 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
615 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ | 617 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ |
616 public: \ | 618 public: \ |
617 typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ | 619 typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ |
618 typedef Schema::Param Param; \ | 620 typedef Schema::Param Param; \ |
619 enum { ID = IPC_MESSAGE_ID() }; \ | 621 enum { ID = IPC_MESSAGE_ID() }; \ |
620 msg_class(IPC_TYPE_IN_##in_cnt in_list); \ | 622 msg_class(IPC_TYPE_IN_##in_cnt in_list); \ |
621 virtual ~msg_class(); \ | 623 virtual ~msg_class(); \ |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 } \ | 748 } \ |
747 msg_class::~msg_class() {} \ | 749 msg_class::~msg_class() {} \ |
748 bool msg_class::ReadSendParam(const Message* msg, Schema::SendParam* p) { \ | 750 bool msg_class::ReadSendParam(const Message* msg, Schema::SendParam* p) { \ |
749 return Schema::ReadSendParam(msg, p); \ | 751 return Schema::ReadSendParam(msg, p); \ |
750 } \ | 752 } \ |
751 bool msg_class::ReadReplyParam(const Message* msg, \ | 753 bool msg_class::ReadReplyParam(const Message* msg, \ |
752 TupleTypes<ReplyParam>::ValueTuple* p) { \ | 754 TupleTypes<ReplyParam>::ValueTuple* p) { \ |
753 return Schema::ReadReplyParam(msg, p); \ | 755 return Schema::ReadReplyParam(msg, p); \ |
754 } | 756 } |
755 | 757 |
756 #define IPC_EMPTY_MESSAGE_LOG(msg_class) | 758 #define IPC_EMPTY_MESSAGE_LOG(msg_class) \ |
| 759 void msg_class::Log(std::string* name, \ |
| 760 const Message* msg, \ |
| 761 std::string* l) { \ |
| 762 if (name) \ |
| 763 *name = #msg_class; \ |
| 764 } |
757 | 765 |
758 #define IPC_ASYNC_MESSAGE_LOG(msg_class) \ | 766 #define IPC_ASYNC_MESSAGE_LOG(msg_class) \ |
759 void msg_class::Log(std::string* name, \ | 767 void msg_class::Log(std::string* name, \ |
760 const Message* msg, \ | 768 const Message* msg, \ |
761 std::string* l) { \ | 769 std::string* l) { \ |
762 if (name) \ | 770 if (name) \ |
763 *name = #msg_class; \ | 771 *name = #msg_class; \ |
764 if (!msg || !l) \ | 772 if (!msg || !l) \ |
765 return; \ | 773 return; \ |
766 Schema::Param p; \ | 774 Schema::Param p; \ |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 // This corresponds to an enum value from IPCMessageStart. | 993 // This corresponds to an enum value from IPCMessageStart. |
986 #define IPC_MESSAGE_CLASS(message) \ | 994 #define IPC_MESSAGE_CLASS(message) \ |
987 IPC_MESSAGE_ID_CLASS(message.type()) | 995 IPC_MESSAGE_ID_CLASS(message.type()) |
988 | 996 |
989 #endif // IPC_IPC_MESSAGE_MACROS_H_ | 997 #endif // IPC_IPC_MESSAGE_MACROS_H_ |
990 | 998 |
991 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 999 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
992 // XXX_messages.h files need not do so themselves. This makes the | 1000 // XXX_messages.h files need not do so themselves. This makes the |
993 // XXX_messages.h files easier to write. | 1001 // XXX_messages.h files easier to write. |
994 #undef IPC_MESSAGE_START | 1002 #undef IPC_MESSAGE_START |
OLD | NEW |