Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: ipc/ipc_message_macros.h

Issue 133893004: Allow deleting autofill password suggestions on Shift+Delete (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments addressed Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 #define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \ 252 #define IPC_MESSAGE_ROUTED3(msg_class, type1, type2, type3) \
253 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 3, 0, (type1, type2, type3), ()) 253 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 3, 0, (type1, type2, type3), ())
254 254
255 #define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \ 255 #define IPC_MESSAGE_ROUTED4(msg_class, type1, type2, type3, type4) \
256 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 4, 0, (type1, type2, type3, type4), ()) 256 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 4, 0, (type1, type2, type3, type4), ())
257 257
258 #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \ 258 #define IPC_MESSAGE_ROUTED5(msg_class, type1, type2, type3, type4, type5) \
259 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 5, 0, (type1, type2, type3, type4, type5), ()) 259 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 5, 0, (type1, type2, type3, type4, type5), ())
260 260
261 #define IPC_MESSAGE_ROUTED6(msg_class, type1, type2, type3, type4, type5, type6) \
262 IPC_MESSAGE_DECL(ASYNC, ROUTED, msg_class, 6, 0, (type1, type2, type3, type4, type5, type6), ())
263
261 #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \ 264 #define IPC_SYNC_MESSAGE_CONTROL0_0(msg_class) \
262 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 0, (), ()) 265 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 0, (), ())
263 266
264 #define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \ 267 #define IPC_SYNC_MESSAGE_CONTROL0_1(msg_class, type1_out) \
265 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 1, (), (type1_out)) 268 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 1, (), (type1_out))
266 269
267 #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \ 270 #define IPC_SYNC_MESSAGE_CONTROL0_2(msg_class, type1_out, type2_out) \
268 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 2, (), (type1_out, type2_out)) 271 IPC_MESSAGE_DECL(SYNC, CONTROL, msg_class, 0, 2, (), (type1_out, type2_out))
269 272
270 #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \ 273 #define IPC_SYNC_MESSAGE_CONTROL0_3(msg_class, type1_out, type2_out, type3_out) \
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 Schema::Param p; \ 545 Schema::Param p; \
543 if (!Read(msg, &p)) \ 546 if (!Read(msg, &p)) \
544 return false; \ 547 return false; \
545 *a = p.a; \ 548 *a = p.a; \
546 *b = p.b; \ 549 *b = p.b; \
547 *c = p.c; \ 550 *c = p.c; \
548 *d = p.d; \ 551 *d = p.d; \
549 *e = p.e; \ 552 *e = p.e; \
550 return true; \ 553 return true; \
551 } 554 }
555 #define IPC_ASYNC_MESSAGE_METHODS_6 \
556 IPC_ASYNC_MESSAGE_METHODS_GENERIC \
557 template<class T, class S, typename TA, typename TB, typename TC, \
558 typename TD, typename TE, typename TF> \
559 static bool Dispatch(const Message* msg, T* obj, S* sender, \
560 void (T::*func)(const Message&, TA, TB, TC, TD, TE, TF)) { \
561 Schema::Param p; \
562 if (Read(msg, &p)) { \
563 (obj->*func)(*msg, p.a, p.b, p.c, p.d, p.e, p.f); \
564 return true; \
565 } \
566 return false; \
567 } \
568 template<typename TA, typename TB, typename TC, typename TD, typename TE, \
569 typename TF> \
570 static bool Read(const IPC::Message* msg, TA* a, TB* b, TC* c, TD* d, \
571 TE* e, TF* f) { \
572 Schema::Param p; \
573 if (!Read(msg, &p)) \
574 return false; \
575 *a = p.a; \
576 *b = p.b; \
577 *c = p.c; \
578 *d = p.d; \
579 *e = p.e; \
580 *f = p.f; \
581 return true; \
582 }
552 583
553 // The following macros define the common set of methods provided by SYNC 584 // The following macros define the common set of methods provided by SYNC
554 // message classes. 585 // message classes.
555 #define IPC_SYNC_MESSAGE_METHODS_GENERIC \ 586 #define IPC_SYNC_MESSAGE_METHODS_GENERIC \
556 template<class T, class S, class Method> \ 587 template<class T, class S, class Method> \
557 static bool Dispatch(const Message* msg, T* obj, S* sender, Method func) { \ 588 static bool Dispatch(const Message* msg, T* obj, S* sender, Method func) { \
558 Schema::SendParam send_params; \ 589 Schema::SendParam send_params; \
559 bool ok = ReadSendParam(msg, &send_params); \ 590 bool ok = ReadSendParam(msg, &send_params); \
560 return Schema::DispatchWithSendParams(ok, send_params, msg, obj, sender, \ 591 return Schema::DispatchWithSendParams(ok, send_params, msg, obj, sender, \
561 func); \ 592 func); \
(...skipping 30 matching lines...) Expand all
592 template<typename TA, typename TB, typename TC, typename TD> \ 623 template<typename TA, typename TB, typename TC, typename TD> \
593 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d) { \ 624 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d) { \
594 Schema::WriteReplyParams(reply, a, b, c, d); \ 625 Schema::WriteReplyParams(reply, a, b, c, d); \
595 } 626 }
596 #define IPC_SYNC_MESSAGE_METHODS_5 \ 627 #define IPC_SYNC_MESSAGE_METHODS_5 \
597 IPC_SYNC_MESSAGE_METHODS_GENERIC \ 628 IPC_SYNC_MESSAGE_METHODS_GENERIC \
598 template<typename TA, typename TB, typename TC, typename TD, typename TE> \ 629 template<typename TA, typename TB, typename TC, typename TD, typename TE> \
599 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { \ 630 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) { \
600 Schema::WriteReplyParams(reply, a, b, c, d, e); \ 631 Schema::WriteReplyParams(reply, a, b, c, d, e); \
601 } 632 }
633 #define IPC_SYNC_MESSAGE_METHODS_6 \
634 IPC_SYNC_MESSAGE_METHODS_GENERIC \
635 template<typename TA, typename TB, typename TC, typename TD, typename TE, type name TF> \
636 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e, TF f) { \
637 Schema::WriteReplyParams(reply, a, b, c, d, e, f); \
638 }
602 639
603 // Common message macro which dispatches into one of the 6 (sync x kind) 640 // Common message macro which dispatches into one of the 6 (sync x kind)
604 // routines. There is a way that these 6 cases can be lumped together, 641 // routines. There is a way that these 6 cases can be lumped together,
605 // but the macros get very complicated in that case. 642 // but the macros get very complicated in that case.
606 // Note: intended be redefined to generate other information. 643 // Note: intended be redefined to generate other information.
607 #define IPC_MESSAGE_DECL(sync, kind, msg_class, \ 644 #define IPC_MESSAGE_DECL(sync, kind, msg_class, \
608 in_cnt, out_cnt, in_list, out_list) \ 645 in_cnt, out_cnt, in_list, out_list) \
609 IPC_##sync##_##kind##_DECL(msg_class, in_cnt, out_cnt, in_list, out_list) \ 646 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) 647 IPC_MESSAGE_EXTRA(sync, kind, msg_class, in_cnt, out_cnt, in_list, out_list)
611 648
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
838 #endif // defined(IPC_MESSAGE_IMPL) 875 #endif // defined(IPC_MESSAGE_IMPL)
839 876
840 // Handle variable sized argument lists. These are usually invoked by token 877 // Handle variable sized argument lists. These are usually invoked by token
841 // pasting against the argument counts. 878 // pasting against the argument counts.
842 #define IPC_TYPE_IN_0() 879 #define IPC_TYPE_IN_0()
843 #define IPC_TYPE_IN_1(t1) const t1& arg1 880 #define IPC_TYPE_IN_1(t1) const t1& arg1
844 #define IPC_TYPE_IN_2(t1, t2) const t1& arg1, const t2& arg2 881 #define IPC_TYPE_IN_2(t1, t2) const t1& arg1, const t2& arg2
845 #define IPC_TYPE_IN_3(t1, t2, t3) const t1& arg1, const t2& arg2, cons t t3& arg3 882 #define IPC_TYPE_IN_3(t1, t2, t3) const t1& arg1, const t2& arg2, cons t t3& arg3
846 #define IPC_TYPE_IN_4(t1, t2, t3, t4) const t1& arg1, const t2& arg2, cons t t3& arg3, const t4& arg4 883 #define IPC_TYPE_IN_4(t1, t2, t3, t4) const t1& arg1, const t2& arg2, cons t t3& arg3, const t4& arg4
847 #define IPC_TYPE_IN_5(t1, t2, t3, t4, t5) const t1& arg1, const t2& arg2, cons t t3& arg3, const t4& arg4, const t5& arg5 884 #define IPC_TYPE_IN_5(t1, t2, t3, t4, t5) const t1& arg1, const t2& arg2, cons t t3& arg3, const t4& arg4, const t5& arg5
885 #define IPC_TYPE_IN_6(t1, t2, t3, t4, t5, t6) const t1& arg1, const t2& arg2, const t3& arg3, const t4& arg4, const t5& arg5, const t6& arg6
886
848 887
849 #define IPC_TYPE_OUT_0() 888 #define IPC_TYPE_OUT_0()
850 #define IPC_TYPE_OUT_1(t1) t1* arg6 889 #define IPC_TYPE_OUT_1(t1) t1* arg6
851 #define IPC_TYPE_OUT_2(t1, t2) t1* arg6, t2* arg7 890 #define IPC_TYPE_OUT_2(t1, t2) t1* arg6, t2* arg7
852 #define IPC_TYPE_OUT_3(t1, t2, t3) t1* arg6, t2* arg7, t3* arg8 891 #define IPC_TYPE_OUT_3(t1, t2, t3) t1* arg6, t2* arg7, t3* arg8
853 #define IPC_TYPE_OUT_4(t1, t2, t3, t4) t1* arg6, t2* arg7, t3* arg8, t4* ar g9 892 #define IPC_TYPE_OUT_4(t1, t2, t3, t4) t1* arg6, t2* arg7, t3* arg8, t4* ar g9
854 893
855 #define IPC_TUPLE_IN_0() Tuple0 894 #define IPC_TUPLE_IN_0() Tuple0
856 #define IPC_TUPLE_IN_1(t1) Tuple1<t1> 895 #define IPC_TUPLE_IN_1(t1) Tuple1<t1>
857 #define IPC_TUPLE_IN_2(t1, t2) Tuple2<t1, t2> 896 #define IPC_TUPLE_IN_2(t1, t2) Tuple2<t1, t2>
858 #define IPC_TUPLE_IN_3(t1, t2, t3) Tuple3<t1, t2, t3> 897 #define IPC_TUPLE_IN_3(t1, t2, t3) Tuple3<t1, t2, t3>
859 #define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple4<t1, t2, t3, t4> 898 #define IPC_TUPLE_IN_4(t1, t2, t3, t4) Tuple4<t1, t2, t3, t4>
860 #define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple5<t1, t2, t3, t4, t5> 899 #define IPC_TUPLE_IN_5(t1, t2, t3, t4, t5) Tuple5<t1, t2, t3, t4, t5>
900 #define IPC_TUPLE_IN_6(t1, t2, t3, t4, t5, t6) Tuple6<t1, t2, t3, t4, t5, t6>
861 901
862 #define IPC_TUPLE_OUT_0() Tuple0 902 #define IPC_TUPLE_OUT_0() Tuple0
863 #define IPC_TUPLE_OUT_1(t1) Tuple1<t1&> 903 #define IPC_TUPLE_OUT_1(t1) Tuple1<t1&>
864 #define IPC_TUPLE_OUT_2(t1, t2) Tuple2<t1&, t2&> 904 #define IPC_TUPLE_OUT_2(t1, t2) Tuple2<t1&, t2&>
865 #define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple3<t1&, t2&, t3&> 905 #define IPC_TUPLE_OUT_3(t1, t2, t3) Tuple3<t1&, t2&, t3&>
866 #define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple4<t1&, t2&, t3&, t4&> 906 #define IPC_TUPLE_OUT_4(t1, t2, t3, t4) Tuple4<t1&, t2&, t3&, t4&>
867 907
868 #define IPC_NAME_IN_0() MakeTuple() 908 #define IPC_NAME_IN_0() MakeTuple()
869 #define IPC_NAME_IN_1(t1) MakeRefTuple(arg1) 909 #define IPC_NAME_IN_1(t1) MakeRefTuple(arg1)
870 #define IPC_NAME_IN_2(t1, t2) MakeRefTuple(arg1, arg2) 910 #define IPC_NAME_IN_2(t1, t2) MakeRefTuple(arg1, arg2)
871 #define IPC_NAME_IN_3(t1, t2, t3) MakeRefTuple(arg1, arg2, arg3) 911 #define IPC_NAME_IN_3(t1, t2, t3) MakeRefTuple(arg1, arg2, arg3)
872 #define IPC_NAME_IN_4(t1, t2, t3, t4) MakeRefTuple(arg1, arg2, arg3, arg4) 912 #define IPC_NAME_IN_4(t1, t2, t3, t4) MakeRefTuple(arg1, arg2, arg3, arg4)
873 #define IPC_NAME_IN_5(t1, t2, t3, t4, t5) MakeRefTuple(arg1, arg2, arg3, arg4, arg5) 913 #define IPC_NAME_IN_5(t1, t2, t3, t4, t5) MakeRefTuple(arg1, arg2, arg3, arg4, arg5)
914 #define IPC_NAME_IN_6(t1, t2, t3, t4, t5, t6) MakeRefTuple(arg1, arg2, arg3, a rg4, arg5, arg6)
874 915
875 #define IPC_NAME_OUT_0() MakeTuple() 916 #define IPC_NAME_OUT_0() MakeTuple()
876 #define IPC_NAME_OUT_1(t1) MakeRefTuple(*arg6) 917 #define IPC_NAME_OUT_1(t1) MakeRefTuple(*arg6)
877 #define IPC_NAME_OUT_2(t1, t2) MakeRefTuple(*arg6, *arg7) 918 #define IPC_NAME_OUT_2(t1, t2) MakeRefTuple(*arg6, *arg7)
878 #define IPC_NAME_OUT_3(t1, t2, t3) MakeRefTuple(*arg6, *arg7, *arg8) 919 #define IPC_NAME_OUT_3(t1, t2, t3) MakeRefTuple(*arg6, *arg7, *arg8)
879 #define IPC_NAME_OUT_4(t1, t2, t3, t4) MakeRefTuple(*arg6, *arg7, *arg8, *a rg9) 920 #define IPC_NAME_OUT_4(t1, t2, t3, t4) MakeRefTuple(*arg6, *arg7, *arg8, *a rg9)
880 921
881 // There are places where the syntax requires a comma if there are input args, 922 // There are places where the syntax requires a comma if there are input args,
882 // if there are input args and output args, or if there are input args or 923 // if there are input args and output args, or if there are input args or
883 // output args. These macros allow generation of the comma as needed; invoke 924 // output args. These macros allow generation of the comma as needed; invoke
884 // by token pasting against the argument counts. 925 // by token pasting against the argument counts.
885 #define IPC_COMMA_0 926 #define IPC_COMMA_0
886 #define IPC_COMMA_1 , 927 #define IPC_COMMA_1 ,
887 #define IPC_COMMA_2 , 928 #define IPC_COMMA_2 ,
888 #define IPC_COMMA_3 , 929 #define IPC_COMMA_3 ,
889 #define IPC_COMMA_4 , 930 #define IPC_COMMA_4 ,
890 #define IPC_COMMA_5 , 931 #define IPC_COMMA_5 ,
932 #define IPC_COMMA_6 ,
891 933
892 #define IPC_COMMA_AND_0(x) 934 #define IPC_COMMA_AND_0(x)
893 #define IPC_COMMA_AND_1(x) x 935 #define IPC_COMMA_AND_1(x) x
894 #define IPC_COMMA_AND_2(x) x 936 #define IPC_COMMA_AND_2(x) x
895 #define IPC_COMMA_AND_3(x) x 937 #define IPC_COMMA_AND_3(x) x
896 #define IPC_COMMA_AND_4(x) x 938 #define IPC_COMMA_AND_4(x) x
897 #define IPC_COMMA_AND_5(x) x 939 #define IPC_COMMA_AND_5(x) x
940 #define IPC_COMMA_AND_6(x) x
898 941
899 #define IPC_COMMA_OR_0(x) x 942 #define IPC_COMMA_OR_0(x) x
900 #define IPC_COMMA_OR_1(x) , 943 #define IPC_COMMA_OR_1(x) ,
901 #define IPC_COMMA_OR_2(x) , 944 #define IPC_COMMA_OR_2(x) ,
902 #define IPC_COMMA_OR_3(x) , 945 #define IPC_COMMA_OR_3(x) ,
903 #define IPC_COMMA_OR_4(x) , 946 #define IPC_COMMA_OR_4(x) ,
904 #define IPC_COMMA_OR_5(x) , 947 #define IPC_COMMA_OR_5(x) ,
948 #define IPC_COMMA_OR_6(x) ,
905 949
906 // Message IDs 950 // Message IDs
907 // Note: we currently use __LINE__ to give unique IDs to messages within 951 // Note: we currently use __LINE__ to give unique IDs to messages within
908 // a file. They're globally unique since each file defines its own 952 // a file. They're globally unique since each file defines its own
909 // IPC_MESSAGE_START. 953 // IPC_MESSAGE_START.
910 #define IPC_MESSAGE_ID() ((IPC_MESSAGE_START << 16) + __LINE__) 954 #define IPC_MESSAGE_ID() ((IPC_MESSAGE_START << 16) + __LINE__)
911 #define IPC_MESSAGE_ID_CLASS(id) ((id) >> 16) 955 #define IPC_MESSAGE_ID_CLASS(id) ((id) >> 16)
912 #define IPC_MESSAGE_ID_LINE(id) ((id) & 0xffff) 956 #define IPC_MESSAGE_ID_LINE(id) ((id) & 0xffff)
913 957
914 // Message crackers and handlers. 958 // Message crackers and handlers.
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 // equivalent without the #ifdef, VS2013 contains a bug where it is 1058 // equivalent without the #ifdef, VS2013 contains a bug where it is
1015 // over-aggressive in optimizing out #includes. Putting the #ifdef is a 1059 // over-aggressive in optimizing out #includes. Putting the #ifdef is a
1016 // workaround for this bug. See http://goo.gl/eGt2Fb for more details. 1060 // workaround for this bug. See http://goo.gl/eGt2Fb for more details.
1017 // This can be removed once VS2013 is fixed. 1061 // This can be removed once VS2013 is fixed.
1018 #ifdef IPC_MESSAGE_START 1062 #ifdef IPC_MESSAGE_START
1019 // Clean up IPC_MESSAGE_START in this unguarded section so that the 1063 // 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 1064 // XXX_messages.h files need not do so themselves. This makes the
1021 // XXX_messages.h files easier to write. 1065 // XXX_messages.h files easier to write.
1022 #undef IPC_MESSAGE_START 1066 #undef IPC_MESSAGE_START
1023 #endif 1067 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698