| OLD | NEW |
| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 shutdown_watcher_.StopWatching(); | 313 shutdown_watcher_.StopWatching(); |
| 314 Context::OnChannelError(); | 314 Context::OnChannelError(); |
| 315 } | 315 } |
| 316 | 316 |
| 317 void SyncChannel::SyncContext::OnChannelOpened() { | 317 void SyncChannel::SyncContext::OnChannelOpened() { |
| 318 shutdown_watcher_.StartWatching(shutdown_event_, this); | 318 shutdown_watcher_.StartWatching(shutdown_event_, this); |
| 319 Context::OnChannelOpened(); | 319 Context::OnChannelOpened(); |
| 320 } | 320 } |
| 321 | 321 |
| 322 void SyncChannel::SyncContext::OnChannelClosed() { | 322 void SyncChannel::SyncContext::OnChannelClosed() { |
| 323 CancelPendingSends(); |
| 323 shutdown_watcher_.StopWatching(); | 324 shutdown_watcher_.StopWatching(); |
| 324 Context::OnChannelClosed(); | 325 Context::OnChannelClosed(); |
| 325 } | 326 } |
| 326 | 327 |
| 327 void SyncChannel::SyncContext::OnSendTimeout(int message_id) { | 328 void SyncChannel::SyncContext::OnSendTimeout(int message_id) { |
| 328 AutoLock auto_lock(deserializers_lock_); | 329 AutoLock auto_lock(deserializers_lock_); |
| 329 PendingSyncMessageQueue::iterator iter; | 330 PendingSyncMessageQueue::iterator iter; |
| 330 for (iter = deserializers_.begin(); iter != deserializers_.end(); iter++) { | 331 for (iter = deserializers_.begin(); iter != deserializers_.end(); iter++) { |
| 331 if (iter->id == message_id) { | 332 if (iter->id == message_id) { |
| 332 iter->done_event->Signal(); | 333 iter->done_event->Signal(); |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 484 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { | 485 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { |
| 485 DCHECK(event == sync_context()->GetDispatchEvent()); | 486 DCHECK(event == sync_context()->GetDispatchEvent()); |
| 486 // The call to DispatchMessages might delete this object, so reregister | 487 // The call to DispatchMessages might delete this object, so reregister |
| 487 // the object watcher first. | 488 // the object watcher first. |
| 488 event->Reset(); | 489 event->Reset(); |
| 489 dispatch_watcher_.StartWatching(event, this); | 490 dispatch_watcher_.StartWatching(event, this); |
| 490 sync_context()->DispatchMessages(); | 491 sync_context()->DispatchMessages(); |
| 491 } | 492 } |
| 492 | 493 |
| 493 } // namespace IPC | 494 } // namespace IPC |
| OLD | NEW |