diff options
author | morrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-02 19:41:12 +0000 |
---|---|---|
committer | morrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-02 19:41:12 +0000 |
commit | cf178fb755d0fda06fd770c1a94eb8696063c001 (patch) | |
tree | 6e78f195f4731ec0231c538fc8377a3a41e8482b /ipc/ipc_sync_channel.h | |
parent | 7d1c92a65a91100f4cae59626107b7b74aba536b (diff) | |
download | chromium_src-cf178fb755d0fda06fd770c1a94eb8696063c001.zip chromium_src-cf178fb755d0fda06fd770c1a94eb8696063c001.tar.gz chromium_src-cf178fb755d0fda06fd770c1a94eb8696063c001.tar.bz2 |
Introduce IPC::ChannelProxy::Create*() and IPC::SynChannel::Create*()
This change hides constructors of these classes so that we can turn
them polymorphic classes.
Note that having almost identical ChannelProxy::Init*() isn't great
and they will be replaced by a factory-like abstraction in coming
changes.
TEST=none
R=darin,cpu
BUG=377980
Review URL: https://codereview.chromium.org/301973003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274310 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_sync_channel.h')
-rw-r--r-- | ipc/ipc_sync_channel.h | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/ipc/ipc_sync_channel.h b/ipc/ipc_sync_channel.h index f18fcff9..9ae3fd9 100644 --- a/ipc/ipc_sync_channel.h +++ b/ipc/ipc_sync_channel.h @@ -66,19 +66,42 @@ class IPC_EXPORT SyncChannel : public ChannelProxy { // Creates and initializes a sync channel. If create_pipe_now is specified, // the channel will be initialized synchronously. - SyncChannel(const IPC::ChannelHandle& channel_handle, - Channel::Mode mode, - Listener* listener, - base::SingleThreadTaskRunner* ipc_task_runner, - bool create_pipe_now, - base::WaitableEvent* shutdown_event); + // The naming pattern follows IPC::Channel. + static scoped_ptr<SyncChannel> CreateClient( + const IPC::ChannelHandle& channel_handle, + Listener* listener, + base::SingleThreadTaskRunner* ipc_task_runner, + bool create_pipe_now, + base::WaitableEvent* shutdown_event); + + static scoped_ptr<SyncChannel> CreateServer( + const IPC::ChannelHandle& channel_handle, + Listener* listener, + base::SingleThreadTaskRunner* ipc_task_runner, + bool create_pipe_now, + base::WaitableEvent* shutdown_event); + + static scoped_ptr<SyncChannel> CreateNamedClient( + const IPC::ChannelHandle& channel_handle, + Listener* listener, + base::SingleThreadTaskRunner* ipc_task_runner, + bool create_pipe_now, + base::WaitableEvent* shutdown_event); + + static scoped_ptr<SyncChannel> CreateNamedServer( + const IPC::ChannelHandle& channel_handle, + Listener* listener, + base::SingleThreadTaskRunner* ipc_task_runner, + bool create_pipe_now, + base::WaitableEvent* shutdown_event); // Creates an uninitialized sync channel. Call ChannelProxy::Init to // initialize the channel. This two-step setup allows message filters to be // added before any messages are sent or received. - SyncChannel(Listener* listener, - base::SingleThreadTaskRunner* ipc_task_runner, - base::WaitableEvent* shutdown_event); + static scoped_ptr<SyncChannel> Create( + Listener* listener, + base::SingleThreadTaskRunner* ipc_task_runner, + base::WaitableEvent* shutdown_event); virtual ~SyncChannel(); @@ -188,6 +211,10 @@ class IPC_EXPORT SyncChannel : public ChannelProxy { }; private: + SyncChannel(Listener* listener, + base::SingleThreadTaskRunner* ipc_task_runner, + base::WaitableEvent* shutdown_event); + void OnWaitableEventSignaled(base::WaitableEvent* arg); SyncContext* sync_context() { |