| 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_H_ | 5 #ifndef IPC_IPC_CHANNEL_H_ |
| 6 #define IPC_IPC_CHANNEL_H_ | 6 #define IPC_IPC_CHANNEL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "ipc/ipc_channel_handle.h" | 10 #include "ipc/ipc_channel_handle.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // On Windows we access pipes in various processes by name. | 22 // On Windows we access pipes in various processes by name. |
| 23 // On POSIX we pass file descriptors to child processes and assign names to them | 23 // On POSIX we pass file descriptors to child processes and assign names to them |
| 24 // in a lookup table. | 24 // in a lookup table. |
| 25 // In general on POSIX we do not use unix domain sockets due to security | 25 // In general on POSIX we do not use unix domain sockets due to security |
| 26 // concerns and the fact that they can leave garbage around the file system | 26 // concerns and the fact that they can leave garbage around the file system |
| 27 // (MacOS does not support abstract named unix domain sockets). | 27 // (MacOS does not support abstract named unix domain sockets). |
| 28 // You can use unix domain sockets if you like on POSIX by constructing the | 28 // You can use unix domain sockets if you like on POSIX by constructing the |
| 29 // the channel with the mode set to one of the NAMED modes. NAMED modes are | 29 // the channel with the mode set to one of the NAMED modes. NAMED modes are |
| 30 // currently used by automation and service processes. | 30 // currently used by automation and service processes. |
| 31 | 31 |
| 32 class Channel : public Message::Sender { | 32 class IPC_EXPORT Channel : public Message::Sender { |
| 33 // Security tests need access to the pipe handle. | 33 // Security tests need access to the pipe handle. |
| 34 friend class ChannelTest; | 34 friend class ChannelTest; |
| 35 | 35 |
| 36 public: | 36 public: |
| 37 // Implemented by consumers of a Channel to receive messages. | 37 // Implemented by consumers of a Channel to receive messages. |
| 38 class Listener { | 38 class IPC_EXPORT Listener { |
| 39 public: | 39 public: |
| 40 virtual ~Listener() {} | 40 virtual ~Listener() {} |
| 41 | 41 |
| 42 // Called when a message is received. Returns true iff the message was | 42 // Called when a message is received. Returns true iff the message was |
| 43 // handled. | 43 // handled. |
| 44 virtual bool OnMessageReceived(const Message& message) = 0; | 44 virtual bool OnMessageReceived(const Message& message) = 0; |
| 45 | 45 |
| 46 // Called when the channel is connected and we have received the internal | 46 // Called when the channel is connected and we have received the internal |
| 47 // Hello message from the peer. | 47 // Hello message from the peer. |
| 48 virtual void OnChannelConnected(int32 peer_pid) {} | 48 virtual void OnChannelConnected(int32 peer_pid) {} |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16), | 195 HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16), |
| 196 // to avoid conflicting with normal | 196 // to avoid conflicting with normal |
| 197 // message types, which are enumeration | 197 // message types, which are enumeration |
| 198 // constants starting from 0. | 198 // constants starting from 0. |
| 199 }; | 199 }; |
| 200 }; | 200 }; |
| 201 | 201 |
| 202 } // namespace IPC | 202 } // namespace IPC |
| 203 | 203 |
| 204 #endif // IPC_IPC_CHANNEL_H_ | 204 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |