diff options
author | morrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 16:15:38 +0000 |
---|---|---|
committer | morrita@chromium.org <morrita@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-06-05 16:15:38 +0000 |
commit | fca876a107b04f46eabeff93dbd09e3612d96c61 (patch) | |
tree | 5f851173c0418a9653f43d72618a34aba9cd01f4 /ipc/ipc_channel_proxy.cc | |
parent | 3408115e2fd1fcfb264d8a47498c9cc376e977c1 (diff) | |
download | chromium_src-fca876a107b04f46eabeff93dbd09e3612d96c61.zip chromium_src-fca876a107b04f46eabeff93dbd09e3612d96c61.tar.gz chromium_src-fca876a107b04f46eabeff93dbd09e3612d96c61.tar.bz2 |
Add IPC::ChannelProxy::Create() and IPC::SyncChannel::Create()
This change replaces constructors with Create() methods of
ChannelProxy and SyncChannel. This open the possibility to introduce
polymorphism to these classes.
This is a revision of r274310 (https://codereview.chromium.org/301973003/)
in which I added bunch of Create*() method variants.
The chagne was reverted. This change no longer does it and just keeps
using Channel::Mode to specify the channel type.
TEST=none
BUG=377980
R=darin@chromium.org,jam@chromium.org
Review URL: https://codereview.chromium.org/310853003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275140 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ipc/ipc_channel_proxy.cc')
-rw-r--r-- | ipc/ipc_channel_proxy.cc | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc index e88bb5d..ceffb94 100644 --- a/ipc/ipc_channel_proxy.cc +++ b/ipc/ipc_channel_proxy.cc @@ -304,13 +304,15 @@ void ChannelProxy::Context::OnDispatchBadMessage(const Message& message) { //----------------------------------------------------------------------------- -ChannelProxy::ChannelProxy(const IPC::ChannelHandle& channel_handle, - Channel::Mode mode, - Listener* listener, - base::SingleThreadTaskRunner* ipc_task_runner) - : context_(new Context(listener, ipc_task_runner)), - did_init_(false) { - Init(channel_handle, mode, true); +// static +scoped_ptr<ChannelProxy> ChannelProxy::Create( + const IPC::ChannelHandle& channel_handle, + Channel::Mode mode, + Listener* listener, + base::SingleThreadTaskRunner* ipc_task_runner) { + scoped_ptr<ChannelProxy> channel(new ChannelProxy(listener, ipc_task_runner)); + channel->Init(channel_handle, mode, true); + return channel.Pass(); } ChannelProxy::ChannelProxy(Context* context) @@ -318,6 +320,11 @@ ChannelProxy::ChannelProxy(Context* context) did_init_(false) { } +ChannelProxy::ChannelProxy(Listener* listener, + base::SingleThreadTaskRunner* ipc_task_runner) + : context_(new Context(listener, ipc_task_runner)), did_init_(false) { +} + ChannelProxy::~ChannelProxy() { DCHECK(CalledOnValidThread()); |