Chromium Code Reviews| 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) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 163 // | 163 // |
| 164 // Returns base::kNullProcessId if the peer is not connected yet. Watch out | 164 // Returns base::kNullProcessId if the peer is not connected yet. Watch out |
| 165 // for race conditions. You can easily get a channel to another process, but | 165 // for race conditions. You can easily get a channel to another process, but |
| 166 // if your process has not yet processed the "hello" message from the remote | 166 // if your process has not yet processed the "hello" message from the remote |
| 167 // side, this will fail. You should either make sure calling this is either | 167 // side, this will fail. You should either make sure calling this is either |
| 168 // in response to a message from the remote side (which guarantees that it's | 168 // in response to a message from the remote side (which guarantees that it's |
| 169 // been connected), or you wait for the "connected" notification on the | 169 // been connected), or you wait for the "connected" notification on the |
| 170 // listener. | 170 // listener. |
| 171 virtual base::ProcessId GetPeerPID() const = 0; | 171 virtual base::ProcessId GetPeerPID() const = 0; |
| 172 | 172 |
| 173 // Get its own process id. This value is told to the peer. | |
| 174 virtual base::ProcessId GetSelfPID() const = 0; | |
| 175 | |
| 176 // Get connected ChannelHandle which the chanenl owns. | |
|
viettrungluu
2014/07/15 16:28:06
chanenl -> channel
Hajime Morrita
2014/07/15 18:46:17
Oops. Done.
| |
| 177 virtual ChannelHandle GetPipeHandle() const = 0; | |
| 178 | |
| 173 // Send a message over the Channel to the listener on the other end. | 179 // Send a message over the Channel to the listener on the other end. |
| 174 // | 180 // |
| 175 // |message| must be allocated using operator new. This object will be | 181 // |message| must be allocated using operator new. This object will be |
| 176 // deleted once the contents of the Message have been sent. | 182 // deleted once the contents of the Message have been sent. |
| 177 virtual bool Send(Message* message) = 0; | 183 virtual bool Send(Message* message) = 0; |
| 178 | 184 |
| 179 #if defined(OS_POSIX) && !defined(OS_NACL) | 185 #if defined(OS_POSIX) && !defined(OS_NACL) |
| 180 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the | 186 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the |
| 181 // FD # for the client end of the socket. | 187 // FD # for the client end of the socket. |
| 182 // This method may only be called on the server side of a channel. | 188 // This method may only be called on the server side of a channel. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 | 229 |
| 224 #if defined(OS_POSIX) | 230 #if defined(OS_POSIX) |
| 225 // SocketPair() creates a pair of socket FDs suitable for using with | 231 // SocketPair() creates a pair of socket FDs suitable for using with |
| 226 // IPC::Channel. | 232 // IPC::Channel. |
| 227 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 233 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 228 #endif | 234 #endif |
| 229 | 235 |
| 230 } // namespace IPC | 236 } // namespace IPC |
| 231 | 237 |
| 232 #endif // IPC_IPC_CHANNEL_H_ | 238 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |