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

Unified Diff: ipc/ipc_sync_channel.cc

Issue 310853003: Add IPC::ChannelProxy::Create() and IPC::SyncChannel::Create() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Landing Created 6 years, 6 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
« no previous file with comments | « ipc/ipc_sync_channel.h ('k') | ipc/ipc_sync_channel_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ipc/ipc_sync_channel.cc
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc
index 0e0018c7eae74745b91ade4655975278568d57bb..a7ed230e53cdeec5ab1e43f90701edb0c3662c78 100644
--- a/ipc/ipc_sync_channel.cc
+++ b/ipc/ipc_sync_channel.cc
@@ -404,19 +404,27 @@ base::WaitableEventWatcher::EventCallback
return base::Bind(&SyncChannel::SyncContext::OnWaitableEventSignaled, this);
}
-SyncChannel::SyncChannel(
+// static
+scoped_ptr<SyncChannel> SyncChannel::Create(
const IPC::ChannelHandle& channel_handle,
Channel::Mode mode,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
bool create_pipe_now,
- WaitableEvent* shutdown_event)
- : ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)) {
- // The current (listener) thread must be distinct from the IPC thread, or else
- // sending synchronous messages will deadlock.
- DCHECK_NE(ipc_task_runner, base::ThreadTaskRunnerHandle::Get());
- ChannelProxy::Init(channel_handle, mode, create_pipe_now);
- StartWatching();
+ base::WaitableEvent* shutdown_event) {
+ scoped_ptr<SyncChannel> channel =
+ Create(listener, ipc_task_runner, shutdown_event);
+ channel->Init(channel_handle, mode, create_pipe_now);
+ return channel.Pass();
+}
+
+// static
+scoped_ptr<SyncChannel> SyncChannel::Create(
+ Listener* listener,
+ base::SingleThreadTaskRunner* ipc_task_runner,
+ WaitableEvent* shutdown_event) {
+ return make_scoped_ptr(
+ new SyncChannel(listener, ipc_task_runner, shutdown_event));
}
SyncChannel::SyncChannel(
« no previous file with comments | « ipc/ipc_sync_channel.h ('k') | ipc/ipc_sync_channel_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698