| 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 #ifndef IPC_IPC_CHANNEL_H_ | 5 #ifndef IPC_IPC_CHANNEL_H_ |
| 6 #define IPC_IPC_CHANNEL_H_ | 6 #define IPC_IPC_CHANNEL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #if defined(OS_POSIX) | 10 #if defined(OS_POSIX) |
| 11 #include <sys/types.h> | 11 #include <sys/types.h> |
| 12 #endif | 12 #endif |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/files/scoped_file.h" |
| 15 #include "base/process/process.h" | 16 #include "base/process/process.h" |
| 16 #include "ipc/ipc_channel_handle.h" | 17 #include "ipc/ipc_channel_handle.h" |
| 17 #include "ipc/ipc_message.h" | 18 #include "ipc/ipc_message.h" |
| 18 #include "ipc/ipc_sender.h" | 19 #include "ipc/ipc_sender.h" |
| 19 | 20 |
| 20 namespace IPC { | 21 namespace IPC { |
| 21 | 22 |
| 22 class Listener; | 23 class Listener; |
| 23 | 24 |
| 24 //------------------------------------------------------------------------------ | 25 //------------------------------------------------------------------------------ |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 #if defined(OS_POSIX) && !defined(OS_NACL) | 183 #if defined(OS_POSIX) && !defined(OS_NACL) |
| 183 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the | 184 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the |
| 184 // FD # for the client end of the socket. | 185 // FD # for the client end of the socket. |
| 185 // This method may only be called on the server side of a channel. | 186 // This method may only be called on the server side of a channel. |
| 186 // This method can be called on any thread. | 187 // This method can be called on any thread. |
| 187 virtual int GetClientFileDescriptor() const = 0; | 188 virtual int GetClientFileDescriptor() const = 0; |
| 188 | 189 |
| 189 // Same as GetClientFileDescriptor, but transfers the ownership of the | 190 // Same as GetClientFileDescriptor, but transfers the ownership of the |
| 190 // file descriptor to the caller. | 191 // file descriptor to the caller. |
| 191 // This method can be called on any thread. | 192 // This method can be called on any thread. |
| 192 virtual int TakeClientFileDescriptor() = 0; | 193 virtual base::ScopedFD TakeClientFileDescriptor() = 0; |
| 193 #endif // defined(OS_POSIX) && !defined(OS_NACL) | 194 #endif // defined(OS_POSIX) && !defined(OS_NACL) |
| 194 | 195 |
| 195 // Returns true if a named server channel is initialized on the given channel | 196 // Returns true if a named server channel is initialized on the given channel |
| 196 // ID. Even if true, the server may have already accepted a connection. | 197 // ID. Even if true, the server may have already accepted a connection. |
| 197 static bool IsNamedServerInitialized(const std::string& channel_id); | 198 static bool IsNamedServerInitialized(const std::string& channel_id); |
| 198 | 199 |
| 199 #if !defined(OS_NACL) | 200 #if !defined(OS_NACL) |
| 200 // Generates a channel ID that's non-predictable and unique. | 201 // Generates a channel ID that's non-predictable and unique. |
| 201 static std::string GenerateUniqueRandomChannelID(); | 202 static std::string GenerateUniqueRandomChannelID(); |
| 202 | 203 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 226 | 227 |
| 227 #if defined(OS_POSIX) | 228 #if defined(OS_POSIX) |
| 228 // SocketPair() creates a pair of socket FDs suitable for using with | 229 // SocketPair() creates a pair of socket FDs suitable for using with |
| 229 // IPC::Channel. | 230 // IPC::Channel. |
| 230 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 231 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 231 #endif | 232 #endif |
| 232 | 233 |
| 233 } // namespace IPC | 234 } // namespace IPC |
| 234 | 235 |
| 235 #endif // IPC_IPC_CHANNEL_H_ | 236 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |