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 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
393 | 393 |
394 void SyncChannel::SetRestrictDispatchToSameChannel(bool value) { | 394 void SyncChannel::SetRestrictDispatchToSameChannel(bool value) { |
395 sync_context()->set_restrict_dispatch(value); | 395 sync_context()->set_restrict_dispatch(value); |
396 } | 396 } |
397 | 397 |
398 bool SyncChannel::Send(Message* message) { | 398 bool SyncChannel::Send(Message* message) { |
399 return SendWithTimeout(message, base::kNoTimeout); | 399 return SendWithTimeout(message, base::kNoTimeout); |
400 } | 400 } |
401 | 401 |
402 bool SyncChannel::SendWithTimeout(Message* message, int timeout_ms) { | 402 bool SyncChannel::SendWithTimeout(Message* message, int timeout_ms) { |
403 if (outgoing_message_filter()) | |
jam
2011/05/02 20:06:11
this should be done in ChannelProxy::Send
| |
404 message = outgoing_message_filter()->Rewrite(message); | |
405 | |
403 if (!message->is_sync()) { | 406 if (!message->is_sync()) { |
404 ChannelProxy::Send(message); | 407 ChannelProxy::Send(message); |
405 return true; | 408 return true; |
406 } | 409 } |
407 | 410 |
408 // *this* might get deleted in WaitForReply. | 411 // *this* might get deleted in WaitForReply. |
409 scoped_refptr<SyncContext> context(sync_context()); | 412 scoped_refptr<SyncContext> context(sync_context()); |
410 if (context->shutdown_event()->IsSignaled()) { | 413 if (context->shutdown_event()->IsSignaled()) { |
411 delete message; | 414 delete message; |
412 return false; | 415 return false; |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
503 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { | 506 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { |
504 DCHECK(event == sync_context()->GetDispatchEvent()); | 507 DCHECK(event == sync_context()->GetDispatchEvent()); |
505 // The call to DispatchMessages might delete this object, so reregister | 508 // The call to DispatchMessages might delete this object, so reregister |
506 // the object watcher first. | 509 // the object watcher first. |
507 event->Reset(); | 510 event->Reset(); |
508 dispatch_watcher_.StartWatching(event, this); | 511 dispatch_watcher_.StartWatching(event, this); |
509 sync_context()->DispatchMessages(); | 512 sync_context()->DispatchMessages(); |
510 } | 513 } |
511 | 514 |
512 } // namespace IPC | 515 } // namespace IPC |
OLD | NEW |