OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_SENDER_H__ | 5 #ifndef IPC_IPC_SYNC_SENDER_H__ |
6 #define IPC_IPC_SYNC_SENDER_H__ | 6 #define IPC_IPC_SYNC_SENDER_H__ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <deque> | 10 #include <deque> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // Significant complexity results from the fact that messages are still coming | 53 // Significant complexity results from the fact that messages are still coming |
54 // in while the original thread is blocked. Normal async messages are queued | 54 // in while the original thread is blocked. Normal async messages are queued |
55 // and dispatched after the blocking call is complete. Sync messages must | 55 // and dispatched after the blocking call is complete. Sync messages must |
56 // be dispatched in a reentrant manner to avoid deadlock. | 56 // be dispatched in a reentrant manner to avoid deadlock. |
57 // | 57 // |
58 // | 58 // |
59 // Note that care must be taken that the lifetime of the ipc_thread argument | 59 // Note that care must be taken that the lifetime of the ipc_thread argument |
60 // is more than this object. If the message loop goes away while this object | 60 // is more than this object. If the message loop goes away while this object |
61 // is running and it's used to send a message, then it will use the invalid | 61 // is running and it's used to send a message, then it will use the invalid |
62 // message loop pointer to proxy it to the ipc thread. | 62 // message loop pointer to proxy it to the ipc thread. |
63 class SyncChannel : public ChannelProxy, | 63 class IPC_EXPORT SyncChannel : public ChannelProxy, |
64 public base::WaitableEventWatcher::Delegate { | 64 public base::WaitableEventWatcher::Delegate { |
65 public: | 65 public: |
66 SyncChannel(const IPC::ChannelHandle& channel_handle, | 66 SyncChannel(const IPC::ChannelHandle& channel_handle, |
67 Channel::Mode mode, | 67 Channel::Mode mode, |
68 Channel::Listener* listener, | 68 Channel::Listener* listener, |
69 base::MessageLoopProxy* ipc_message_loop, | 69 base::MessageLoopProxy* ipc_message_loop, |
70 bool create_pipe_now, | 70 bool create_pipe_now, |
71 base::WaitableEvent* shutdown_event); | 71 base::WaitableEvent* shutdown_event); |
72 virtual ~SyncChannel(); | 72 virtual ~SyncChannel(); |
73 | 73 |
74 virtual bool Send(Message* message); | 74 virtual bool Send(Message* message); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 // Used to signal events between the IPC and listener threads. | 192 // Used to signal events between the IPC and listener threads. |
193 base::WaitableEventWatcher dispatch_watcher_; | 193 base::WaitableEventWatcher dispatch_watcher_; |
194 | 194 |
195 DISALLOW_COPY_AND_ASSIGN(SyncChannel); | 195 DISALLOW_COPY_AND_ASSIGN(SyncChannel); |
196 }; | 196 }; |
197 | 197 |
198 } // namespace IPC | 198 } // namespace IPC |
199 | 199 |
200 #endif // IPC_IPC_SYNC_SENDER_H__ | 200 #endif // IPC_IPC_SYNC_SENDER_H__ |
OLD | NEW |