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_POSIX_H_ | 5 #ifndef IPC_IPC_CHANNEL_POSIX_H_ |
6 #define IPC_IPC_CHANNEL_POSIX_H_ | 6 #define IPC_IPC_CHANNEL_POSIX_H_ |
7 | 7 |
8 #include "ipc/ipc_channel.h" | 8 #include "ipc/ipc_channel.h" |
9 | 9 |
10 #include <sys/socket.h> // for CMSG macros | 10 #include <sys/socket.h> // for CMSG macros |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 public: | 55 public: |
56 ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode, | 56 ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode, |
57 Listener* listener); | 57 Listener* listener); |
58 virtual ~ChannelPosix(); | 58 virtual ~ChannelPosix(); |
59 | 59 |
60 // Channel implementation | 60 // Channel implementation |
61 virtual bool Connect() OVERRIDE; | 61 virtual bool Connect() OVERRIDE; |
62 virtual void Close() OVERRIDE; | 62 virtual void Close() OVERRIDE; |
63 virtual bool Send(Message* message) OVERRIDE; | 63 virtual bool Send(Message* message) OVERRIDE; |
64 virtual base::ProcessId GetPeerPID() const OVERRIDE; | 64 virtual base::ProcessId GetPeerPID() const OVERRIDE; |
| 65 virtual base::ProcessId GetSelfPID() const OVERRIDE; |
| 66 virtual ChannelHandle TakePipeHandle() OVERRIDE; |
65 virtual int GetClientFileDescriptor() const OVERRIDE; | 67 virtual int GetClientFileDescriptor() const OVERRIDE; |
66 virtual int TakeClientFileDescriptor() OVERRIDE; | 68 virtual int TakeClientFileDescriptor() OVERRIDE; |
67 | 69 |
68 // Returns true if the channel supports listening for connections. | 70 // Returns true if the channel supports listening for connections. |
69 bool AcceptsConnections() const; | 71 bool AcceptsConnections() const; |
70 | 72 |
71 // Returns true if the channel supports listening for connections and is | 73 // Returns true if the channel supports listening for connections and is |
72 // currently connected. | 74 // currently connected. |
73 bool HasAcceptedConnection() const; | 75 bool HasAcceptedConnection() const; |
74 | 76 |
(...skipping 12 matching lines...) Expand all Loading... |
87 static void SetGlobalPid(int pid); | 89 static void SetGlobalPid(int pid); |
88 #endif // OS_LINUX | 90 #endif // OS_LINUX |
89 | 91 |
90 private: | 92 private: |
91 bool CreatePipe(const IPC::ChannelHandle& channel_handle); | 93 bool CreatePipe(const IPC::ChannelHandle& channel_handle); |
92 | 94 |
93 bool ProcessOutgoingMessages(); | 95 bool ProcessOutgoingMessages(); |
94 | 96 |
95 bool AcceptConnection(); | 97 bool AcceptConnection(); |
96 void ClosePipeOnError(); | 98 void ClosePipeOnError(); |
97 int GetHelloMessageProcId(); | 99 int GetHelloMessageProcId() const; |
98 void QueueHelloMessage(); | 100 void QueueHelloMessage(); |
99 void CloseFileDescriptors(Message* msg); | 101 void CloseFileDescriptors(Message* msg); |
100 void QueueCloseFDMessage(int fd, int hops); | 102 void QueueCloseFDMessage(int fd, int hops); |
101 | 103 |
102 // ChannelReader implementation. | 104 // ChannelReader implementation. |
103 virtual ReadState ReadData(char* buffer, | 105 virtual ReadState ReadData(char* buffer, |
104 int buffer_len, | 106 int buffer_len, |
105 int* bytes_read) OVERRIDE; | 107 int* bytes_read) OVERRIDE; |
106 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; | 108 virtual bool WillDispatchInputMessage(Message* msg) OVERRIDE; |
107 virtual bool DidEmptyInputBuffers() OVERRIDE; | 109 virtual bool DidEmptyInputBuffers() OVERRIDE; |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // If non-zero, overrides the process ID sent in the hello message. | 218 // If non-zero, overrides the process ID sent in the hello message. |
217 static int global_pid_; | 219 static int global_pid_; |
218 #endif // OS_LINUX | 220 #endif // OS_LINUX |
219 | 221 |
220 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix); | 222 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix); |
221 }; | 223 }; |
222 | 224 |
223 } // namespace IPC | 225 } // namespace IPC |
224 | 226 |
225 #endif // IPC_IPC_CHANNEL_POSIX_H_ | 227 #endif // IPC_IPC_CHANNEL_POSIX_H_ |
OLD | NEW |