| 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 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 return true; | 279 return true; |
| 280 } | 280 } |
| 281 | 281 |
| 282 void SyncChannel::SyncContext::Clear() { | 282 void SyncChannel::SyncContext::Clear() { |
| 283 CancelPendingSends(); | 283 CancelPendingSends(); |
| 284 received_sync_msgs_->RemoveContext(this); | 284 received_sync_msgs_->RemoveContext(this); |
| 285 Context::Clear(); | 285 Context::Clear(); |
| 286 } | 286 } |
| 287 | 287 |
| 288 void SyncChannel::SyncContext::OnMessageReceived(const Message& msg) { | 288 bool SyncChannel::SyncContext::OnMessageReceived(const Message& msg) { |
| 289 // Give the filters a chance at processing this message. | 289 // Give the filters a chance at processing this message. |
| 290 if (TryFilters(msg)) | 290 if (TryFilters(msg)) |
| 291 return; | 291 return true; |
| 292 | 292 |
| 293 if (TryToUnblockListener(&msg)) | 293 if (TryToUnblockListener(&msg)) |
| 294 return; | 294 return true; |
| 295 | 295 |
| 296 if (msg.should_unblock()) { | 296 if (msg.should_unblock()) { |
| 297 received_sync_msgs_->QueueMessage(msg, this); | 297 received_sync_msgs_->QueueMessage(msg, this); |
| 298 return; | 298 return true; |
| 299 } | 299 } |
| 300 | 300 |
| 301 if (msg.is_reply()) { | 301 if (msg.is_reply()) { |
| 302 received_sync_msgs_->QueueReply(msg, this); | 302 received_sync_msgs_->QueueReply(msg, this); |
| 303 return; | 303 return true; |
| 304 } | 304 } |
| 305 | 305 |
| 306 return Context::OnMessageReceivedNoFilter(msg); | 306 return Context::OnMessageReceivedNoFilter(msg); |
| 307 } | 307 } |
| 308 | 308 |
| 309 void SyncChannel::SyncContext::OnChannelError() { | 309 void SyncChannel::SyncContext::OnChannelError() { |
| 310 CancelPendingSends(); | 310 CancelPendingSends(); |
| 311 shutdown_watcher_.StopWatching(); | 311 shutdown_watcher_.StopWatching(); |
| 312 Context::OnChannelError(); | 312 Context::OnChannelError(); |
| 313 } | 313 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { | 485 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { |
| 486 DCHECK(event == sync_context()->GetDispatchEvent()); | 486 DCHECK(event == sync_context()->GetDispatchEvent()); |
| 487 // The call to DispatchMessages might delete this object, so reregister | 487 // The call to DispatchMessages might delete this object, so reregister |
| 488 // the object watcher first. | 488 // the object watcher first. |
| 489 event->Reset(); | 489 event->Reset(); |
| 490 dispatch_watcher_.StartWatching(event, this); | 490 dispatch_watcher_.StartWatching(event, this); |
| 491 sync_context()->DispatchMessages(); | 491 sync_context()->DispatchMessages(); |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace IPC | 494 } // namespace IPC |
| OLD | NEW |