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

Side by Side Diff: ipc/ipc_sync_channel.cc

Issue 652089: Add MessageLoop::QuitNow and use it to terminate a sync IPC.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 10 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 | « chrome/renderer/renderer_webkitclient_impl.cc ('k') | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 #include "ipc/ipc_sync_channel.h" 5 #include "ipc/ipc_sync_channel.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/thread_local.h" 9 #include "base/thread_local.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 343 }
344 344
345 void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) { 345 void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) {
346 if (event == shutdown_event_) { 346 if (event == shutdown_event_) {
347 // Process shut down before we can get a reply to a synchronous message. 347 // Process shut down before we can get a reply to a synchronous message.
348 // Cancel pending Send calls, which will end up setting the send done event. 348 // Cancel pending Send calls, which will end up setting the send done event.
349 CancelPendingSends(); 349 CancelPendingSends();
350 } else { 350 } else {
351 // We got the reply, timed out or the process shutdown. 351 // We got the reply, timed out or the process shutdown.
352 DCHECK(event == GetSendDoneEvent()); 352 DCHECK(event == GetSendDoneEvent());
353 MessageLoop::current()->Quit(); 353 MessageLoop::current()->QuitNow();
354 } 354 }
355 } 355 }
356 356
357 357
358 SyncChannel::SyncChannel( 358 SyncChannel::SyncChannel(
359 const std::string& channel_id, Channel::Mode mode, 359 const std::string& channel_id, Channel::Mode mode,
360 Channel::Listener* listener, MessageFilter* filter, 360 Channel::Listener* listener, MessageFilter* filter,
361 MessageLoop* ipc_message_loop, bool create_pipe_now, 361 MessageLoop* ipc_message_loop, bool create_pipe_now,
362 WaitableEvent* shutdown_event) 362 WaitableEvent* shutdown_event)
363 : ChannelProxy( 363 : ChannelProxy(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { 484 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) {
485 DCHECK(event == sync_context()->GetDispatchEvent()); 485 DCHECK(event == sync_context()->GetDispatchEvent());
486 // The call to DispatchMessages might delete this object, so reregister 486 // The call to DispatchMessages might delete this object, so reregister
487 // the object watcher first. 487 // the object watcher first.
488 event->Reset(); 488 event->Reset();
489 dispatch_watcher_.StartWatching(event, this); 489 dispatch_watcher_.StartWatching(event, this);
490 sync_context()->DispatchMessages(); 490 sync_context()->DispatchMessages();
491 } 491 }
492 492
493 } // namespace IPC 493 } // namespace IPC
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_webkitclient_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698