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. | |
|
Tom Sepez
2014/08/07 18:36:22
Can you elaborate on "this value is told to the pe
Hajime Morrita
2014/08/07 19:58:21
Yes it can, as it can do that for current IPC impl
| |
| 174 virtual base::ProcessId GetSelfPID() const = 0; | |
| 175 | |
| 176 // Return connected ChannelHandle which the channel has owned. | |
| 177 // This method transfers the ownership to the caller | |
| 178 // so the channel isn't valid after the call. | |
| 179 virtual ChannelHandle TakePipeHandle() WARN_UNUSED_RESULT = 0; | |
| 180 | |
| 173 // Send a message over the Channel to the listener on the other end. | 181 // Send a message over the Channel to the listener on the other end. |
| 174 // | 182 // |
| 175 // |message| must be allocated using operator new. This object will be | 183 // |message| must be allocated using operator new. This object will be |
| 176 // deleted once the contents of the Message have been sent. | 184 // deleted once the contents of the Message have been sent. |
| 177 virtual bool Send(Message* message) = 0; | 185 virtual bool Send(Message* message) = 0; |
| 178 | 186 |
| 179 #if defined(OS_POSIX) && !defined(OS_NACL) | 187 #if defined(OS_POSIX) && !defined(OS_NACL) |
| 180 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the | 188 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the |
| 181 // FD # for the client end of the socket. | 189 // FD # for the client end of the socket. |
| 182 // This method may only be called on the server side of a channel. | 190 // 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 | 231 |
| 224 #if defined(OS_POSIX) | 232 #if defined(OS_POSIX) |
| 225 // SocketPair() creates a pair of socket FDs suitable for using with | 233 // SocketPair() creates a pair of socket FDs suitable for using with |
| 226 // IPC::Channel. | 234 // IPC::Channel. |
| 227 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 235 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 228 #endif | 236 #endif |
| 229 | 237 |
| 230 } // namespace IPC | 238 } // namespace IPC |
| 231 | 239 |
| 232 #endif // IPC_IPC_CHANNEL_H_ | 240 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |