| Index: ipc/ipc_sync_channel.cc
|
| diff --git a/ipc/ipc_sync_channel.cc b/ipc/ipc_sync_channel.cc
|
| index 6852399bdfa4d8acdaba6bd7e766e715df085947..840c89d94871d0e80094336e03f81f2df7799dd2 100644
|
| --- a/ipc/ipc_sync_channel.cc
|
| +++ b/ipc/ipc_sync_channel.cc
|
| @@ -41,9 +41,9 @@
|
| *error = result != MOJO_RESULT_OK;
|
| }
|
|
|
| -// A ReadyCallback for use with mojo::SimpleWatcher. Ignores the result
|
| -// (DCHECKs, but is only used in cases where failure should be impossible) and
|
| -// runs |callback|.
|
| +// A ReadyCallback for use with mojo::Watcher. Ignores the result (DCHECKs, but
|
| +// is only used in cases where failure should be impossible) and runs
|
| +// |callback|.
|
| void RunOnHandleReady(const base::Closure& callback, MojoResult result) {
|
| DCHECK_EQ(result, MOJO_RESULT_OK);
|
| callback.Run();
|
| @@ -230,11 +230,11 @@
|
| }
|
| }
|
|
|
| - mojo::SimpleWatcher* top_send_done_watcher() {
|
| + mojo::Watcher* top_send_done_watcher() {
|
| return top_send_done_watcher_;
|
| }
|
|
|
| - void set_top_send_done_watcher(mojo::SimpleWatcher* watcher) {
|
| + void set_top_send_done_watcher(mojo::Watcher* watcher) {
|
| top_send_done_watcher_ = watcher;
|
| }
|
|
|
| @@ -300,7 +300,7 @@
|
| // The current send done handle watcher for this thread. Used to maintain
|
| // a thread-local stack of send done watchers to ensure that nested sync
|
| // message loops complete correctly.
|
| - mojo::SimpleWatcher* top_send_done_watcher_;
|
| + mojo::Watcher* top_send_done_watcher_;
|
|
|
| // If not null, the address of a flag to set when the dispatch event signals,
|
| // in lieu of actually dispatching messages. This is used by
|
| @@ -527,8 +527,7 @@
|
| WaitableEvent* shutdown_event)
|
| : ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)),
|
| sync_handle_registry_(mojo::SyncHandleRegistry::current()),
|
| - dispatch_watcher_(FROM_HERE,
|
| - mojo::SimpleWatcher::ArmingPolicy::AUTOMATIC) {
|
| + dispatch_watcher_(FROM_HERE) {
|
| // The current (listener) thread must be distinct from the IPC thread, or else
|
| // sending synchronous messages will deadlock.
|
| DCHECK_NE(ipc_task_runner.get(), base::ThreadTaskRunnerHandle::Get().get());
|
| @@ -623,6 +622,7 @@
|
| context->received_sync_msgs()->UnblockDispatch();
|
| DCHECK(!error);
|
|
|
| +
|
| registry->UnregisterHandle(context->GetSendDoneEvent()->GetHandle());
|
| if (pump_messages_event)
|
| registry->UnregisterHandle(pump_messages_event->GetHandle());
|
| @@ -643,15 +643,14 @@
|
| }
|
|
|
| void SyncChannel::WaitForReplyWithNestedMessageLoop(SyncContext* context) {
|
| - mojo::SimpleWatcher send_done_watcher(
|
| - FROM_HERE, mojo::SimpleWatcher::ArmingPolicy::AUTOMATIC);
|
| + mojo::Watcher send_done_watcher(FROM_HERE);
|
|
|
| ReceivedSyncMsgQueue* sync_msg_queue = context->received_sync_msgs();
|
| DCHECK_NE(sync_msg_queue, nullptr);
|
|
|
| - mojo::SimpleWatcher* old_watcher = sync_msg_queue->top_send_done_watcher();
|
| + mojo::Watcher* old_watcher = sync_msg_queue->top_send_done_watcher();
|
| mojo::Handle old_handle(mojo::kInvalidHandleValue);
|
| - mojo::SimpleWatcher::ReadyCallback old_callback;
|
| + mojo::Watcher::ReadyCallback old_callback;
|
|
|
| // Maintain a thread-local stack of watchers to ensure nested calls complete
|
| // in the correct sequence, i.e. the outermost call completes first, etc.
|
| @@ -665,7 +664,7 @@
|
|
|
| {
|
| base::RunLoop nested_loop;
|
| - send_done_watcher.Watch(
|
| + send_done_watcher.Start(
|
| context->GetSendDoneEvent()->GetHandle(), MOJO_HANDLE_SIGNAL_READABLE,
|
| base::Bind(&RunOnHandleReady, nested_loop.QuitClosure()));
|
|
|
| @@ -677,7 +676,7 @@
|
|
|
| sync_msg_queue->set_top_send_done_watcher(old_watcher);
|
| if (old_watcher)
|
| - old_watcher->Watch(old_handle, MOJO_HANDLE_SIGNAL_READABLE, old_callback);
|
| + old_watcher->Start(old_handle, MOJO_HANDLE_SIGNAL_READABLE, old_callback);
|
| }
|
|
|
| void SyncChannel::OnDispatchHandleReady(MojoResult result) {
|
| @@ -691,10 +690,10 @@
|
| // messages once the listener thread is unblocked and pumping its task queue.
|
| // The ReceivedSyncMsgQueue also watches this event and may dispatch
|
| // immediately if woken up by a message which it's allowed to dispatch.
|
| - dispatch_watcher_.Watch(
|
| - sync_context()->GetDispatchEvent()->GetHandle(),
|
| - MOJO_HANDLE_SIGNAL_READABLE,
|
| - base::Bind(&SyncChannel::OnDispatchHandleReady, base::Unretained(this)));
|
| + dispatch_watcher_.Start(sync_context()->GetDispatchEvent()->GetHandle(),
|
| + MOJO_HANDLE_SIGNAL_READABLE,
|
| + base::Bind(&SyncChannel::OnDispatchHandleReady,
|
| + base::Unretained(this)));
|
| }
|
|
|
| void SyncChannel::OnChannelInit() {
|
|
|