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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ipc/ipc_channel.h" | 9 #include "ipc/ipc_channel.h" |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 bool Connect(); | 58 bool Connect(); |
59 void Close(); | 59 void Close(); |
60 bool Send(Message* message); | 60 bool Send(Message* message); |
61 int GetClientFileDescriptor(); | 61 int GetClientFileDescriptor(); |
62 int TakeClientFileDescriptor(); | 62 int TakeClientFileDescriptor(); |
63 void CloseClientFileDescriptor(); | 63 void CloseClientFileDescriptor(); |
64 bool AcceptsConnections() const; | 64 bool AcceptsConnections() const; |
65 bool HasAcceptedConnection() const; | 65 bool HasAcceptedConnection() const; |
66 bool GetClientEuid(uid_t* client_euid) const; | 66 bool GetClientEuid(uid_t* client_euid) const; |
67 void ResetToAcceptingConnectionState(); | 67 void ResetToAcceptingConnectionState(); |
68 base::ProcessId peer_pid() const { return peer_pid_; } | |
Tom Sepez
2012/04/04 19:07:07
Include what you use.
jschuh
2012/04/04 21:05:13
Done.
| |
68 static bool IsNamedServerInitialized(const std::string& channel_id); | 69 static bool IsNamedServerInitialized(const std::string& channel_id); |
69 #if defined(OS_LINUX) | 70 #if defined(OS_LINUX) |
70 static void SetGlobalPid(int pid); | 71 static void SetGlobalPid(int pid); |
71 #endif // OS_LINUX | 72 #endif // OS_LINUX |
72 | 73 |
73 private: | 74 private: |
74 bool CreatePipe(const IPC::ChannelHandle& channel_handle); | 75 bool CreatePipe(const IPC::ChannelHandle& channel_handle); |
75 | 76 |
76 bool ProcessOutgoingMessages(); | 77 bool ProcessOutgoingMessages(); |
77 | 78 |
(...skipping 28 matching lines...) Expand all Loading... | |
106 // Closes all handles in the input_fds_ list and clears the list. This is | 107 // Closes all handles in the input_fds_ list and clears the list. This is |
107 // used to clean up handles in error conditions to avoid leaking the handles. | 108 // used to clean up handles in error conditions to avoid leaking the handles. |
108 void ClearInputFDs(); | 109 void ClearInputFDs(); |
109 | 110 |
110 // MessageLoopForIO::Watcher implementation. | 111 // MessageLoopForIO::Watcher implementation. |
111 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; | 112 virtual void OnFileCanReadWithoutBlocking(int fd) OVERRIDE; |
112 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; | 113 virtual void OnFileCanWriteWithoutBlocking(int fd) OVERRIDE; |
113 | 114 |
114 Mode mode_; | 115 Mode mode_; |
115 | 116 |
117 base::ProcessId peer_pid_; | |
118 | |
116 // After accepting one client connection on our server socket we want to | 119 // After accepting one client connection on our server socket we want to |
117 // stop listening. | 120 // stop listening. |
118 MessageLoopForIO::FileDescriptorWatcher server_listen_connection_watcher_; | 121 MessageLoopForIO::FileDescriptorWatcher server_listen_connection_watcher_; |
119 MessageLoopForIO::FileDescriptorWatcher read_watcher_; | 122 MessageLoopForIO::FileDescriptorWatcher read_watcher_; |
120 MessageLoopForIO::FileDescriptorWatcher write_watcher_; | 123 MessageLoopForIO::FileDescriptorWatcher write_watcher_; |
121 | 124 |
122 // Indicates whether we're currently blocked waiting for a write to complete. | 125 // Indicates whether we're currently blocked waiting for a write to complete. |
123 bool is_blocked_on_write_; | 126 bool is_blocked_on_write_; |
124 bool waiting_connect_; | 127 bool waiting_connect_; |
125 | 128 |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
190 | 193 |
191 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or | 194 // The maximum length of the name of a pipe for MODE_NAMED_SERVER or |
192 // MODE_NAMED_CLIENT if you want to pass in your own socket. | 195 // MODE_NAMED_CLIENT if you want to pass in your own socket. |
193 // The standard size on linux is 108, mac is 104. To maintain consistency | 196 // The standard size on linux is 108, mac is 104. To maintain consistency |
194 // across platforms we standardize on the smaller value. | 197 // across platforms we standardize on the smaller value. |
195 static const size_t kMaxPipeNameLength = 104; | 198 static const size_t kMaxPipeNameLength = 104; |
196 | 199 |
197 } // namespace IPC | 200 } // namespace IPC |
198 | 201 |
199 #endif // IPC_IPC_CHANNEL_POSIX_H_ | 202 #endif // IPC_IPC_CHANNEL_POSIX_H_ |
OLD | NEW |