| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_POSIX_H_ | 5 #ifndef IPC_IPC_CHANNEL_POSIX_H_ |
| 6 #define IPC_IPC_CHANNEL_POSIX_H_ | 6 #define IPC_IPC_CHANNEL_POSIX_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 class Channel::ChannelImpl : public MessageLoopForIO::Watcher { | 50 class Channel::ChannelImpl : public MessageLoopForIO::Watcher { |
| 51 public: | 51 public: |
| 52 // Mirror methods of Channel, see ipc_channel.h for description. | 52 // Mirror methods of Channel, see ipc_channel.h for description. |
| 53 ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode, | 53 ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode, |
| 54 Listener* listener); | 54 Listener* listener); |
| 55 virtual ~ChannelImpl(); | 55 virtual ~ChannelImpl(); |
| 56 bool Connect(); | 56 bool Connect(); |
| 57 void Close(); | 57 void Close(); |
| 58 void set_listener(Listener* listener) { listener_ = listener; } | 58 void set_listener(Listener* listener) { listener_ = listener; } |
| 59 bool Send(Message* message); | 59 bool Send(Message* message); |
| 60 int GetClientFileDescriptor() const; | 60 int GetClientFileDescriptor(); |
| 61 int TakeClientFileDescriptor(); |
| 62 void CloseClientFileDescriptor(); |
| 61 bool AcceptsConnections() const; | 63 bool AcceptsConnections() const; |
| 62 bool HasAcceptedConnection() const; | 64 bool HasAcceptedConnection() const; |
| 63 bool GetClientEuid(uid_t* client_euid) const; | 65 bool GetClientEuid(uid_t* client_euid) const; |
| 64 void ResetToAcceptingConnectionState(); | 66 void ResetToAcceptingConnectionState(); |
| 65 static bool IsNamedServerInitialized(const std::string& channel_id); | 67 static bool IsNamedServerInitialized(const std::string& channel_id); |
| 66 #if defined(OS_LINUX) | 68 #if defined(OS_LINUX) |
| 67 static void SetGlobalPid(int pid); | 69 static void SetGlobalPid(int pid); |
| 68 #endif // OS_LINUX | 70 #endif // OS_LINUX |
| 69 | 71 |
| 70 private: | 72 private: |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 // File descriptor we're listening on for new connections if we listen | 104 // File descriptor we're listening on for new connections if we listen |
| 103 // for connections. | 105 // for connections. |
| 104 int server_listen_pipe_; | 106 int server_listen_pipe_; |
| 105 | 107 |
| 106 // The pipe used for communication. | 108 // The pipe used for communication. |
| 107 int pipe_; | 109 int pipe_; |
| 108 | 110 |
| 109 // For a server, the client end of our socketpair() -- the other end of our | 111 // For a server, the client end of our socketpair() -- the other end of our |
| 110 // pipe_ that is passed to the client. | 112 // pipe_ that is passed to the client. |
| 111 int client_pipe_; | 113 int client_pipe_; |
| 114 base::Lock client_pipe_lock_; // Lock that protects |client_pipe_|. |
| 112 | 115 |
| 113 #if defined(IPC_USES_READWRITE) | 116 #if defined(IPC_USES_READWRITE) |
| 114 // Linux/BSD use a dedicated socketpair() for passing file descriptors. | 117 // Linux/BSD use a dedicated socketpair() for passing file descriptors. |
| 115 int fd_pipe_; | 118 int fd_pipe_; |
| 116 int remote_fd_pipe_; | 119 int remote_fd_pipe_; |
| 117 #endif | 120 #endif |
| 118 | 121 |
| 119 // The "name" of our pipe. On Windows this is the global identifier for | 122 // The "name" of our pipe. On Windows this is the global identifier for |
| 120 // the pipe. On POSIX it's used as a key in a local map of file descriptors. | 123 // the pipe. On POSIX it's used as a key in a local map of file descriptors. |
| 121 std::string pipe_name_; | 124 std::string pipe_name_; |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 163 |
| 161 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or | 164 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or |
| 162 // MODE_NAMED_CLIENT if you want to pass in your own socket. | 165 // MODE_NAMED_CLIENT if you want to pass in your own socket. |
| 163 // The standard size on linux is 108, mac is 104. To maintain consistency | 166 // The standard size on linux is 108, mac is 104. To maintain consistency |
| 164 // across platforms we standardize on the smaller value. | 167 // across platforms we standardize on the smaller value. |
| 165 static const size_t kMaxPipeNameLength = 104; | 168 static const size_t kMaxPipeNameLength = 104; |
| 166 | 169 |
| 167 } // namespace IPC | 170 } // namespace IPC |
| 168 | 171 |
| 169 #endif // IPC_IPC_CHANNEL_POSIX_H_ | 172 #endif // IPC_IPC_CHANNEL_POSIX_H_ |
| OLD | NEW |