| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "ipc/ipc_message.h" | 10 #include "ipc/ipc_message.h" |
| 10 | 11 |
| 11 namespace IPC { | 12 namespace IPC { |
| 12 | 13 |
| 13 //------------------------------------------------------------------------------ | 14 //------------------------------------------------------------------------------ |
| 14 | 15 |
| 15 class Channel : public Message::Sender { | 16 class Channel : public Message::Sender { |
| 16 // Security tests need access to the pipe handle. | 17 // Security tests need access to the pipe handle. |
| 17 friend class ChannelTest; | 18 friend class ChannelTest; |
| 18 | 19 |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 // | 61 // |
| 61 Channel(const std::string& channel_id, Mode mode, Listener* listener); | 62 Channel(const std::string& channel_id, Mode mode, Listener* listener); |
| 62 | 63 |
| 63 ~Channel(); | 64 ~Channel(); |
| 64 | 65 |
| 65 // Connect the pipe. On the server side, this will initiate | 66 // Connect the pipe. On the server side, this will initiate |
| 66 // waiting for connections. On the client, it attempts to | 67 // waiting for connections. On the client, it attempts to |
| 67 // connect to a pre-existing pipe. Note, calling Connect() | 68 // connect to a pre-existing pipe. Note, calling Connect() |
| 68 // will not block the calling thread and may complete | 69 // will not block the calling thread and may complete |
| 69 // asynchronously. | 70 // asynchronously. |
| 70 bool Connect(); | 71 bool Connect() WARN_UNUSED_RESULT; |
| 71 | 72 |
| 72 // Close this Channel explicitly. May be called multiple times. | 73 // Close this Channel explicitly. May be called multiple times. |
| 73 void Close(); | 74 void Close(); |
| 74 | 75 |
| 75 // Modify the Channel's listener. | 76 // Modify the Channel's listener. |
| 76 void set_listener(Listener* listener); | 77 void set_listener(Listener* listener); |
| 77 | 78 |
| 78 // Send a message over the Channel to the listener on the other end. | 79 // Send a message over the Channel to the listener on the other end. |
| 79 // | 80 // |
| 80 // |message| must be allocated using operator new. This object will be | 81 // |message| must be allocated using operator new. This object will be |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16), | 113 HELLO_MESSAGE_TYPE = kuint16max // Maximum value of message type (uint16), |
| 113 // to avoid conflicting with normal | 114 // to avoid conflicting with normal |
| 114 // message types, which are enumeration | 115 // message types, which are enumeration |
| 115 // constants starting from 0. | 116 // constants starting from 0. |
| 116 }; | 117 }; |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 } // namespace IPC | 120 } // namespace IPC |
| 120 | 121 |
| 121 #endif // IPC_IPC_CHANNEL_H_ | 122 #endif // IPC_IPC_CHANNEL_H_ |
| OLD | NEW |