| 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 <stdint.h> | 10 #include <stdint.h> |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 } | 1013 } |
| 1014 } | 1014 } |
| 1015 | 1015 |
| 1016 //------------------------------------------------------------------------------ | 1016 //------------------------------------------------------------------------------ |
| 1017 // Channel's methods | 1017 // Channel's methods |
| 1018 | 1018 |
| 1019 // static | 1019 // static |
| 1020 scoped_ptr<Channel> Channel::Create(const IPC::ChannelHandle& channel_handle, | 1020 scoped_ptr<Channel> Channel::Create(const IPC::ChannelHandle& channel_handle, |
| 1021 Mode mode, | 1021 Mode mode, |
| 1022 Listener* listener) { | 1022 Listener* listener) { |
| 1023 return make_scoped_ptr( | 1023 return make_scoped_ptr(new ChannelPosix(channel_handle, mode, listener)); |
| 1024 new ChannelPosix(channel_handle, mode, listener)); | |
| 1025 } | 1024 } |
| 1026 | 1025 |
| 1027 // static | 1026 // static |
| 1028 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { | 1027 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { |
| 1029 // A random name is sufficient validation on posix systems, so we don't need | 1028 // A random name is sufficient validation on posix systems, so we don't need |
| 1030 // an additional shared secret. | 1029 // an additional shared secret. |
| 1031 | 1030 |
| 1032 std::string id = prefix; | 1031 std::string id = prefix; |
| 1033 if (!id.empty()) | 1032 if (!id.empty()) |
| 1034 id.append("."); | 1033 id.append("."); |
| 1035 | 1034 |
| 1036 return id.append(GenerateUniqueRandomChannelID()); | 1035 return id.append(GenerateUniqueRandomChannelID()); |
| 1037 } | 1036 } |
| 1038 | 1037 |
| 1039 bool Channel::IsNamedServerInitialized( | 1038 bool Channel::IsNamedServerInitialized( |
| 1040 const std::string& channel_id) { | 1039 const std::string& channel_id) { |
| 1041 return ChannelPosix::IsNamedServerInitialized(channel_id); | 1040 return ChannelPosix::IsNamedServerInitialized(channel_id); |
| 1042 } | 1041 } |
| 1043 | 1042 |
| 1044 #if defined(OS_LINUX) | 1043 #if defined(OS_LINUX) |
| 1045 // static | 1044 // static |
| 1046 void Channel::SetGlobalPid(int pid) { | 1045 void Channel::SetGlobalPid(int pid) { |
| 1047 ChannelPosix::SetGlobalPid(pid); | 1046 ChannelPosix::SetGlobalPid(pid); |
| 1048 } | 1047 } |
| 1049 #endif // OS_LINUX | 1048 #endif // OS_LINUX |
| 1050 | 1049 |
| 1051 } // namespace IPC | 1050 } // namespace IPC |
| OLD | NEW |