| 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 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, | 218 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, |
| 219 base::WaitableEvent* shutdown_event); | 219 base::WaitableEvent* shutdown_event); |
| 220 | 220 |
| 221 void OnDispatchEventSignaled(base::WaitableEvent* event); | 221 void OnDispatchEventSignaled(base::WaitableEvent* event); |
| 222 | 222 |
| 223 SyncContext* sync_context() { | 223 SyncContext* sync_context() { |
| 224 return reinterpret_cast<SyncContext*>(context()); | 224 return reinterpret_cast<SyncContext*>(context()); |
| 225 } | 225 } |
| 226 | 226 |
| 227 // Both these functions wait for a reply, timeout or process shutdown. The | 227 // Both these functions wait for a reply, timeout or process shutdown. The |
| 228 // latter one also runs a nested message loop in the meantime. | 228 // latter one also runs a nested run loop in the meantime. |
| 229 static void WaitForReply(mojo::SyncHandleRegistry* registry, | 229 static void WaitForReply(mojo::SyncHandleRegistry* registry, |
| 230 SyncContext* context, | 230 SyncContext* context, |
| 231 bool pump_messages); | 231 bool pump_messages); |
| 232 | 232 |
| 233 // Runs a nested message loop until a reply arrives, times out, or the process | 233 // Runs a nested run loop until a reply arrives, times out, or the process |
| 234 // shuts down. | 234 // shuts down. |
| 235 static void WaitForReplyWithNestedMessageLoop(SyncContext* context); | 235 static void WaitForReplyWithNestedMessageLoop(SyncContext* context); |
| 236 | 236 |
| 237 // Starts the dispatch watcher. | 237 // Starts the dispatch watcher. |
| 238 void StartWatching(); | 238 void StartWatching(); |
| 239 | 239 |
| 240 // ChannelProxy overrides: | 240 // ChannelProxy overrides: |
| 241 void OnChannelInit() override; | 241 void OnChannelInit() override; |
| 242 | 242 |
| 243 scoped_refptr<mojo::SyncHandleRegistry> sync_handle_registry_; | 243 scoped_refptr<mojo::SyncHandleRegistry> sync_handle_registry_; |
| 244 | 244 |
| 245 // Used to signal events between the IPC and listener threads. | 245 // Used to signal events between the IPC and listener threads. |
| 246 base::WaitableEventWatcher dispatch_watcher_; | 246 base::WaitableEventWatcher dispatch_watcher_; |
| 247 base::WaitableEventWatcher::EventCallback dispatch_watcher_callback_; | 247 base::WaitableEventWatcher::EventCallback dispatch_watcher_callback_; |
| 248 | 248 |
| 249 // Tracks SyncMessageFilters created before complete channel initialization. | 249 // Tracks SyncMessageFilters created before complete channel initialization. |
| 250 std::vector<scoped_refptr<SyncMessageFilter>> pre_init_sync_message_filters_; | 250 std::vector<scoped_refptr<SyncMessageFilter>> pre_init_sync_message_filters_; |
| 251 | 251 |
| 252 DISALLOW_COPY_AND_ASSIGN(SyncChannel); | 252 DISALLOW_COPY_AND_ASSIGN(SyncChannel); |
| 253 }; | 253 }; |
| 254 | 254 |
| 255 } // namespace IPC | 255 } // namespace IPC |
| 256 | 256 |
| 257 #endif // IPC_IPC_SYNC_CHANNEL_H_ | 257 #endif // IPC_IPC_SYNC_CHANNEL_H_ |
| OLD | NEW |