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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 | 535 |
536 SyncChannel::~SyncChannel() { | 536 SyncChannel::~SyncChannel() { |
537 } | 537 } |
538 | 538 |
539 void SyncChannel::SetRestrictDispatchChannelGroup(int group) { | 539 void SyncChannel::SetRestrictDispatchChannelGroup(int group) { |
540 sync_context()->set_restrict_dispatch_group(group); | 540 sync_context()->set_restrict_dispatch_group(group); |
541 } | 541 } |
542 | 542 |
543 scoped_refptr<SyncMessageFilter> SyncChannel::CreateSyncMessageFilter() { | 543 scoped_refptr<SyncMessageFilter> SyncChannel::CreateSyncMessageFilter() { |
544 scoped_refptr<SyncMessageFilter> filter = new SyncMessageFilter( | 544 scoped_refptr<SyncMessageFilter> filter = new SyncMessageFilter( |
545 sync_context()->shutdown_event(), | 545 sync_context()->shutdown_event()); |
546 sync_context()->IsChannelSendThreadSafe()); | |
547 AddFilter(filter.get()); | 546 AddFilter(filter.get()); |
548 if (!did_init()) | 547 if (!did_init()) |
549 pre_init_sync_message_filters_.push_back(filter); | 548 pre_init_sync_message_filters_.push_back(filter); |
550 return filter; | 549 return filter; |
551 } | 550 } |
552 | 551 |
553 bool SyncChannel::Send(Message* message) { | 552 bool SyncChannel::Send(Message* message) { |
554 #ifdef IPC_MESSAGE_LOG_ENABLED | 553 #ifdef IPC_MESSAGE_LOG_ENABLED |
555 std::string name; | 554 std::string name; |
556 Logging::GetInstance()->GetMessageText( | 555 Logging::GetInstance()->GetMessageText( |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
692 // messages once the listener thread is unblocked and pumping its task queue. | 691 // messages once the listener thread is unblocked and pumping its task queue. |
693 // The ReceivedSyncMsgQueue also watches this event and may dispatch | 692 // The ReceivedSyncMsgQueue also watches this event and may dispatch |
694 // immediately if woken up by a message which it's allowed to dispatch. | 693 // immediately if woken up by a message which it's allowed to dispatch. |
695 dispatch_watcher_.Start(sync_context()->GetDispatchEvent()->GetHandle(), | 694 dispatch_watcher_.Start(sync_context()->GetDispatchEvent()->GetHandle(), |
696 MOJO_HANDLE_SIGNAL_READABLE, | 695 MOJO_HANDLE_SIGNAL_READABLE, |
697 base::Bind(&SyncChannel::OnDispatchHandleReady, | 696 base::Bind(&SyncChannel::OnDispatchHandleReady, |
698 base::Unretained(this))); | 697 base::Unretained(this))); |
699 } | 698 } |
700 | 699 |
701 void SyncChannel::OnChannelInit() { | 700 void SyncChannel::OnChannelInit() { |
702 for (const auto& filter : pre_init_sync_message_filters_) { | |
703 filter->set_is_channel_send_thread_safe( | |
704 context()->IsChannelSendThreadSafe()); | |
705 } | |
706 pre_init_sync_message_filters_.clear(); | 701 pre_init_sync_message_filters_.clear(); |
707 } | 702 } |
708 | 703 |
709 } // namespace IPC | 704 } // namespace IPC |
OLD | NEW |