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 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 static void Log(std::string* name, const Message* msg, std::string* l); \ | 593 static void Log(std::string* name, const Message* msg, std::string* l); \ |
594 }; | 594 }; |
595 | 595 |
596 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 596 #define IPC_ASYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
597 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ | 597 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ |
598 public: \ | 598 public: \ |
599 typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ | 599 typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ |
600 typedef Schema::Param Param; \ | 600 typedef Schema::Param Param; \ |
601 enum { ID = IPC_MESSAGE_ID() }; \ | 601 enum { ID = IPC_MESSAGE_ID() }; \ |
602 msg_class(IPC_TYPE_IN_##in_cnt in_list); \ | 602 msg_class(IPC_TYPE_IN_##in_cnt in_list); \ |
603 virtual ~msg_class(); \ | 603 ~msg_class() override; \ |
604 static bool Read(const Message* msg, Schema::Param* p); \ | 604 static bool Read(const Message* msg, Schema::Param* p); \ |
605 static void Log(std::string* name, const Message* msg, std::string* l); \ | 605 static void Log(std::string* name, const Message* msg, std::string* l); \ |
606 IPC_ASYNC_MESSAGE_METHODS_##in_cnt \ | 606 IPC_ASYNC_MESSAGE_METHODS_##in_cnt \ |
607 }; | 607 }; |
608 | 608 |
609 #define IPC_ASYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 609 #define IPC_ASYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
610 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ | 610 class IPC_MESSAGE_EXPORT msg_class : public IPC::Message { \ |
611 public: \ | 611 public: \ |
612 typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ | 612 typedef IPC::MessageSchema<IPC_TUPLE_IN_##in_cnt in_list> Schema; \ |
613 typedef Schema::Param Param; \ | 613 typedef Schema::Param Param; \ |
614 enum { ID = IPC_MESSAGE_ID() }; \ | 614 enum { ID = IPC_MESSAGE_ID() }; \ |
615 msg_class(int32 routing_id IPC_COMMA_##in_cnt \ | 615 msg_class(int32 routing_id IPC_COMMA_##in_cnt \ |
616 IPC_TYPE_IN_##in_cnt in_list); \ | 616 IPC_TYPE_IN_##in_cnt in_list); \ |
617 virtual ~msg_class(); \ | 617 ~msg_class() override; \ |
618 static bool Read(const Message* msg, Schema::Param* p); \ | 618 static bool Read(const Message* msg, Schema::Param* p); \ |
619 static void Log(std::string* name, const Message* msg, std::string* l); \ | 619 static void Log(std::string* name, const Message* msg, std::string* l); \ |
620 IPC_ASYNC_MESSAGE_METHODS_##in_cnt \ | 620 IPC_ASYNC_MESSAGE_METHODS_##in_cnt \ |
621 }; | 621 }; |
622 | 622 |
623 #define IPC_SYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 623 #define IPC_SYNC_CONTROL_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
624 class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ | 624 class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ |
625 public: \ | 625 public: \ |
626 typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ | 626 typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ |
627 IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ | 627 IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ |
628 typedef Schema::ReplyParam ReplyParam; \ | 628 typedef Schema::ReplyParam ReplyParam; \ |
629 typedef Schema::SendParam SendParam; \ | 629 typedef Schema::SendParam SendParam; \ |
630 enum { ID = IPC_MESSAGE_ID() }; \ | 630 enum { ID = IPC_MESSAGE_ID() }; \ |
631 msg_class(IPC_TYPE_IN_##in_cnt in_list \ | 631 msg_class(IPC_TYPE_IN_##in_cnt in_list \ |
632 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ | 632 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ |
633 IPC_TYPE_OUT_##out_cnt out_list); \ | 633 IPC_TYPE_OUT_##out_cnt out_list); \ |
634 virtual ~msg_class(); \ | 634 ~msg_class() override; \ |
635 static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ | 635 static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ |
636 static bool ReadReplyParam( \ | 636 static bool ReadReplyParam( \ |
637 const Message* msg, \ | 637 const Message* msg, \ |
638 TupleTypes<ReplyParam>::ValueTuple* p); \ | 638 TupleTypes<ReplyParam>::ValueTuple* p); \ |
639 static void Log(std::string* name, const Message* msg, std::string* l); \ | 639 static void Log(std::string* name, const Message* msg, std::string* l); \ |
640 IPC_SYNC_MESSAGE_METHODS_##out_cnt \ | 640 IPC_SYNC_MESSAGE_METHODS_##out_cnt \ |
641 }; | 641 }; |
642 | 642 |
643 #define IPC_SYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 643 #define IPC_SYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ |
644 class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ | 644 class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ |
645 public: \ | 645 public: \ |
646 typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ | 646 typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ |
647 IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ | 647 IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ |
648 typedef Schema::ReplyParam ReplyParam; \ | 648 typedef Schema::ReplyParam ReplyParam; \ |
649 typedef Schema::SendParam SendParam; \ | 649 typedef Schema::SendParam SendParam; \ |
650 enum { ID = IPC_MESSAGE_ID() }; \ | 650 enum { ID = IPC_MESSAGE_ID() }; \ |
651 msg_class(int32 routing_id \ | 651 msg_class(int32 routing_id \ |
652 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ | 652 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ |
653 IPC_TYPE_IN_##in_cnt in_list \ | 653 IPC_TYPE_IN_##in_cnt in_list \ |
654 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ | 654 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ |
655 IPC_TYPE_OUT_##out_cnt out_list); \ | 655 IPC_TYPE_OUT_##out_cnt out_list); \ |
656 virtual ~msg_class(); \ | 656 ~msg_class() override; \ |
657 static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ | 657 static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ |
658 static bool ReadReplyParam( \ | 658 static bool ReadReplyParam( \ |
659 const Message* msg, \ | 659 const Message* msg, \ |
660 TupleTypes<ReplyParam>::ValueTuple* p); \ | 660 TupleTypes<ReplyParam>::ValueTuple* p); \ |
661 static void Log(std::string* name, const Message* msg, std::string* l); \ | 661 static void Log(std::string* name, const Message* msg, std::string* l); \ |
662 IPC_SYNC_MESSAGE_METHODS_##out_cnt \ | 662 IPC_SYNC_MESSAGE_METHODS_##out_cnt \ |
663 }; | 663 }; |
664 | 664 |
665 #if defined(IPC_MESSAGE_IMPL) | 665 #if defined(IPC_MESSAGE_IMPL) |
666 | 666 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
978 // equivalent without the #ifdef, VS2013 contains a bug where it is | 978 // equivalent without the #ifdef, VS2013 contains a bug where it is |
979 // over-aggressive in optimizing out #includes. Putting the #ifdef is a | 979 // over-aggressive in optimizing out #includes. Putting the #ifdef is a |
980 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. | 980 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. |
981 // This can be removed once VS2013 is fixed. | 981 // This can be removed once VS2013 is fixed. |
982 #ifdef IPC_MESSAGE_START | 982 #ifdef IPC_MESSAGE_START |
983 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 983 // Clean up IPC_MESSAGE_START in this unguarded section so that the |
984 // XXX_messages.h files need not do so themselves. This makes the | 984 // XXX_messages.h files need not do so themselves. This makes the |
985 // XXX_messages.h files easier to write. | 985 // XXX_messages.h files easier to write. |
986 #undef IPC_MESSAGE_START | 986 #undef IPC_MESSAGE_START |
987 #endif | 987 #endif |
OLD | NEW |