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

Side by Side Diff: ipc/ipc_sync_message.h

Issue 7633042: Create ipc.dll. (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_sync_channel.h ('k') | ipc/ipc_sync_message_filter.h » ('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 #ifndef IPC_IPC_SYNC_MESSAGE_H_ 5 #ifndef IPC_IPC_SYNC_MESSAGE_H_
6 #define IPC_IPC_SYNC_MESSAGE_H_ 6 #define IPC_IPC_SYNC_MESSAGE_H_
7 #pragma once 7 #pragma once
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
11 #endif 11 #endif
12 #include <string> 12 #include <string>
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "ipc/ipc_message.h" 14 #include "ipc/ipc_message.h"
15 15
16 namespace base { 16 namespace base {
17 class WaitableEvent; 17 class WaitableEvent;
18 } 18 }
19 19
20 namespace IPC { 20 namespace IPC {
21 21
22 class MessageReplyDeserializer; 22 class MessageReplyDeserializer;
23 23
24 class SyncMessage : public Message { 24 class IPC_EXPORT SyncMessage : public Message {
25 public: 25 public:
26 SyncMessage(int32 routing_id, uint32 type, PriorityValue priority, 26 SyncMessage(int32 routing_id, uint32 type, PriorityValue priority,
27 MessageReplyDeserializer* deserializer); 27 MessageReplyDeserializer* deserializer);
28 28
29 // Call this to get a deserializer for the output parameters. 29 // Call this to get a deserializer for the output parameters.
30 // Note that this can only be called once, and the caller is responsible 30 // Note that this can only be called once, and the caller is responsible
31 // for deleting the deserializer when they're done. 31 // for deleting the deserializer when they're done.
32 MessageReplyDeserializer* GetReplyDeserializer(); 32 MessageReplyDeserializer* GetReplyDeserializer();
33 33
34 // If this message can cause the receiver to block while waiting for user 34 // If this message can cause the receiver to block while waiting for user
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 }; 74 };
75 75
76 static bool ReadSyncHeader(const Message& msg, SyncHeader* header); 76 static bool ReadSyncHeader(const Message& msg, SyncHeader* header);
77 static bool WriteSyncHeader(Message* msg, const SyncHeader& header); 77 static bool WriteSyncHeader(Message* msg, const SyncHeader& header);
78 78
79 MessageReplyDeserializer* deserializer_; 79 MessageReplyDeserializer* deserializer_;
80 base::WaitableEvent* pump_messages_event_; 80 base::WaitableEvent* pump_messages_event_;
81 }; 81 };
82 82
83 // Used to deserialize parameters from a reply to a synchronous message 83 // Used to deserialize parameters from a reply to a synchronous message
84 class MessageReplyDeserializer { 84 class IPC_EXPORT MessageReplyDeserializer {
85 public: 85 public:
86 virtual ~MessageReplyDeserializer() {} 86 virtual ~MessageReplyDeserializer() {}
87 bool SerializeOutputParameters(const Message& msg); 87 bool SerializeOutputParameters(const Message& msg);
88 private: 88 private:
89 // Derived classes need to implement this, using the given iterator (which 89 // Derived classes need to implement this, using the given iterator (which
90 // is skipped past the header for synchronous messages). 90 // is skipped past the header for synchronous messages).
91 virtual bool SerializeOutputParameters(const Message& msg, void* iter) = 0; 91 virtual bool SerializeOutputParameters(const Message& msg, void* iter) = 0;
92 }; 92 };
93 93
94 // When sending a synchronous message, this structure contains an object 94 // When sending a synchronous message, this structure contains an object
95 // that knows how to deserialize the response. 95 // that knows how to deserialize the response.
96 struct PendingSyncMsg { 96 struct PendingSyncMsg {
97 PendingSyncMsg(int id, 97 PendingSyncMsg(int id,
98 MessageReplyDeserializer* d, 98 MessageReplyDeserializer* d,
99 base::WaitableEvent* e) 99 base::WaitableEvent* e)
100 : id(id), deserializer(d), done_event(e), send_result(false) { } 100 : id(id), deserializer(d), done_event(e), send_result(false) { }
101 int id; 101 int id;
102 MessageReplyDeserializer* deserializer; 102 MessageReplyDeserializer* deserializer;
103 base::WaitableEvent* done_event; 103 base::WaitableEvent* done_event;
104 bool send_result; 104 bool send_result;
105 }; 105 };
106 106
107 } // namespace IPC 107 } // namespace IPC
108 108
109 #endif // IPC_IPC_SYNC_MESSAGE_H_ 109 #endif // IPC_IPC_SYNC_MESSAGE_H_
OLDNEW
« no previous file with comments | « ipc/ipc_sync_channel.h ('k') | ipc/ipc_sync_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698