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_NACL_H_ | 5 #ifndef IPC_IPC_CHANNEL_NACL_H_ |
6 #define IPC_IPC_CHANNEL_NACL_H_ | 6 #define IPC_IPC_CHANNEL_NACL_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
| 10 #include "ipc/ipc_channel_reader.h" |
10 | 11 |
11 namespace IPC { | 12 namespace IPC { |
12 | 13 |
13 // Similar to the Posix version of ChannelImpl but for Native Client code. | 14 // Similar to the Posix version of ChannelImpl but for Native Client code. |
14 // This is somewhat different because NaCl's send/recvmsg is slightly different | 15 // This is somewhat different because NaCl's send/recvmsg is slightly different |
15 // and we don't need to worry about complicated set up and READWRITE mode for | 16 // and we don't need to worry about complicated set up and READWRITE mode for |
16 // sharing handles. | 17 // sharing handles. |
17 class Channel::ChannelImpl : public internal::ChannelReader { | 18 class Channel::ChannelImpl : public internal::ChannelReader { |
18 public: | 19 public: |
19 ChannelImpl(const IPC::ChannelHandle& channel_handle, | 20 ChannelImpl(const IPC::ChannelHandle& channel_handle, |
20 Mode mode, | 21 Mode mode, |
21 Listener* listener); | 22 Listener* listener); |
22 virtual ~ChannelImpl(); | 23 virtual ~ChannelImpl(); |
23 | 24 |
24 // Channel implementation. | 25 // Channel implementation. |
25 bool Connect(); | 26 bool Connect(); |
26 void Close(); | 27 void Close(); |
27 bool Send(Message* message); | 28 bool Send(Message* message); |
28 int GetClientFileDescriptor() const; | 29 int GetClientFileDescriptor() const; |
29 int TakeClientFileDescriptor(); | 30 int TakeClientFileDescriptor(); |
30 bool AcceptsConnections() const; | 31 bool AcceptsConnections() const; |
31 bool HasAcceptedConnection() const; | 32 bool HasAcceptedConnection() const; |
32 bool GetClientEuid(uid_t* client_euid) const; | 33 bool GetClientEuid(uid_t* client_euid) const; |
33 void ResetToAcceptingConnectionState(); | 34 void ResetToAcceptingConnectionState(); |
34 static bool IsNamedServerInitialized(const std::string& channel_id); | 35 static bool IsNamedServerInitialized(const std::string& channel_id); |
35 | 36 |
| 37 virtual ReadState ReadData(char* buffer, |
| 38 int buffer_len, |
| 39 int* bytes_read) OVERRIDE; |
| 40 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; |
| 41 virtual bool DidEmptyInputBuffers() OVERRIDE; |
| 42 virtual void HandleHelloMessage(const Message& msg) OVERRIDE; |
| 43 |
36 private: | 44 private: |
37 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); | 45 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl); |
38 }; | 46 }; |
39 | 47 |
40 } // namespace IPC | 48 } // namespace IPC |
41 | 49 |
42 #endif // IPC_IPC_CHANNEL_NACL_H_ | 50 #endif // IPC_IPC_CHANNEL_NACL_H_ |
OLD | NEW |