OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "third_party/mojo/src/mojo/edk/embedder/platform_channel_utils_posix.h" | 5 #include "mojo/edk/embedder/platform_channel_utils_posix.h" |
6 | 6 |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <sys/uio.h> | 8 #include <sys/uio.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/posix/eintr_wrapper.h" | 12 #include "base/posix/eintr_wrapper.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace embedder { | 16 namespace edk { |
17 | 17 |
18 // On Linux, |SIGPIPE| is suppressed by passing |MSG_NOSIGNAL| to | 18 // On Linux, |SIGPIPE| is suppressed by passing |MSG_NOSIGNAL| to |
19 // |send()|/|sendmsg()|. (There is no way of suppressing |SIGPIPE| on | 19 // |send()|/|sendmsg()|. (There is no way of suppressing |SIGPIPE| on |
20 // |write()|/|writev().) On Mac, |SIGPIPE| is suppressed by setting the | 20 // |write()|/|writev().) On Mac, |SIGPIPE| is suppressed by setting the |
21 // |SO_NOSIGPIPE| option on the socket. | 21 // |SO_NOSIGPIPE| option on the socket. |
22 // | 22 // |
23 // Performance notes: | 23 // Performance notes: |
24 // - On Linux, we have to use |send()|/|sendmsg()| rather than | 24 // - On Linux, we have to use |send()|/|sendmsg()| rather than |
25 // |write()|/|writev()| in order to suppress |SIGPIPE|. This is okay, since | 25 // |write()|/|writev()| in order to suppress |SIGPIPE|. This is okay, since |
26 // |send()| is (slightly) faster than |write()| (!), while |sendmsg()| is | 26 // |send()| is (slightly) faster than |write()| (!), while |sendmsg()| is |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 for (size_t i = 0; i < num_fds; i++) { | 175 for (size_t i = 0; i < num_fds; i++) { |
176 platform_handles->push_back(PlatformHandle(fds[i])); | 176 platform_handles->push_back(PlatformHandle(fds[i])); |
177 DCHECK(platform_handles->back().is_valid()); | 177 DCHECK(platform_handles->back().is_valid()); |
178 } | 178 } |
179 } | 179 } |
180 } | 180 } |
181 | 181 |
182 return result; | 182 return result; |
183 } | 183 } |
184 | 184 |
185 } // namespace embedder | 185 } // namespace edk |
186 } // namespace mojo | 186 } // namespace mojo |
OLD | NEW |