summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_channel_posix.h
diff options
context:
space:
mode:
authormorrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 20:13:51 +0000
committermorrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-06 20:13:51 +0000
commit2f60c9b74db6c61424a5a9c731acef26a9260c9c (patch)
treeef3fb081703d0fb3f20f2d279f2d73310a14eac6 /ipc/ipc_channel_posix.h
parent42dbdaa6943939486e36e8ded5eb26f2419eeee3 (diff)
downloadchromium_src-2f60c9b74db6c61424a5a9c731acef26a9260c9c.zip
chromium_src-2f60c9b74db6c61424a5a9c731acef26a9260c9c.tar.gz
chromium_src-2f60c9b74db6c61424a5a9c731acef26a9260c9c.tar.bz2
Make IPC::Channel polymorphic
This change makes each platform specific ChannelImpl into a subclass of Channel: ChannelPosix, ChannelWin, ChannelNacl. delegated functions are now virtual. TEST=none BUG=377980 R=darin@chromium.org, jam@chromium.org Review URL: https://codereview.chromium.org/310293002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275505 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_posix.h')
-rw-r--r--ipc/ipc_channel_posix.h39
1 files changed, 22 insertions, 17 deletions
diff --git a/ipc/ipc_channel_posix.h b/ipc/ipc_channel_posix.h
index 1e587c1..ae2de72 100644
--- a/ipc/ipc_channel_posix.h
+++ b/ipc/ipc_channel_posix.h
@@ -49,24 +49,29 @@
namespace IPC {
-class Channel::ChannelImpl : public internal::ChannelReader,
- public base::MessageLoopForIO::Watcher {
+class ChannelPosix : public Channel,
+ public internal::ChannelReader,
+ public base::MessageLoopForIO::Watcher {
public:
// Mirror methods of Channel, see ipc_channel.h for description.
- ChannelImpl(const IPC::ChannelHandle& channel_handle, Mode mode,
- Listener* listener);
- virtual ~ChannelImpl();
- bool Connect();
- void Close();
- bool Send(Message* message);
- int GetClientFileDescriptor();
- int TakeClientFileDescriptor();
+ ChannelPosix(const IPC::ChannelHandle& channel_handle, Mode mode,
+ Listener* listener);
+ virtual ~ChannelPosix();
+
+ // Channel implementation
+ virtual bool Connect() OVERRIDE;
+ virtual void Close() OVERRIDE;
+ virtual bool Send(Message* message) OVERRIDE;
+ virtual base::ProcessId GetPeerPID() const OVERRIDE;
+ virtual int GetClientFileDescriptor() const OVERRIDE;
+ virtual int TakeClientFileDescriptor() OVERRIDE;
+ virtual bool AcceptsConnections() const OVERRIDE;
+ virtual bool HasAcceptedConnection() const OVERRIDE;
+ virtual bool GetPeerEuid(uid_t* peer_euid) const OVERRIDE;
+ virtual void ResetToAcceptingConnectionState() OVERRIDE;
+
void CloseClientFileDescriptor();
- bool AcceptsConnections() const;
- bool HasAcceptedConnection() const;
- bool GetPeerEuid(uid_t* peer_euid) const;
- void ResetToAcceptingConnectionState();
- base::ProcessId peer_pid() const { return peer_pid_; }
+
static bool IsNamedServerInitialized(const std::string& channel_id);
#if defined(OS_LINUX)
static void SetGlobalPid(int pid);
@@ -144,7 +149,7 @@ class Channel::ChannelImpl : public internal::ChannelReader,
// For a server, the client end of our socketpair() -- the other end of our
// pipe_ that is passed to the client.
int client_pipe_;
- base::Lock client_pipe_lock_; // Lock that protects |client_pipe_|.
+ mutable base::Lock client_pipe_lock_; // Lock that protects |client_pipe_|.
#if defined(IPC_USES_READWRITE)
// Linux/BSD use a dedicated socketpair() for passing file descriptors.
@@ -202,7 +207,7 @@ class Channel::ChannelImpl : public internal::ChannelReader,
static int global_pid_;
#endif // OS_LINUX
- DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelImpl);
+ DISALLOW_IMPLICIT_CONSTRUCTORS(ChannelPosix);
};
} // namespace IPC