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_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
11 #include <sys/socket.h> | 11 #include <sys/socket.h> |
12 #include <sys/stat.h> | 12 #include <sys/stat.h> |
13 #include <sys/types.h> | 13 #include <sys/types.h> |
14 #include <unistd.h> | 14 #include <unistd.h> |
15 | 15 |
16 #if defined(OS_OPENBSD) | 16 #if defined(OS_OPENBSD) |
17 #include <sys/uio.h> | 17 #include <sys/uio.h> |
18 #endif | 18 #endif |
19 | 19 |
20 #if !defined(OS_NACL_NONSFI) | 20 #if !defined(OS_NACL_NONSFI) |
21 #include <sys/un.h> | 21 #include <sys/un.h> |
22 #endif | 22 #endif |
23 | 23 |
24 #include <algorithm> | 24 #include <algorithm> |
| 25 #include <iostream> |
25 #include <map> | 26 #include <map> |
26 #include <string> | 27 #include <string> |
27 | 28 |
28 #include "base/command_line.h" | 29 #include "base/command_line.h" |
29 #include "base/files/file_path.h" | 30 #include "base/files/file_path.h" |
30 #include "base/files/file_util.h" | 31 #include "base/files/file_util.h" |
31 #include "base/location.h" | 32 #include "base/location.h" |
32 #include "base/logging.h" | 33 #include "base/logging.h" |
33 #include "base/memory/scoped_ptr.h" | 34 #include "base/memory/scoped_ptr.h" |
34 #include "base/memory/singleton.h" | 35 #include "base/memory/singleton.h" |
35 #include "base/posix/eintr_wrapper.h" | 36 #include "base/posix/eintr_wrapper.h" |
36 #include "base/posix/global_descriptors.h" | 37 #include "base/posix/global_descriptors.h" |
37 #include "base/process/process_handle.h" | 38 #include "base/process/process_handle.h" |
38 #include "base/rand_util.h" | 39 #include "base/rand_util.h" |
39 #include "base/stl_util.h" | 40 #include "base/stl_util.h" |
40 #include "base/strings/string_util.h" | 41 #include "base/strings/string_util.h" |
41 #include "base/synchronization/lock.h" | 42 #include "base/synchronization/lock.h" |
| 43 #include "content/renderer/greenweb_latency_tracking.h" |
42 #include "ipc/attachment_broker.h" | 44 #include "ipc/attachment_broker.h" |
43 #include "ipc/ipc_descriptors.h" | 45 #include "ipc/ipc_descriptors.h" |
44 #include "ipc/ipc_listener.h" | 46 #include "ipc/ipc_listener.h" |
45 #include "ipc/ipc_logging.h" | 47 #include "ipc/ipc_logging.h" |
46 #include "ipc/ipc_message_attachment_set.h" | 48 #include "ipc/ipc_message_attachment_set.h" |
47 #include "ipc/ipc_message_utils.h" | 49 #include "ipc/ipc_message_utils.h" |
48 #include "ipc/ipc_platform_file_attachment_posix.h" | 50 #include "ipc/ipc_platform_file_attachment_posix.h" |
49 #include "ipc/ipc_switches.h" | 51 #include "ipc/ipc_switches.h" |
50 #include "ipc/unix_domain_socket_util.h" | 52 #include "ipc/unix_domain_socket_util.h" |
51 | 53 |
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 delete message; | 706 delete message; |
705 return false; | 707 return false; |
706 } | 708 } |
707 } | 709 } |
708 } | 710 } |
709 | 711 |
710 #ifdef IPC_MESSAGE_LOG_ENABLED | 712 #ifdef IPC_MESSAGE_LOG_ENABLED |
711 Logging::GetInstance()->OnSendMessage(message, ""); | 713 Logging::GetInstance()->OnSendMessage(message, ""); |
712 #endif // IPC_MESSAGE_LOG_ENABLED | 714 #endif // IPC_MESSAGE_LOG_ENABLED |
713 | 715 |
714 TRACE_EVENT_WITH_FLOW0(TRACE_DISABLED_BY_DEFAULT("ipc.flow"), | 716 // Ideally we want to send a dedicated to communicate the qos_type and |
| 717 // ebs_enabled info from the main thread to the GPU thread just once. |
| 718 // As a simple hack, we send them along with each message! The implication |
| 719 // of this simplification is that we need to make sure that we do not |
| 720 // overwrite the values in the main thread when we receive an IPC message |
| 721 // from other processes (see the implementation of |
| 722 // |ChannelReader::EmitLogBeforeDispatch| in ipc_channel_reader.cc). |
| 723 message->set_qos_type(g_qos_type); |
| 724 message->set_qos_target(g_qos_target); |
| 725 message->set_ebs_enabled(g_ebs_enabled); |
| 726 dbg_ipc_cout("Send" << ": g_ebs_enabled: " << g_ebs_enabled << |
| 727 ", g_qos_type: " << g_qos_type << |
| 728 ", g_qos_target" << g_qos_target); |
| 729 |
| 730 TRACE_EVENT_WITH_FLOW1(TRACE_DISABLED_BY_DEFAULT("ipc.flow"), |
715 "ChannelPosix::Send", | 731 "ChannelPosix::Send", |
716 message->flags(), | 732 message->flags(), |
717 TRACE_EVENT_FLAG_FLOW_OUT); | 733 TRACE_EVENT_FLAG_FLOW_OUT, |
| 734 "QoS Type", |
| 735 message->qos_type()); |
718 | 736 |
719 // |output_queue_| takes ownership of |message|. | 737 // |output_queue_| takes ownership of |message|. |
720 OutputElement* element = new OutputElement(message); | 738 OutputElement* element = new OutputElement(message); |
721 output_queue_.push(element); | 739 output_queue_.push(element); |
722 | 740 |
723 if (message->HasBrokerableAttachments()) { | 741 if (message->HasBrokerableAttachments()) { |
724 // |output_queue_| takes ownership of |ids.buffer|. | 742 // |output_queue_| takes ownership of |ids.buffer|. |
725 Message::SerializedAttachmentIds ids = | 743 Message::SerializedAttachmentIds ids = |
726 message->SerializedIdsOfBrokerableAttachments(); | 744 message->SerializedIdsOfBrokerableAttachments(); |
727 output_queue_.push(new OutputElement(ids.buffer, ids.size)); | 745 output_queue_.push(new OutputElement(ids.buffer, ids.size)); |
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1119 } | 1137 } |
1120 | 1138 |
1121 #if defined(OS_LINUX) | 1139 #if defined(OS_LINUX) |
1122 // static | 1140 // static |
1123 void Channel::SetGlobalPid(int pid) { | 1141 void Channel::SetGlobalPid(int pid) { |
1124 ChannelPosix::SetGlobalPid(pid); | 1142 ChannelPosix::SetGlobalPid(pid); |
1125 } | 1143 } |
1126 #endif // OS_LINUX | 1144 #endif // OS_LINUX |
1127 | 1145 |
1128 } // namespace IPC | 1146 } // namespace IPC |
OLD | NEW |