| OLD | NEW |
| 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_SYNC_CHANNEL_H_ | 5 #ifndef IPC_IPC_SYNC_CHANNEL_H_ |
| 6 #define IPC_IPC_SYNC_CHANNEL_H_ | 6 #define IPC_IPC_SYNC_CHANNEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <deque> | 10 #include <deque> |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 public: | 64 public: |
| 65 enum RestrictDispatchGroup { | 65 enum RestrictDispatchGroup { |
| 66 kRestrictDispatchGroup_None = 0, | 66 kRestrictDispatchGroup_None = 0, |
| 67 }; | 67 }; |
| 68 | 68 |
| 69 // Creates and initializes a sync channel. If create_pipe_now is specified, | 69 // Creates and initializes a sync channel. If create_pipe_now is specified, |
| 70 // the channel will be initialized synchronously. | 70 // the channel will be initialized synchronously. |
| 71 SyncChannel(const IPC::ChannelHandle& channel_handle, | 71 SyncChannel(const IPC::ChannelHandle& channel_handle, |
| 72 Channel::Mode mode, | 72 Channel::Mode mode, |
| 73 Listener* listener, | 73 Listener* listener, |
| 74 base::MessageLoopProxy* ipc_message_loop, | 74 base::SingleThreadTaskRunner* ipc_task_runner, |
| 75 bool create_pipe_now, | 75 bool create_pipe_now, |
| 76 base::WaitableEvent* shutdown_event); | 76 base::WaitableEvent* shutdown_event); |
| 77 | 77 |
| 78 // Creates an uninitialized sync channel. Call ChannelProxy::Init to | 78 // Creates an uninitialized sync channel. Call ChannelProxy::Init to |
| 79 // initialize the channel. This two-step setup allows message filters to be | 79 // initialize the channel. This two-step setup allows message filters to be |
| 80 // added before any messages are sent or received. | 80 // added before any messages are sent or received. |
| 81 SyncChannel(Listener* listener, | 81 SyncChannel(Listener* listener, |
| 82 base::MessageLoopProxy* ipc_message_loop, | 82 base::SingleThreadTaskRunner* ipc_task_runner, |
| 83 base::WaitableEvent* shutdown_event); | 83 base::WaitableEvent* shutdown_event); |
| 84 | 84 |
| 85 virtual ~SyncChannel(); | 85 virtual ~SyncChannel(); |
| 86 | 86 |
| 87 virtual bool Send(Message* message) OVERRIDE; | 87 virtual bool Send(Message* message) OVERRIDE; |
| 88 virtual bool SendWithTimeout(Message* message, int timeout_ms); | 88 virtual bool SendWithTimeout(Message* message, int timeout_ms); |
| 89 | 89 |
| 90 // Whether we allow sending messages with no time-out. | 90 // Whether we allow sending messages with no time-out. |
| 91 void set_sync_messages_with_no_timeout_allowed(bool value) { | 91 void set_sync_messages_with_no_timeout_allowed(bool value) { |
| 92 sync_messages_with_no_timeout_allowed_ = value; | 92 sync_messages_with_no_timeout_allowed_ = value; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 113 class ReceivedSyncMsgQueue; | 113 class ReceivedSyncMsgQueue; |
| 114 friend class ReceivedSyncMsgQueue; | 114 friend class ReceivedSyncMsgQueue; |
| 115 | 115 |
| 116 // SyncContext holds the per object data for SyncChannel, so that SyncChannel | 116 // SyncContext holds the per object data for SyncChannel, so that SyncChannel |
| 117 // can be deleted while it's being used in a different thread. See | 117 // can be deleted while it's being used in a different thread. See |
| 118 // ChannelProxy::Context for more information. | 118 // ChannelProxy::Context for more information. |
| 119 class SyncContext : public Context, | 119 class SyncContext : public Context, |
| 120 public base::WaitableEventWatcher::Delegate { | 120 public base::WaitableEventWatcher::Delegate { |
| 121 public: | 121 public: |
| 122 SyncContext(Listener* listener, | 122 SyncContext(Listener* listener, |
| 123 base::MessageLoopProxy* ipc_thread, | 123 base::SingleThreadTaskRunner* ipc_task_runner, |
| 124 base::WaitableEvent* shutdown_event); | 124 base::WaitableEvent* shutdown_event); |
| 125 | 125 |
| 126 // Adds information about an outgoing sync message to the context so that | 126 // Adds information about an outgoing sync message to the context so that |
| 127 // we know how to deserialize the reply. | 127 // we know how to deserialize the reply. |
| 128 void Push(SyncMessage* sync_msg); | 128 void Push(SyncMessage* sync_msg); |
| 129 | 129 |
| 130 // Cleanly remove the top deserializer (and throw it away). Returns the | 130 // Cleanly remove the top deserializer (and throw it away). Returns the |
| 131 // result of the Send call for that message. | 131 // result of the Send call for that message. |
| 132 bool Pop(); | 132 bool Pop(); |
| 133 | 133 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 218 |
| 219 // Used to signal events between the IPC and listener threads. | 219 // Used to signal events between the IPC and listener threads. |
| 220 base::WaitableEventWatcher dispatch_watcher_; | 220 base::WaitableEventWatcher dispatch_watcher_; |
| 221 | 221 |
| 222 DISALLOW_COPY_AND_ASSIGN(SyncChannel); | 222 DISALLOW_COPY_AND_ASSIGN(SyncChannel); |
| 223 }; | 223 }; |
| 224 | 224 |
| 225 } // namespace IPC | 225 } // namespace IPC |
| 226 | 226 |
| 227 #endif // IPC_IPC_SYNC_CHANNEL_H_ | 227 #endif // IPC_IPC_SYNC_CHANNEL_H_ |
| OLD | NEW |