Chromium Code Reviews| 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 |
| 11 | 11 |
| 12 #include <queue> | 12 #include <queue> |
| 13 #include <set> | 13 #include <set> |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/files/scoped_file.h" | 17 #include "base/files/scoped_file.h" |
| 18 #include "base/message_loop/message_loop.h" | 18 #include "base/message_loop/message_loop.h" |
| 19 #include "base/process/process.h" | 19 #include "base/process/process.h" |
| 20 #include "ipc/ipc_channel_reader.h" | 20 #include "ipc/ipc_channel_reader.h" |
| 21 #include "ipc/ipc_message_attachment_set.h" | 21 #include "ipc/ipc_message_attachment_set.h" |
| 22 | 22 |
| 23 namespace IPC { | 23 namespace IPC { |
| 24 | 24 |
| 25 class IPC_EXPORT ChannelPosix : public Channel, | 25 class IPC_EXPORT ChannelPosix : public Channel, |
| 26 public internal::ChannelReader, | 26 public internal::ChannelReader, |
| 27 public base::MessageLoopForIO::Watcher { | 27 public base::MessageLoopForIO::Watcher { |
| 28 public: | 28 public: |
| 29 ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode, | 29 ChannelPosix(const IPC::ChannelHandle& channel_handle, |
| 30 Listener* listener); | 30 Mode mode, |
| 31 Listener* listener, | |
| 32 AttachmentBroker* broker); | |
| 31 ~ChannelPosix() override; | 33 ~ChannelPosix() override; |
| 32 | 34 |
| 33 // Channel implementation | 35 // Channel implementation |
| 34 bool Connect() override; | 36 bool Connect() override; |
| 35 void Close() override; | 37 void Close() override; |
| 36 bool Send(Message* message) override; | 38 bool Send(Message* message) override; |
| 39 AttachmentBroker* GetAttachmentBroker() override; | |
| 37 base::ProcessId GetPeerPID() const override; | 40 base::ProcessId GetPeerPID() const override; |
| 38 base::ProcessId GetSelfPID() const override; | 41 base::ProcessId GetSelfPID() const override; |
| 39 int GetClientFileDescriptor() const override; | 42 int GetClientFileDescriptor() const override; |
| 40 base::ScopedFD TakeClientFileDescriptor() override; | 43 base::ScopedFD TakeClientFileDescriptor() override; |
| 41 | 44 |
| 42 // Returns true if the channel supports listening for connections. | 45 // Returns true if the channel supports listening for connections. |
| 43 bool AcceptsConnections() const; | 46 bool AcceptsConnections() const; |
| 44 | 47 |
| 45 // Returns true if the channel supports listening for connections and is | 48 // Returns true if the channel supports listening for connections and is |
| 46 // currently connected. | 49 // currently connected. |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 #endif | 171 #endif |
| 169 | 172 |
| 170 // True if we are responsible for unlinking the unix domain socket file. | 173 // True if we are responsible for unlinking the unix domain socket file. |
| 171 bool must_unlink_; | 174 bool must_unlink_; |
| 172 | 175 |
| 173 #if defined(OS_LINUX) | 176 #if defined(OS_LINUX) |
| 174 // If non-zero, overrides the process ID sent in the hello message. | 177 // If non-zero, overrides the process ID sent in the hello message. |
| 175 static int global_pid_; | 178 static int global_pid_; |
| 176 #endif // OS_LINUX | 179 #endif // OS_LINUX |
| 177 | 180 |
| 181 // |broker_| must outlive this instance. | |
|
Tom Sepez
2015/06/16 16:36:44
nit: ditto.
erikchen
2015/06/16 17:36:47
Done. I also went ahead and updated channel_win an
| |
| 182 AttachmentBroker* broker_; | |
| 183 | |
| 178 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix); | 184 DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix); |
| 179 }; | 185 }; |
| 180 | 186 |
| 181 } // namespace IPC | 187 } // namespace IPC |
| 182 | 188 |
| 183 #endif // IPC_IPC_CHANNEL_POSIX_H_ | 189 #endif // IPC_IPC_CHANNEL_POSIX_H_ |
| OLD | NEW |