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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 } | 598 } |
599 | 599 |
600 void SyncChannel::OnChannelInit() { | 600 void SyncChannel::OnChannelInit() { |
601 for (const auto& filter : pre_init_sync_message_filters_) { | 601 for (const auto& filter : pre_init_sync_message_filters_) { |
602 filter->set_is_channel_send_thread_safe( | 602 filter->set_is_channel_send_thread_safe( |
603 context()->IsChannelSendThreadSafe()); | 603 context()->IsChannelSendThreadSafe()); |
604 } | 604 } |
605 pre_init_sync_message_filters_.clear(); | 605 pre_init_sync_message_filters_.clear(); |
606 } | 606 } |
607 | 607 |
| 608 bool SyncChannel::SendNow(std::unique_ptr<Message> message) { |
| 609 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 610 std::string name; |
| 611 Logging::GetInstance()->GetMessageText( |
| 612 message->type(), &name, message.get(), nullptr); |
| 613 TRACE_EVENT1("ipc", "SyncChannel::SendNow", "name", name); |
| 614 #else |
| 615 TRACE_EVENT2("ipc", "SyncChannel::SendNow", |
| 616 "class", IPC_MESSAGE_ID_CLASS(message->type()), |
| 617 "line", IPC_MESSAGE_ID_LINE(message->type())); |
| 618 #endif |
| 619 if (!message->is_sync()) |
| 620 return ChannelProxy::SendNow(std::move(message)); |
| 621 return Send(message.release()); |
| 622 } |
| 623 |
| 624 bool SyncChannel::SendOnIPCThread(std::unique_ptr<Message> message) { |
| 625 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 626 std::string name; |
| 627 Logging::GetInstance()->GetMessageText( |
| 628 message->type(), &name, message.get(), nullptr); |
| 629 TRACE_EVENT1("ipc", "SyncChannel::SendOnIPCThread", "name", name); |
| 630 #else |
| 631 TRACE_EVENT2("ipc", "SyncChannel::SendOnIPCThread", |
| 632 "class", IPC_MESSAGE_ID_CLASS(message->type()), |
| 633 "line", IPC_MESSAGE_ID_LINE(message->type())); |
| 634 #endif |
| 635 if (!message->is_sync()) |
| 636 return ChannelProxy::SendOnIPCThread(std::move(message)); |
| 637 return Send(message.release()); |
| 638 } |
| 639 |
608 } // namespace IPC | 640 } // namespace IPC |
OLD | NEW |