Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Unified Diff: ipc/ipc_channel_proxy.cc

Issue 310853003: Add IPC::ChannelProxy::Create() and IPC::SyncChannel::Create() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ipc/ipc_channel_proxy.cc
diff --git a/ipc/ipc_channel_proxy.cc b/ipc/ipc_channel_proxy.cc
index e88bb5d0e72abd0e508fb4b1c1fc96833e6d9699..62bdf7b9e81319a15eaa78e0f95a8197efc8740a 100644
--- a/ipc/ipc_channel_proxy.cc
+++ b/ipc/ipc_channel_proxy.cc
@@ -304,13 +304,22 @@ 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(
+ Listener* listener,
+ base::SingleThreadTaskRunner* ipc_task_runner) {
+ return make_scoped_ptr(new ChannelProxy(listener, ipc_task_runner));
+}
+
+// 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 = Create(listener, ipc_task_runner);
+ channel->Init(channel_handle, mode, true);
+ return channel.Pass();
}
ChannelProxy::ChannelProxy(Context* context)
@@ -318,6 +327,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());

Powered by Google App Engine
This is Rietveld 408576698