| 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 <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1047 base::ProcessId ChannelPosix::GetSelfPID() const { | 1047 base::ProcessId ChannelPosix::GetSelfPID() const { |
| 1048 return GetHelloMessageProcId(); | 1048 return GetHelloMessageProcId(); |
| 1049 } | 1049 } |
| 1050 | 1050 |
| 1051 //------------------------------------------------------------------------------ | 1051 //------------------------------------------------------------------------------ |
| 1052 // Channel's methods | 1052 // Channel's methods |
| 1053 | 1053 |
| 1054 // static | 1054 // static |
| 1055 scoped_ptr<Channel> Channel::Create( | 1055 scoped_ptr<Channel> Channel::Create( |
| 1056 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) { | 1056 const IPC::ChannelHandle &channel_handle, Mode mode, Listener* listener) { |
| 1057 return make_scoped_ptr(new ChannelPosix( | 1057 return make_scoped_ptr(new ChannelPosix(channel_handle, mode, listener)); |
| 1058 channel_handle, mode, listener)).PassAs<Channel>(); | |
| 1059 } | 1058 } |
| 1060 | 1059 |
| 1061 // static | 1060 // static |
| 1062 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { | 1061 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { |
| 1063 // A random name is sufficient validation on posix systems, so we don't need | 1062 // A random name is sufficient validation on posix systems, so we don't need |
| 1064 // an additional shared secret. | 1063 // an additional shared secret. |
| 1065 | 1064 |
| 1066 std::string id = prefix; | 1065 std::string id = prefix; |
| 1067 if (!id.empty()) | 1066 if (!id.empty()) |
| 1068 id.append("."); | 1067 id.append("."); |
| 1069 | 1068 |
| 1070 return id.append(GenerateUniqueRandomChannelID()); | 1069 return id.append(GenerateUniqueRandomChannelID()); |
| 1071 } | 1070 } |
| 1072 | 1071 |
| 1073 | 1072 |
| 1074 bool Channel::IsNamedServerInitialized( | 1073 bool Channel::IsNamedServerInitialized( |
| 1075 const std::string& channel_id) { | 1074 const std::string& channel_id) { |
| 1076 return ChannelPosix::IsNamedServerInitialized(channel_id); | 1075 return ChannelPosix::IsNamedServerInitialized(channel_id); |
| 1077 } | 1076 } |
| 1078 | 1077 |
| 1079 #if defined(OS_LINUX) | 1078 #if defined(OS_LINUX) |
| 1080 // static | 1079 // static |
| 1081 void Channel::SetGlobalPid(int pid) { | 1080 void Channel::SetGlobalPid(int pid) { |
| 1082 ChannelPosix::SetGlobalPid(pid); | 1081 ChannelPosix::SetGlobalPid(pid); |
| 1083 } | 1082 } |
| 1084 #endif // OS_LINUX | 1083 #endif // OS_LINUX |
| 1085 | 1084 |
| 1086 } // namespace IPC | 1085 } // namespace IPC |
| OLD | NEW |