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

Side by Side Diff: ipc/ipc_channel_posix.cc

Issue 382333002: Introduce ChannelMojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
OLDNEW
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 <sys/socket.h> 10 #include <sys/socket.h>
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 } else { 740 } else {
741 Close(); 741 Close();
742 if (AcceptsConnections()) { 742 if (AcceptsConnections()) {
743 listener()->OnChannelListenError(); 743 listener()->OnChannelListenError();
744 } else { 744 } else {
745 listener()->OnChannelError(); 745 listener()->OnChannelError();
746 } 746 }
747 } 747 }
748 } 748 }
749 749
750 int ChannelPosix::GetHelloMessageProcId() { 750 int ChannelPosix::GetHelloMessageProcId() const {
751 int pid = base::GetCurrentProcId(); 751 int pid = base::GetCurrentProcId();
752 #if defined(OS_LINUX) 752 #if defined(OS_LINUX)
753 // Our process may be in a sandbox with a separate PID namespace. 753 // Our process may be in a sandbox with a separate PID namespace.
754 if (global_pid_) { 754 if (global_pid_) {
755 pid = global_pid_; 755 pid = global_pid_;
756 } 756 }
757 #endif 757 #endif
758 return pid; 758 return pid;
759 } 759 }
760 760
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 server_listen_connection_watcher_.StopWatchingFileDescriptor(); 1043 server_listen_connection_watcher_.StopWatchingFileDescriptor();
1044 } 1044 }
1045 1045
1046 CloseClientFileDescriptor(); 1046 CloseClientFileDescriptor();
1047 } 1047 }
1048 1048
1049 base::ProcessId ChannelPosix::GetPeerPID() const { 1049 base::ProcessId ChannelPosix::GetPeerPID() const {
1050 return peer_pid_; 1050 return peer_pid_;
1051 } 1051 }
1052 1052
1053 base::ProcessId ChannelPosix::GetSelfPID() const {
1054 return GetHelloMessageProcId();
1055 }
1056
1057 ChannelHandle ChannelPosix::TakePipeHandle() {
1058 ChannelHandle handle = ChannelHandle(pipe_name_,
1059 base::FileDescriptor(pipe_, false));
1060 pipe_ = -1;
1061 return handle;
1062 }
1063
1053 //------------------------------------------------------------------------------ 1064 //------------------------------------------------------------------------------
1054 // Channel's methods 1065 // Channel's methods
1055 1066
1056 // static 1067 // static
1057 scoped_ptr<Channel> Channel::Create( 1068 scoped_ptr<Channel> Channel::Create(
1058 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) { 1069 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) {
1059 return make_scoped_ptr(new ChannelPosix( 1070 return make_scoped_ptr(new ChannelPosix(
1060 channel_handle, mode, listener)).PassAs<Channel>(); 1071 channel_handle, mode, listener)).PassAs<Channel>();
1061 } 1072 }
1062 1073
(...skipping 16 matching lines...) Expand all
1079 } 1090 }
1080 1091
1081 #if defined(OS_LINUX) 1092 #if defined(OS_LINUX)
1082 // static 1093 // static
1083 void Channel::SetGlobalPid(int pid) { 1094 void Channel::SetGlobalPid(int pid) {
1084 ChannelPosix::SetGlobalPid(pid); 1095 ChannelPosix::SetGlobalPid(pid);
1085 } 1096 }
1086 #endif // OS_LINUX 1097 #endif // OS_LINUX
1087 1098
1088 } // namespace IPC 1099 } // namespace IPC
OLDNEW
« ipc/ipc_channel.h ('K') | « ipc/ipc_channel_posix.h ('k') | ipc/ipc_channel_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698