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

Side by Side Diff: ipc/ipc_message_utils.h

Issue 1036883002: Simplify IPC::SyncMessageSchema::WriteReplyParams() using variadic templates (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef IPC_IPC_MESSAGE_UTILS_H_ 5 #ifndef IPC_IPC_MESSAGE_UTILS_H_
6 #define IPC_IPC_MESSAGE_UTILS_H_ 6 #define IPC_IPC_MESSAGE_UTILS_H_
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 888 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 ConnectMessageAndReply(msg, reply); 899 ConnectMessageAndReply(msg, reply);
900 DispatchToMethod(obj, func, send_params, &t); 900 DispatchToMethod(obj, func, send_params, &t);
901 } else { 901 } else {
902 NOTREACHED() << "Error deserializing message " << msg->type(); 902 NOTREACHED() << "Error deserializing message " << msg->type();
903 reply->set_reply_error(); 903 reply->set_reply_error();
904 obj->Send(reply); 904 obj->Send(reply);
905 } 905 }
906 return ok; 906 return ok;
907 } 907 }
908 908
909 template<typename TA> 909 template<typename... T>
Tom Sepez 2015/03/25 17:11:58 Nit: space before < (not your fault, but lets fix
910 static void WriteReplyParams(Message* reply, TA a) { 910 static void WriteReplyParams(Message* reply, T... a) {
911 ReplyParam p(a); 911 ReplyParam p(a...);
912 WriteParam(reply, p);
913 }
914
915 template<typename TA, typename TB>
916 static void WriteReplyParams(Message* reply, TA a, TB b) {
917 ReplyParam p(a, b);
918 WriteParam(reply, p);
919 }
920
921 template<typename TA, typename TB, typename TC>
922 static void WriteReplyParams(Message* reply, TA a, TB b, TC c) {
923 ReplyParam p(a, b, c);
924 WriteParam(reply, p);
925 }
926
927 template<typename TA, typename TB, typename TC, typename TD>
928 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d) {
929 ReplyParam p(a, b, c, d);
930 WriteParam(reply, p);
931 }
932
933 template<typename TA, typename TB, typename TC, typename TD, typename TE>
934 static void WriteReplyParams(Message* reply, TA a, TB b, TC c, TD d, TE e) {
935 ReplyParam p(a, b, c, d, e);
936 WriteParam(reply, p); 912 WriteParam(reply, p);
937 } 913 }
938 }; 914 };
939 915
940 } // namespace IPC 916 } // namespace IPC
941 917
942 #endif // IPC_IPC_MESSAGE_UTILS_H_ 918 #endif // IPC_IPC_MESSAGE_UTILS_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698