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

Side by Side Diff: ipc/ipc_message_utils.h

Issue 1461813002: Call base::DispatchToMethod by the fully qualified name (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 | « ipc/ipc_message_macros.h ('k') | 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 <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 const Message* msg, 1016 const Message* msg,
1017 typename base::TupleTypes<ReplyParam>::ValueTuple* p) IPC_MSG_NOINLINE; 1017 typename base::TupleTypes<ReplyParam>::ValueTuple* p) IPC_MSG_NOINLINE;
1018 1018
1019 template<class T, class S, class Method> 1019 template<class T, class S, class Method>
1020 static bool DispatchWithSendParams(bool ok, const SendParam& send_params, 1020 static bool DispatchWithSendParams(bool ok, const SendParam& send_params,
1021 const Message* msg, T* obj, S* sender, 1021 const Message* msg, T* obj, S* sender,
1022 Method func) { 1022 Method func) {
1023 Message* reply = SyncMessage::GenerateReply(msg); 1023 Message* reply = SyncMessage::GenerateReply(msg);
1024 if (ok) { 1024 if (ok) {
1025 typename base::TupleTypes<ReplyParam>::ValueTuple reply_params; 1025 typename base::TupleTypes<ReplyParam>::ValueTuple reply_params;
1026 DispatchToMethod(obj, func, send_params, &reply_params); 1026 base::DispatchToMethod(obj, func, send_params, &reply_params);
1027 WriteParam(reply, reply_params); 1027 WriteParam(reply, reply_params);
1028 LogReplyParamsToMessage(reply_params, msg); 1028 LogReplyParamsToMessage(reply_params, msg);
1029 } else { 1029 } else {
1030 NOTREACHED() << "Error deserializing message " << msg->type(); 1030 NOTREACHED() << "Error deserializing message " << msg->type();
1031 reply->set_reply_error(); 1031 reply->set_reply_error();
1032 } 1032 }
1033 sender->Send(reply); 1033 sender->Send(reply);
1034 return ok; 1034 return ok;
1035 } 1035 }
1036 1036
1037 template<class T, class Method> 1037 template<class T, class Method>
1038 static bool DispatchDelayReplyWithSendParams(bool ok, 1038 static bool DispatchDelayReplyWithSendParams(bool ok,
1039 const SendParam& send_params, 1039 const SendParam& send_params,
1040 const Message* msg, T* obj, 1040 const Message* msg, T* obj,
1041 Method func) { 1041 Method func) {
1042 Message* reply = SyncMessage::GenerateReply(msg); 1042 Message* reply = SyncMessage::GenerateReply(msg);
1043 if (ok) { 1043 if (ok) {
1044 base::Tuple<Message&> t = base::MakeRefTuple(*reply); 1044 base::Tuple<Message&> t = base::MakeRefTuple(*reply);
1045 ConnectMessageAndReply(msg, reply); 1045 ConnectMessageAndReply(msg, reply);
1046 DispatchToMethod(obj, func, send_params, &t); 1046 base::DispatchToMethod(obj, func, send_params, &t);
1047 } else { 1047 } else {
1048 NOTREACHED() << "Error deserializing message " << msg->type(); 1048 NOTREACHED() << "Error deserializing message " << msg->type();
1049 reply->set_reply_error(); 1049 reply->set_reply_error();
1050 obj->Send(reply); 1050 obj->Send(reply);
1051 } 1051 }
1052 return ok; 1052 return ok;
1053 } 1053 }
1054 1054
1055 template <typename... Ts> 1055 template <typename... Ts>
1056 static void WriteReplyParams(Message* reply, Ts... args) { 1056 static void WriteReplyParams(Message* reply, Ts... args) {
1057 ReplyParam p(args...); 1057 ReplyParam p(args...);
1058 WriteParam(reply, p); 1058 WriteParam(reply, p);
1059 } 1059 }
1060 }; 1060 };
1061 1061
1062 } // namespace IPC 1062 } // namespace IPC
1063 1063
1064 #endif // IPC_IPC_MESSAGE_UTILS_H_ 1064 #endif // IPC_IPC_MESSAGE_UTILS_H_
OLDNEW
« no previous file with comments | « ipc/ipc_message_macros.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698