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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
607 #define IPC_MESSAGE_DECL(sync, kind, msg_class, \ | 607 #define IPC_MESSAGE_DECL(sync, kind, msg_class, \ |
608 in_cnt, out_cnt, in_list, out_list) \ | 608 in_cnt, out_cnt, in_list, out_list) \ |
609 IPC_##sync##_##kind##_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 609 IPC_##sync##_##kind##_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
610 IPC_MESSAGE_EXTRA(sync, kind, msg_class, in_cnt, out_cnt, in_list, out_list) | 610 IPC_MESSAGE_EXTRA(sync, kind, msg_class, in_cnt, out_cnt, in_list, out_list) |
611 | 611 |
612 #define IPC_EMPTY_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 612 #define IPC_EMPTY_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
613 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ | 613 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ |
614 public: \ | 614 public: \ |
615 typedef IPC::Message Schema; \ | 615 typedef IPC::Message Schema; \ |
616 enum { ID = IPC_MESSAGE_ID() }; \ | 616 enum { ID = IPC_MESSAGE_ID() }; \ |
617 msg_class() : IPC::Message(MSG_ROUTING_CONTROL, ID) {} \ | 617 msg_class() : IPC::Message(MSG_ROUTING_CONTROL, ID, PRIORITY_NORMAL) {} \ |
618 static void Log(std::string* name, const Message* msg, std::string* l); \ | 618 static void Log(std::string* name, const Message* msg, std::string* l); \ |
619 }; | 619 }; |
620 | 620 |
621 #define IPC_EMPTY_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 621 #define IPC_EMPTY_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
622 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ | 622 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ |
623 public: \ | 623 public: \ |
624 typedef IPC::Message Schema; \ | 624 typedef IPC::Message Schema; \ |
625 enum { ID = IPC_MESSAGE_ID() }; \ | 625 enum { ID = IPC_MESSAGE_ID() }; \ |
626 msg_class(int32 routing_id) \ | 626 msg_class(int32 routing_id) \ |
627 : IPC::Message(routing_id, ID) {} \ | 627 : IPC::Message(routing_id, ID, PRIORITY_NORMAL) {} \ |
628 static void Log(std::string* name, const Message* msg, std::string* l); \ | 628 static void Log(std::string* name, const Message* msg, std::string* l); \ |
629 }; | 629 }; |
630 | 630 |
631 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 631 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
632 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ | 632 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ |
633 public: \ | 633 public: \ |
634 typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ | 634 typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ |
635 typedef Schema::Param Param; \ | 635 typedef Schema::Param Param; \ |
636 enum { ID = IPC_MESSAGE_ID() }; \ | 636 enum { ID = IPC_MESSAGE_ID() }; \ |
637 msg_class(IPC_TYPE_IN_##in_cnt in_list); \ | 637 msg_class(IPC_TYPE_IN_##in_cnt in_list); \ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ | 706 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ |
707 in_cnt, out_cnt, in_list, out_list) \ | 707 in_cnt, out_cnt, in_list, out_list) \ |
708 IPC_##sync##_##kind##_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 708 IPC_##sync##_##kind##_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
709 IPC_##sync##_MESSAGE_LOG(msg_class) | 709 IPC_##sync##_MESSAGE_LOG(msg_class) |
710 | 710 |
711 #define IPC_EMPTY_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) | 711 #define IPC_EMPTY_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) |
712 #define IPC_EMPTY_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) | 712 #define IPC_EMPTY_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) |
713 | 713 |
714 #define IPC_ASYNC_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 714 #define IPC_ASYNC_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
715 msg_class::msg_class(IPC_TYPE_IN_##in_cnt in_list) : \ | 715 msg_class::msg_class(IPC_TYPE_IN_##in_cnt in_list) : \ |
716 IPC::Message(MSG_ROUTING_CONTROL, ID) { \ | 716 IPC::Message(MSG_ROUTING_CONTROL, ID, PRIORITY_NORMAL) { \ |
717 Schema::Write(this, IPC_NAME_IN_##in_cnt in_list); \ | 717 Schema::Write(this, IPC_NAME_IN_##in_cnt in_list); \ |
718 } \ | 718 } \ |
719 msg_class::~msg_class() {} \ | 719 msg_class::~msg_class() {} \ |
720 bool msg_class::Read(const Message* msg, Schema::Param* p) { \ | 720 bool msg_class::Read(const Message* msg, Schema::Param* p) { \ |
721 return Schema::Read(msg, p); \ | 721 return Schema::Read(msg, p); \ |
722 } | 722 } |
723 | 723 |
724 #define IPC_ASYNC_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 724 #define IPC_ASYNC_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
725 msg_class::msg_class(int32 routing_id IPC_COMMA_##in_cnt \ | 725 msg_class::msg_class(int32 routing_id IPC_COMMA_##in_cnt \ |
726 IPC_TYPE_IN_##in_cnt in_list) : \ | 726 IPC_TYPE_IN_##in_cnt in_list) : \ |
727 IPC::Message(routing_id, ID) { \ | 727 IPC::Message(routing_id, ID, PRIORITY_NORMAL) { \ |
728 Schema::Write(this, IPC_NAME_IN_##in_cnt in_list); \ | 728 Schema::Write(this, IPC_NAME_IN_##in_cnt in_list); \ |
729 } \ | 729 } \ |
730 msg_class::~msg_class() {} \ | 730 msg_class::~msg_class() {} \ |
731 bool msg_class::Read(const Message* msg, Schema::Param* p) { \ | 731 bool msg_class::Read(const Message* msg, Schema::Param* p) { \ |
732 return Schema::Read(msg, p); \ | 732 return Schema::Read(msg, p); \ |
733 } | 733 } |
734 | 734 |
735 #define IPC_SYNC_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 735 #define IPC_SYNC_CONTROL_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
736 msg_class::msg_class(IPC_TYPE_IN_##in_cnt in_list \ | 736 msg_class::msg_class(IPC_TYPE_IN_##in_cnt in_list \ |
737 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ | 737 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ |
738 IPC_TYPE_OUT_##out_cnt out_list) : \ | 738 IPC_TYPE_OUT_##out_cnt out_list) : \ |
739 IPC::SyncMessage(MSG_ROUTING_CONTROL, ID, \ | 739 IPC::SyncMessage(MSG_ROUTING_CONTROL, ID, PRIORITY_NORMAL, \ |
740 new IPC::ParamDeserializer<Schema::ReplyParam>( \ | 740 new IPC::ParamDeserializer<Schema::ReplyParam>( \ |
741 IPC_NAME_OUT_##out_cnt out_list)) { \ | 741 IPC_NAME_OUT_##out_cnt out_list)) { \ |
742 Schema::Write(this, IPC_NAME_IN_##in_cnt in_list); \ | 742 Schema::Write(this, IPC_NAME_IN_##in_cnt in_list); \ |
743 } \ | 743 } \ |
744 msg_class::~msg_class() {} \ | 744 msg_class::~msg_class() {} \ |
745 bool msg_class::ReadSendParam(const Message* msg, Schema::SendParam* p) { \ | 745 bool msg_class::ReadSendParam(const Message* msg, Schema::SendParam* p) { \ |
746 return Schema::ReadSendParam(msg, p); \ | 746 return Schema::ReadSendParam(msg, p); \ |
747 } \ | 747 } \ |
748 bool msg_class::ReadReplyParam(const Message* msg, \ | 748 bool msg_class::ReadReplyParam(const Message* msg, \ |
749 TupleTypes<ReplyParam>::ValueTuple* p) { \ | 749 TupleTypes<ReplyParam>::ValueTuple* p) { \ |
750 return Schema::ReadReplyParam(msg, p); \ | 750 return Schema::ReadReplyParam(msg, p); \ |
751 } | 751 } |
752 | 752 |
753 #define IPC_SYNC_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 753 #define IPC_SYNC_ROUTED_IMPL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
754 msg_class::msg_class(int32 routing_id \ | 754 msg_class::msg_class(int32 routing_id \ |
755 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ | 755 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ |
756 IPC_TYPE_IN_##in_cnt in_list \ | 756 IPC_TYPE_IN_##in_cnt in_list \ |
757 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ | 757 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ |
758 IPC_TYPE_OUT_##out_cnt out_list) : \ | 758 IPC_TYPE_OUT_##out_cnt out_list) : \ |
759 IPC::SyncMessage(routing_id, ID, \ | 759 IPC::SyncMessage(routing_id, ID, PRIORITY_NORMAL, \ |
760 new IPC::ParamDeserializer<Schema::ReplyParam>( \ | 760 new IPC::ParamDeserializer<Schema::ReplyParam>( \ |
761 IPC_NAME_OUT_##out_cnt out_list)) { \ | 761 IPC_NAME_OUT_##out_cnt out_list)) { \ |
762 Schema::Write(this, IPC_NAME_IN_##in_cnt in_list); \ | 762 Schema::Write(this, IPC_NAME_IN_##in_cnt in_list); \ |
763 } \ | 763 } \ |
764 msg_class::~msg_class() {} \ | 764 msg_class::~msg_class() {} \ |
765 bool msg_class::ReadSendParam(const Message* msg, Schema::SendParam* p) { \ | 765 bool msg_class::ReadSendParam(const Message* msg, Schema::SendParam* p) { \ |
766 return Schema::ReadSendParam(msg, p); \ | 766 return Schema::ReadSendParam(msg, p); \ |
767 } \ | 767 } \ |
768 bool msg_class::ReadReplyParam(const Message* msg, \ | 768 bool msg_class::ReadReplyParam(const Message* msg, \ |
769 TupleTypes<ReplyParam>::ValueTuple* p) { \ | 769 TupleTypes<ReplyParam>::ValueTuple* p) { \ |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1014 // equivalent without the #ifdef, VS2013 contains a bug where it is | 1014 // equivalent without the #ifdef, VS2013 contains a bug where it is |
1015 // over-aggressive in optimizing out #includes. Putting the #ifdef is a | 1015 // over-aggressive in optimizing out #includes. Putting the #ifdef is a |
1016 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. | 1016 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. |
1017 // This can be removed once VS2013 is fixed. | 1017 // This can be removed once VS2013 is fixed. |
1018 #ifdef IPC_MESSAGE_START | 1018 #ifdef IPC_MESSAGE_START |
1019 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 1019 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
1020 // XXX_messages.h files need not do so themselves. This makes the | 1020 // XXX_messages.h files need not do so themselves. This makes the |
1021 // XXX_messages.h files easier to write. | 1021 // XXX_messages.h files easier to write. |
1022 #undef IPC_MESSAGE_START | 1022 #undef IPC_MESSAGE_START |
1023 #endif | 1023 #endif |
OLD | NEW |