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

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: Addressed comments Created 6 years, 5 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::GetPipeHandle() const {
1058 return ChannelHandle(pipe_name_, base::FileDescriptor(pipe_, false));
1059 }
1060
1053 //------------------------------------------------------------------------------ 1061 //------------------------------------------------------------------------------
1054 // Channel's methods 1062 // Channel's methods
1055 1063
1056 // static 1064 // static
1057 scoped_ptr<Channel> Channel::Create( 1065 scoped_ptr<Channel> Channel::Create(
1058 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) { 1066 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) {
1059 return make_scoped_ptr(new ChannelPosix( 1067 return make_scoped_ptr(new ChannelPosix(
1060 channel_handle, mode, listener)).PassAs<Channel>(); 1068 channel_handle, mode, listener)).PassAs<Channel>();
1061 } 1069 }
1062 1070
(...skipping 16 matching lines...) Expand all
1079 } 1087 }
1080 1088
1081 #if defined(OS_LINUX) 1089 #if defined(OS_LINUX)
1082 // static 1090 // static
1083 void Channel::SetGlobalPid(int pid) { 1091 void Channel::SetGlobalPid(int pid) {
1084 ChannelPosix::SetGlobalPid(pid); 1092 ChannelPosix::SetGlobalPid(pid);
1085 } 1093 }
1086 #endif // OS_LINUX 1094 #endif // OS_LINUX
1087 1095
1088 } // namespace IPC 1096 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698