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 \ |
616 IPC_TYPE_IN_##in_cnt in_list); \ | 616 IPC_COMMA_##in_cnt IPC_TYPE_IN_##in_cnt in_list); \ |
agl
2014/10/21 17:49:49
Please fix the indentation here and in other insta
dcheng
2014/10/21 17:57:44
Sorry for missing this. I did spot check all the p
| |
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(const Message* msg, \ |
637 const Message* msg, \ | 637 TupleTypes<ReplyParam>::ValueTuple* p); \ |
638 TupleTypes<ReplyParam>::ValueTuple* p); \ | 638 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); \ | 639 IPC_SYNC_MESSAGE_METHODS_##out_cnt \ |
640 IPC_SYNC_MESSAGE_METHODS_##out_cnt \ | |
641 }; | 640 }; |
642 | 641 |
643 #define IPC_SYNC_ROUTED_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ | 642 #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 { \ | 643 class IPC_MESSAGE_EXPORT msg_class : public IPC::SyncMessage { \ |
645 public: \ | 644 public: \ |
646 typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ | 645 typedef IPC::SyncMessageSchema<IPC_TUPLE_IN_##in_cnt in_list, \ |
647 IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ | 646 IPC_TUPLE_OUT_##out_cnt out_list> Schema; \ |
648 typedef Schema::ReplyParam ReplyParam; \ | 647 typedef Schema::ReplyParam ReplyParam; \ |
649 typedef Schema::SendParam SendParam; \ | 648 typedef Schema::SendParam SendParam; \ |
650 enum { ID = IPC_MESSAGE_ID() }; \ | 649 enum { ID = IPC_MESSAGE_ID() }; \ |
651 msg_class(int32 routing_id \ | 650 msg_class(int32 routing_id IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ |
652 IPC_COMMA_OR_##in_cnt(IPC_COMMA_##out_cnt) \ | 651 IPC_TYPE_IN_##in_cnt in_list \ |
653 IPC_TYPE_IN_##in_cnt in_list \ | 652 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ |
654 IPC_COMMA_AND_##in_cnt(IPC_COMMA_##out_cnt) \ | 653 IPC_TYPE_OUT_##out_cnt out_list); \ |
655 IPC_TYPE_OUT_##out_cnt out_list); \ | 654 ~msg_class() override; \ |
656 virtual ~msg_class(); \ | 655 static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ |
657 static bool ReadSendParam(const Message* msg, Schema::SendParam* p); \ | 656 static bool ReadReplyParam(const Message* msg, \ |
658 static bool ReadReplyParam( \ | 657 TupleTypes<ReplyParam>::ValueTuple* p); \ |
659 const Message* msg, \ | 658 static void Log(std::string* name, const Message* msg, std::string* l); \ |
660 TupleTypes<ReplyParam>::ValueTuple* p); \ | 659 IPC_SYNC_MESSAGE_METHODS_##out_cnt \ |
661 static void Log(std::string* name, const Message* msg, std::string* l); \ | |
662 IPC_SYNC_MESSAGE_METHODS_##out_cnt \ | |
663 }; | 660 }; |
664 | 661 |
665 #if defined(IPC_MESSAGE_IMPL) | 662 #if defined(IPC_MESSAGE_IMPL) |
666 | 663 |
667 // "Implementation" inclusion produces constructors, destructors, and | 664 // "Implementation" inclusion produces constructors, destructors, and |
668 // logging functions, except for the no-arg special cases, where the | 665 // logging functions, except for the no-arg special cases, where the |
669 // implementation occurs in the declaration, and there is no special | 666 // implementation occurs in the declaration, and there is no special |
670 // logging function. | 667 // logging function. |
671 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ | 668 #define IPC_MESSAGE_EXTRA(sync, kind, msg_class, \ |
672 in_cnt, out_cnt, in_list, out_list) \ | 669 in_cnt, out_cnt, in_list, out_list) \ |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
978 // equivalent without the #ifdef, VS2013 contains a bug where it is | 975 // equivalent without the #ifdef, VS2013 contains a bug where it is |
979 // over-aggressive in optimizing out #includes. Putting the #ifdef is a | 976 // over-aggressive in optimizing out #includes. Putting the #ifdef is a |
980 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. | 977 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. |
981 // This can be removed once VS2013 is fixed. | 978 // This can be removed once VS2013 is fixed. |
982 #ifdef IPC_MESSAGE_START | 979 #ifdef IPC_MESSAGE_START |
983 // Clean up IPC_MESSAGE_START in this unguarded section so that the | 980 // 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 | 981 // XXX_messages.h files need not do so themselves. This makes the |
985 // XXX_messages.h files easier to write. | 982 // XXX_messages.h files easier to write. |
986 #undef IPC_MESSAGE_START | 983 #undef IPC_MESSAGE_START |
987 #endif | 984 #endif |
OLD | NEW |