| 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 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 691 } | 691 } |
| 692 | 692 |
| 693 void SyncChannel::OnChannelInit() { | 693 void SyncChannel::OnChannelInit() { |
| 694 for (const auto& filter : pre_init_sync_message_filters_) { | 694 for (const auto& filter : pre_init_sync_message_filters_) { |
| 695 filter->set_is_channel_send_thread_safe( | 695 filter->set_is_channel_send_thread_safe( |
| 696 context()->IsChannelSendThreadSafe()); | 696 context()->IsChannelSendThreadSafe()); |
| 697 } | 697 } |
| 698 pre_init_sync_message_filters_.clear(); | 698 pre_init_sync_message_filters_.clear(); |
| 699 } | 699 } |
| 700 | 700 |
| 701 bool SyncChannel::SendNow(std::unique_ptr<Message> message) { | |
| 702 #ifdef IPC_MESSAGE_LOG_ENABLED | |
| 703 std::string name; | |
| 704 Logging::GetInstance()->GetMessageText( | |
| 705 message->type(), &name, message.get(), nullptr); | |
| 706 TRACE_EVENT1("ipc", "SyncChannel::SendNow", "name", name); | |
| 707 #else | |
| 708 TRACE_EVENT2("ipc", "SyncChannel::SendNow", | |
| 709 "class", IPC_MESSAGE_ID_CLASS(message->type()), | |
| 710 "line", IPC_MESSAGE_ID_LINE(message->type())); | |
| 711 #endif | |
| 712 if (!message->is_sync()) | |
| 713 return ChannelProxy::SendNow(std::move(message)); | |
| 714 return Send(message.release()); | |
| 715 } | |
| 716 | |
| 717 bool SyncChannel::SendOnIPCThread(std::unique_ptr<Message> message) { | |
| 718 #ifdef IPC_MESSAGE_LOG_ENABLED | |
| 719 std::string name; | |
| 720 Logging::GetInstance()->GetMessageText( | |
| 721 message->type(), &name, message.get(), nullptr); | |
| 722 TRACE_EVENT1("ipc", "SyncChannel::SendOnIPCThread", "name", name); | |
| 723 #else | |
| 724 TRACE_EVENT2("ipc", "SyncChannel::SendOnIPCThread", | |
| 725 "class", IPC_MESSAGE_ID_CLASS(message->type()), | |
| 726 "line", IPC_MESSAGE_ID_LINE(message->type())); | |
| 727 #endif | |
| 728 if (!message->is_sync()) | |
| 729 return ChannelProxy::SendOnIPCThread(std::move(message)); | |
| 730 return Send(message.release()); | |
| 731 } | |
| 732 | |
| 733 } // namespace IPC | 701 } // namespace IPC |
| OLD | NEW |