| 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/process/process.h" | 15 #include "base/process/process.h" |
| 16 #include "base/process/process_handle.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 //------------------------------------------------------------------------------ |
| 25 // See | 26 // See |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 virtual base::ProcessId GetPeerPID() const = 0; | 172 virtual base::ProcessId GetPeerPID() const = 0; |
| 172 | 173 |
| 173 // Get its own process id. This value is told to the peer. | 174 // Get its own process id. This value is told to the peer. |
| 174 virtual base::ProcessId GetSelfPID() const = 0; | 175 virtual base::ProcessId GetSelfPID() const = 0; |
| 175 | 176 |
| 176 // Return connected ChannelHandle which the channel has owned. | 177 // Return connected ChannelHandle which the channel has owned. |
| 177 // This method transfers the ownership to the caller | 178 // This method transfers the ownership to the caller |
| 178 // so the channel isn't valid after the call. | 179 // so the channel isn't valid after the call. |
| 179 virtual ChannelHandle TakePipeHandle() WARN_UNUSED_RESULT = 0; | 180 virtual ChannelHandle TakePipeHandle() WARN_UNUSED_RESULT = 0; |
| 180 | 181 |
| 182 // Tell a server channel its client process handle. A Channel |
| 183 // implementation may need this to establish the connection to the |
| 184 // client. This should only be called on server-side channel. |
| 185 virtual void OnClientLaunched(base::ProcessHandle handle); |
| 186 |
| 181 // Send a message over the Channel to the listener on the other end. | 187 // Send a message over the Channel to the listener on the other end. |
| 182 // | 188 // |
| 183 // |message| must be allocated using operator new. This object will be | 189 // |message| must be allocated using operator new. This object will be |
| 184 // deleted once the contents of the Message have been sent. | 190 // deleted once the contents of the Message have been sent. |
| 185 virtual bool Send(Message* message) = 0; | 191 virtual bool Send(Message* message) = 0; |
| 186 | 192 |
| 187 #if defined(OS_POSIX) && !defined(OS_NACL) | 193 #if defined(OS_POSIX) && !defined(OS_NACL) |
| 188 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the | 194 // On POSIX an IPC::Channel wraps a socketpair(), this method returns the |
| 189 // FD # for the client end of the socket. | 195 // FD # for the client end of the socket. |
| 190 // This method may only be called on the server side of a channel. | 196 // 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... |
| 231 | 237 |
| 232 #if defined(OS_POSIX) | 238 #if defined(OS_POSIX) |
| 233 // SocketPair() creates a pair of socket FDs suitable for using with | 239 // SocketPair() creates a pair of socket FDs suitable for using with |
| 234 // IPC::Channel. | 240 // IPC::Channel. |
| 235 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); | 241 IPC_EXPORT bool SocketPair(int* fd1, int* fd2); |
| 236 #endif | 242 #endif |
| 237 | 243 |
| 238 } // namespace IPC | 244 } // namespace IPC |
| 239 | 245 |
| 240 #endif // IPC_IPC_CHANNEL_H_ | 246 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |