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