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

Unified Diff: ipc/ipc_sync_channel.cc

Issue 301973003: Introduce IPC::ChannelProxy::Create*() and IPC::SynChannel::Create*() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing mac build 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
« 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..32f8619bd977e13c1c5c6a69d25dc9d73d60149d 100644
--- a/ipc/ipc_sync_channel.cc
+++ b/ipc/ipc_sync_channel.cc
@@ -404,19 +404,65 @@ base::WaitableEventWatcher::EventCallback
return base::Bind(&SyncChannel::SyncContext::OnWaitableEventSignaled, this);
}
-SyncChannel::SyncChannel(
+// 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,
- 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->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(
+ 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->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));
}
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