Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: mojo/edk/embedder/platform_channel_pair_posix.cc

Issue 728043002: Revert of Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "mojo/edk/embedder/platform_channel_pair.h" 5 #include "mojo/edk/embedder/platform_channel_pair.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 #include <sys/socket.h> 8 #include <sys/socket.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 28 matching lines...) Expand all
39 // TODO(vtl): Maybe fail gracefully if |socketpair()| fails. 39 // TODO(vtl): Maybe fail gracefully if |socketpair()| fails.
40 PCHECK(socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0); 40 PCHECK(socketpair(AF_UNIX, SOCK_STREAM, 0, fds) == 0);
41 PCHECK(fcntl(fds[0], F_SETFL, O_NONBLOCK) == 0); 41 PCHECK(fcntl(fds[0], F_SETFL, O_NONBLOCK) == 0);
42 PCHECK(fcntl(fds[1], F_SETFL, O_NONBLOCK) == 0); 42 PCHECK(fcntl(fds[1], F_SETFL, O_NONBLOCK) == 0);
43 43
44 #if defined(OS_MACOSX) 44 #if defined(OS_MACOSX)
45 // This turns off |SIGPIPE| when writing to a closed socket (causing it to 45 // This turns off |SIGPIPE| when writing to a closed socket (causing it to
46 // fail with |EPIPE| instead). On Linux, we have to use |send...()| with 46 // fail with |EPIPE| instead). On Linux, we have to use |send...()| with
47 // |MSG_NOSIGNAL| -- which is not supported on Mac -- instead. 47 // |MSG_NOSIGNAL| -- which is not supported on Mac -- instead.
48 int no_sigpipe = 1; 48 int no_sigpipe = 1;
49 PCHECK(setsockopt(fds[0], SOL_SOCKET, SO_NOSIGPIPE, &no_sigpipe, 49 PCHECK(
50 sizeof(no_sigpipe)) == 0); 50 setsockopt(
51 PCHECK(setsockopt(fds[1], SOL_SOCKET, SO_NOSIGPIPE, &no_sigpipe, 51 fds[0], SOL_SOCKET, SO_NOSIGPIPE, &no_sigpipe, sizeof(no_sigpipe)) ==
52 sizeof(no_sigpipe)) == 0); 52 0);
53 PCHECK(
54 setsockopt(
55 fds[1], SOL_SOCKET, SO_NOSIGPIPE, &no_sigpipe, sizeof(no_sigpipe)) ==
56 0);
53 #endif // defined(OS_MACOSX) 57 #endif // defined(OS_MACOSX)
54 58
55 server_handle_.reset(PlatformHandle(fds[0])); 59 server_handle_.reset(PlatformHandle(fds[0]));
56 DCHECK(server_handle_.is_valid()); 60 DCHECK(server_handle_.is_valid());
57 client_handle_.reset(PlatformHandle(fds[1])); 61 client_handle_.reset(PlatformHandle(fds[1]));
58 DCHECK(client_handle_.is_valid()); 62 DCHECK(client_handle_.is_valid());
59 } 63 }
60 64
61 // static 65 // static
62 ScopedPlatformHandle PlatformChannelPair::PassClientHandleFromParentProcess( 66 ScopedPlatformHandle PlatformChannelPair::PassClientHandleFromParentProcess(
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 << kMojoPlatformChannelHandleSwitch << "=" 106 << kMojoPlatformChannelHandleSwitch << "="
103 << command_line->GetSwitchValueASCII(kMojoPlatformChannelHandleSwitch); 107 << command_line->GetSwitchValueASCII(kMojoPlatformChannelHandleSwitch);
104 // (Any existing switch won't actually be removed from the command line, but 108 // (Any existing switch won't actually be removed from the command line, but
105 // the last one appended takes precedence.) 109 // the last one appended takes precedence.)
106 command_line->AppendSwitchASCII(kMojoPlatformChannelHandleSwitch, 110 command_line->AppendSwitchASCII(kMojoPlatformChannelHandleSwitch,
107 base::IntToString(target_fd)); 111 base::IntToString(target_fd));
108 } 112 }
109 113
110 } // namespace embedder 114 } // namespace embedder
111 } // namespace mojo 115 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/embedder/entrypoints.cc ('k') | mojo/edk/embedder/platform_channel_pair_posix_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698