| 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 #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/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 iter->done_event->Signal(); | 354 iter->done_event->Signal(); |
| 355 } | 355 } |
| 356 | 356 |
| 357 void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) { | 357 void SyncChannel::SyncContext::OnWaitableEventSignaled(WaitableEvent* event) { |
| 358 if (event == shutdown_event_) { | 358 if (event == shutdown_event_) { |
| 359 // Process shut down before we can get a reply to a synchronous message. | 359 // Process shut down before we can get a reply to a synchronous message. |
| 360 // Cancel pending Send calls, which will end up setting the send done event. | 360 // Cancel pending Send calls, which will end up setting the send done event. |
| 361 CancelPendingSends(); | 361 CancelPendingSends(); |
| 362 } else { | 362 } else { |
| 363 // We got the reply, timed out or the process shutdown. | 363 // We got the reply, timed out or the process shutdown. |
| 364 DCHECK(event == GetSendDoneEvent()); | 364 DCHECK_EQ(GetSendDoneEvent(), event); |
| 365 MessageLoop::current()->QuitNow(); | 365 MessageLoop::current()->QuitNow(); |
| 366 } | 366 } |
| 367 } | 367 } |
| 368 | 368 |
| 369 | 369 |
| 370 SyncChannel::SyncChannel( | 370 SyncChannel::SyncChannel( |
| 371 const IPC::ChannelHandle& channel_handle, | 371 const IPC::ChannelHandle& channel_handle, |
| 372 Channel::Mode mode, | 372 Channel::Mode mode, |
| 373 Channel::Listener* listener, | 373 Channel::Listener* listener, |
| 374 MessageLoop* ipc_message_loop, | 374 MessageLoop* ipc_message_loop, |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { | 503 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { |
| 504 DCHECK(event == sync_context()->GetDispatchEvent()); | 504 DCHECK(event == sync_context()->GetDispatchEvent()); |
| 505 // The call to DispatchMessages might delete this object, so reregister | 505 // The call to DispatchMessages might delete this object, so reregister |
| 506 // the object watcher first. | 506 // the object watcher first. |
| 507 event->Reset(); | 507 event->Reset(); |
| 508 dispatch_watcher_.StartWatching(event, this); | 508 dispatch_watcher_.StartWatching(event, this); |
| 509 sync_context()->DispatchMessages(); | 509 sync_context()->DispatchMessages(); |
| 510 } | 510 } |
| 511 | 511 |
| 512 } // namespace IPC | 512 } // namespace IPC |
| OLD | NEW |