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

Side by Side Diff: ipc/ipc_sync_channel.h

Issue 2081963003: Simplify SyncChannel message pumping event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | ipc/ipc_sync_channel.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) 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 204
205 scoped_refptr<ReceivedSyncMsgQueue> received_sync_msgs_; 205 scoped_refptr<ReceivedSyncMsgQueue> received_sync_msgs_;
206 206
207 base::WaitableEvent* shutdown_event_; 207 base::WaitableEvent* shutdown_event_;
208 base::WaitableEventWatcher shutdown_watcher_; 208 base::WaitableEventWatcher shutdown_watcher_;
209 base::WaitableEventWatcher::EventCallback shutdown_watcher_callback_; 209 base::WaitableEventWatcher::EventCallback shutdown_watcher_callback_;
210 int restrict_dispatch_group_; 210 int restrict_dispatch_group_;
211 }; 211 };
212 212
213 private: 213 private:
214 class PumpMessagesEvent;
215
216 SyncChannel( 214 SyncChannel(
217 Listener* listener, 215 Listener* listener,
218 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner, 216 const scoped_refptr<base::SingleThreadTaskRunner>& ipc_task_runner,
219 base::WaitableEvent* shutdown_event); 217 base::WaitableEvent* shutdown_event);
220 218
221 void OnDispatchHandleReady(MojoResult result); 219 void OnDispatchHandleReady(MojoResult result);
222 220
223 SyncContext* sync_context() { 221 SyncContext* sync_context() {
224 return reinterpret_cast<SyncContext*>(context()); 222 return reinterpret_cast<SyncContext*>(context());
225 } 223 }
226 224
227 // Both these functions wait for a reply, timeout or process shutdown. The 225 // Both these functions wait for a reply, timeout or process shutdown. The
228 // latter one also runs a nested message loop in the meantime. 226 // latter one also runs a nested message loop in the meantime.
229 static void WaitForReply(mojo::SyncHandleRegistry* registry, 227 static void WaitForReply(mojo::SyncHandleRegistry* registry,
230 SyncContext* context, 228 SyncContext* context,
231 const MojoEvent* pump_messages_event); 229 bool pump_messages);
232 230
233 // Runs a nested message loop until a reply arrives, times out, or the process 231 // Runs a nested message loop until a reply arrives, times out, or the process
234 // shuts down. 232 // shuts down.
235 static void WaitForReplyWithNestedMessageLoop(SyncContext* context); 233 static void WaitForReplyWithNestedMessageLoop(SyncContext* context);
236 234
237 // Starts the dispatch watcher. 235 // Starts the dispatch watcher.
238 void StartWatching(); 236 void StartWatching();
239 237
240 // ChannelProxy overrides: 238 // ChannelProxy overrides:
241 void OnChannelInit() override; 239 void OnChannelInit() override;
242 240
243 scoped_refptr<PumpMessagesEvent> pump_messages_event_;
244 scoped_refptr<mojo::SyncHandleRegistry> sync_handle_registry_; 241 scoped_refptr<mojo::SyncHandleRegistry> sync_handle_registry_;
245 242
246 // Used to signal events between the IPC and listener threads. 243 // Used to signal events between the IPC and listener threads.
247 mojo::Watcher dispatch_watcher_; 244 mojo::Watcher dispatch_watcher_;
248 245
249 // Tracks SyncMessageFilters created before complete channel initialization. 246 // Tracks SyncMessageFilters created before complete channel initialization.
250 std::vector<scoped_refptr<SyncMessageFilter>> pre_init_sync_message_filters_; 247 std::vector<scoped_refptr<SyncMessageFilter>> pre_init_sync_message_filters_;
251 248
252 DISALLOW_COPY_AND_ASSIGN(SyncChannel); 249 DISALLOW_COPY_AND_ASSIGN(SyncChannel);
253 }; 250 };
254 251
255 } // namespace IPC 252 } // namespace IPC
256 253
257 #endif // IPC_IPC_SYNC_CHANNEL_H_ 254 #endif // IPC_IPC_SYNC_CHANNEL_H_
OLDNEW
« no previous file with comments | « no previous file | ipc/ipc_sync_channel.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698