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

Side by Side Diff: ipc/ipc_message_utils_impl.h

Issue 7768001: Add support for exporting IPC messages from component DLLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « ipc/ipc_message_utils.h ('k') | ipc/sync_socket_unittest.cc » ('j') | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 // This file contains templates forward declared (but not defined) in 5 // This file contains templates forward declared (but not defined) in
6 // ipc_message_utils.h so that they are only instantiated in certain files, 6 // ipc_message_utils.h so that they are only instantiated in certain files,
7 // notably a few IPC unit tests. 7 // notably a few IPC unit tests.
8 8
9 #ifndef IPC_IPC_MESSAGE_UTILS_IMPL_H_ 9 #ifndef IPC_IPC_MESSAGE_UTILS_IMPL_H_
10 #define IPC_IPC_MESSAGE_UTILS_IMPL_H_ 10 #define IPC_IPC_MESSAGE_UTILS_IMPL_H_
11 11
12 namespace IPC { 12 namespace IPC {
13 13
14 template <class ParamType> 14 template <class ParamType>
15 MessageWithTuple<ParamType>::MessageWithTuple( 15 void MessageSchema<ParamType>::Write(Message* msg, const RefParam& p) {
16 int32 routing_id, uint32 type, const RefParam& p) 16 WriteParam(msg, p);
17 : Message(routing_id, type, PRIORITY_NORMAL) {
18 WriteParam(this, p);
19 } 17 }
20 18
21 template <class ParamType> 19 template <class ParamType>
22 bool MessageWithTuple<ParamType>::Read(const Message* msg, Param* p) { 20 bool MessageSchema<ParamType>::Read(const Message* msg, Param* p) {
23 void* iter = NULL; 21 void* iter = NULL;
24 if (ReadParam(msg, &iter, p)) 22 if (ReadParam(msg, &iter, p))
25 return true; 23 return true;
26 NOTREACHED() << "Error deserializing message " << msg->type(); 24 NOTREACHED() << "Error deserializing message " << msg->type();
27 return false; 25 return false;
28 } 26 }
29 27
30 // We can't migrate the template for Log() to MessageWithTuple, because each
31 // subclass needs to have Log() to call Read(), which instantiates the above
32 // template.
33
34 template <class SendParamType, class ReplyParamType> 28 template <class SendParamType, class ReplyParamType>
35 MessageWithReply<SendParamType, ReplyParamType>::MessageWithReply( 29 void SyncMessageSchema<SendParamType, ReplyParamType>::Write(
36 int32 routing_id, uint32 type, 30 Message* msg,
37 const RefSendParam& send, 31 const RefSendParam& send) {
38 const ReplyParam& reply) 32 WriteParam(msg, send);
39 : SyncMessage(routing_id, type, PRIORITY_NORMAL,
40 new ParamDeserializer<ReplyParam>(reply)) {
41 WriteParam(this, send);
42 } 33 }
43 34
44 template <class SendParamType, class ReplyParamType> 35 template <class SendParamType, class ReplyParamType>
45 bool MessageWithReply<SendParamType, ReplyParamType>::ReadSendParam( 36 bool SyncMessageSchema<SendParamType, ReplyParamType>::ReadSendParam(
46 const Message* msg, SendParam* p) { 37 const Message* msg, SendParam* p) {
47 void* iter = SyncMessage::GetDataIterator(msg); 38 void* iter = SyncMessage::GetDataIterator(msg);
48 return ReadParam(msg, &iter, p); 39 return ReadParam(msg, &iter, p);
49 } 40 }
50 41
51 template <class SendParamType, class ReplyParamType> 42 template <class SendParamType, class ReplyParamType>
52 bool MessageWithReply<SendParamType, ReplyParamType>::ReadReplyParam( 43 bool SyncMessageSchema<SendParamType, ReplyParamType>::ReadReplyParam(
53 const Message* msg, typename TupleTypes<ReplyParam>::ValueTuple* p) { 44 const Message* msg, typename TupleTypes<ReplyParam>::ValueTuple* p) {
54 void* iter = SyncMessage::GetDataIterator(msg); 45 void* iter = SyncMessage::GetDataIterator(msg);
55 return ReadParam(msg, &iter, p); 46 return ReadParam(msg, &iter, p);
56 } 47 }
57 48
58 } // namespace IPC 49 } // namespace IPC
59 50
60 #endif // IPC_IPC_MESSAGE_UTILS_IMPL_H_ 51 #endif // IPC_IPC_MESSAGE_UTILS_IMPL_H_
OLDNEW
« no previous file with comments | « ipc/ipc_message_utils.h ('k') | ipc/sync_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698