roll skia to 4057
[chromium-blink-merge.git] / ipc / ipc_channel_nacl.h
blob274726393e5b7be88c4a31eec4343d39154fcefd
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
3 // found in the LICENSE file.
5 #ifndef IPC_IPC_CHANNEL_NACL_H_
6 #define IPC_IPC_CHANNEL_NACL_H_
7 #pragma once
9 #include "ipc/ipc_channel.h"
10 #include "ipc/ipc_channel_reader.h"
12 namespace IPC {
14 // Similar to the Posix version of ChannelImpl but for Native Client code.
15 // This is somewhat different because NaCl's send/recvmsg is slightly different
16 // and we don't need to worry about complicated set up and READWRITE mode for
17 // sharing handles.
18 class Channel::ChannelImpl : public internal::ChannelReader {
19 public:
20 ChannelImpl(const IPC::ChannelHandle& channel_handle,
21 Mode mode,
22 Listener* listener);
23 virtual ~ChannelImpl();
25 // Channel implementation.
26 bool Connect();
27 void Close();
28 bool Send(Message* message);
29 int GetClientFileDescriptor() const;
30 int TakeClientFileDescriptor();
31 bool AcceptsConnections() const;
32 bool HasAcceptedConnection() const;
33 bool GetClientEuid(uid_t* client_euid) const;
34 void ResetToAcceptingConnectionState();
35 static bool IsNamedServerInitialized(const std::string& channel_id);
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;
44 private:
45 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl);
48 } // namespace IPC
50 #endif // IPC_IPC_CHANNEL_NACL_H_