summaryrefslogtreecommitdiffstats
path: root/ipc/ipc_sync_channel.cc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc/ipc_sync_channel.cc')
-rw-r--r--ipc/ipc_sync_channel.cc64
1 files changed, 9 insertions, 55 deletions
diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc
index 32f8619..0e0018c 100644
--- a/ipc/ipc_sync_channel.cc
+++ b/ipc/ipc_sync_channel.cc
@@ -404,65 +404,19 @@ base::WaitableEventWatcher::EventCallback
return base::Bind(&SyncChannel::SyncContext::OnWaitableEventSignaled, this);
}
-// static
-scoped_ptr<SyncChannel> SyncChannel::CreateClient(
- const IPC::ChannelHandle& channel_handle,
- Listener* listener,
- base::SingleThreadTaskRunner* ipc_task_runner,
- bool create_pipe_now,
- base::WaitableEvent* shutdown_event) {
- scoped_ptr<SyncChannel> channel = Create(
- listener, ipc_task_runner, shutdown_event);
- channel->InitClient(channel_handle, create_pipe_now);
- return channel.Pass();
-}
-
-// static
-scoped_ptr<SyncChannel> SyncChannel::CreateServer(
- const IPC::ChannelHandle& channel_handle,
- Listener* listener,
- base::SingleThreadTaskRunner* ipc_task_runner,
- bool create_pipe_now,
- base::WaitableEvent* shutdown_event) {
- scoped_ptr<SyncChannel> channel = Create(
- listener, ipc_task_runner, shutdown_event);
- channel->InitServer(channel_handle, create_pipe_now);
- return channel.Pass();
-}
-
-// static
-scoped_ptr<SyncChannel> SyncChannel::CreateNamedClient(
- const IPC::ChannelHandle& channel_handle,
- Listener* listener,
- base::SingleThreadTaskRunner* ipc_task_runner,
- bool create_pipe_now,
- base::WaitableEvent* shutdown_event) {
- scoped_ptr<SyncChannel> channel = Create(
- listener, ipc_task_runner, shutdown_event);
- channel->InitNamedClient(channel_handle, create_pipe_now);
- return channel.Pass();
-}
-
-// static
-scoped_ptr<SyncChannel> SyncChannel::CreateNamedServer(
+SyncChannel::SyncChannel(
const IPC::ChannelHandle& channel_handle,
+ Channel::Mode mode,
Listener* listener,
base::SingleThreadTaskRunner* ipc_task_runner,
bool create_pipe_now,
- base::WaitableEvent* shutdown_event) {
- scoped_ptr<SyncChannel> channel = Create(
- listener, ipc_task_runner, shutdown_event);
- channel->InitNamedServer(channel_handle, 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));
+ 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();
}
SyncChannel::SyncChannel(