OLD | NEW |
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 #include "ipc/ipc_sync_channel.h" | 5 #include "ipc/ipc_sync_channel.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 } | 316 } |
317 | 317 |
318 bool SyncChannel::SyncContext::OnMessageReceived(const Message& msg) { | 318 bool SyncChannel::SyncContext::OnMessageReceived(const Message& msg) { |
319 // Give the filters a chance at processing this message. | 319 // Give the filters a chance at processing this message. |
320 if (TryFilters(msg)) | 320 if (TryFilters(msg)) |
321 return true; | 321 return true; |
322 | 322 |
323 if (TryToUnblockListener(&msg)) | 323 if (TryToUnblockListener(&msg)) |
324 return true; | 324 return true; |
325 | 325 |
| 326 if (msg.is_reply()) { |
| 327 received_sync_msgs_->QueueReply(msg, this); |
| 328 return true; |
| 329 } |
| 330 |
326 if (msg.should_unblock()) { | 331 if (msg.should_unblock()) { |
327 received_sync_msgs_->QueueMessage(msg, this); | 332 received_sync_msgs_->QueueMessage(msg, this); |
328 return true; | 333 return true; |
329 } | 334 } |
330 | 335 |
331 if (msg.is_reply()) { | |
332 received_sync_msgs_->QueueReply(msg, this); | |
333 return true; | |
334 } | |
335 | |
336 return Context::OnMessageReceivedNoFilter(msg); | 336 return Context::OnMessageReceivedNoFilter(msg); |
337 } | 337 } |
338 | 338 |
339 void SyncChannel::SyncContext::OnChannelError() { | 339 void SyncChannel::SyncContext::OnChannelError() { |
340 CancelPendingSends(); | 340 CancelPendingSends(); |
341 shutdown_watcher_.StopWatching(); | 341 shutdown_watcher_.StopWatching(); |
342 Context::OnChannelError(); | 342 Context::OnChannelError(); |
343 } | 343 } |
344 | 344 |
345 void SyncChannel::SyncContext::OnChannelOpened() { | 345 void SyncChannel::SyncContext::OnChannelOpened() { |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
532 // Ideally we only want to watch this object when running a nested message | 532 // Ideally we only want to watch this object when running a nested message |
533 // loop. However, we don't know when it exits if there's another nested | 533 // loop. However, we don't know when it exits if there's another nested |
534 // message loop running under it or not, so we wouldn't know whether to | 534 // message loop running under it or not, so we wouldn't know whether to |
535 // stop or keep watching. So we always watch it, and create the event as | 535 // stop or keep watching. So we always watch it, and create the event as |
536 // manual reset since the object watcher might otherwise reset the event | 536 // manual reset since the object watcher might otherwise reset the event |
537 // when we're doing a WaitMany. | 537 // when we're doing a WaitMany. |
538 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), this); | 538 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), this); |
539 } | 539 } |
540 | 540 |
541 } // namespace IPC | 541 } // namespace IPC |
OLD | NEW |