| 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 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1012 DPCHECK(0 == rv); | 1012 DPCHECK(0 == rv); |
| 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 AttachmentBroker* broker) { | |
| 1024 return make_scoped_ptr( | 1023 return make_scoped_ptr( |
| 1025 new ChannelPosix(channel_handle, mode, listener)); | 1024 new ChannelPosix(channel_handle, mode, listener)); |
| 1026 } | 1025 } |
| 1027 | 1026 |
| 1028 // static | 1027 // static |
| 1029 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { | 1028 std::string Channel::GenerateVerifiedChannelID(const std::string& prefix) { |
| 1030 // A random name is sufficient validation on posix systems, so we don't need | 1029 // A random name is sufficient validation on posix systems, so we don't need |
| 1031 // an additional shared secret. | 1030 // an additional shared secret. |
| 1032 | 1031 |
| 1033 std::string id = prefix; | 1032 std::string id = prefix; |
| 1034 if (!id.empty()) | 1033 if (!id.empty()) |
| 1035 id.append("."); | 1034 id.append("."); |
| 1036 | 1035 |
| 1037 return id.append(GenerateUniqueRandomChannelID()); | 1036 return id.append(GenerateUniqueRandomChannelID()); |
| 1038 } | 1037 } |
| 1039 | 1038 |
| 1040 bool Channel::IsNamedServerInitialized( | 1039 bool Channel::IsNamedServerInitialized( |
| 1041 const std::string& channel_id) { | 1040 const std::string& channel_id) { |
| 1042 return ChannelPosix::IsNamedServerInitialized(channel_id); | 1041 return ChannelPosix::IsNamedServerInitialized(channel_id); |
| 1043 } | 1042 } |
| 1044 | 1043 |
| 1045 #if defined(OS_LINUX) | 1044 #if defined(OS_LINUX) |
| 1046 // static | 1045 // static |
| 1047 void Channel::SetGlobalPid(int pid) { | 1046 void Channel::SetGlobalPid(int pid) { |
| 1048 ChannelPosix::SetGlobalPid(pid); | 1047 ChannelPosix::SetGlobalPid(pid); |
| 1049 } | 1048 } |
| 1050 #endif // OS_LINUX | 1049 #endif // OS_LINUX |
| 1051 | 1050 |
| 1052 } // namespace IPC | 1051 } // namespace IPC |
| OLD | NEW |