| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ipc/ipc_sync_channel.h" | 5 #include "ipc/ipc_sync_channel.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/lazy_instance.h" | 13 #include "base/lazy_instance.h" |
| 14 #include "base/location.h" | 14 #include "base/location.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/memory/ptr_util.h" | 16 #include "base/memory/ptr_util.h" |
| 17 #include "base/run_loop.h" |
| 17 #include "base/synchronization/waitable_event.h" | 18 #include "base/synchronization/waitable_event.h" |
| 18 #include "base/synchronization/waitable_event_watcher.h" | 19 #include "base/synchronization/waitable_event_watcher.h" |
| 19 #include "base/threading/thread_local.h" | 20 #include "base/threading/thread_local.h" |
| 20 #include "base/threading/thread_task_runner_handle.h" | 21 #include "base/threading/thread_task_runner_handle.h" |
| 21 #include "base/trace_event/trace_event.h" | 22 #include "base/trace_event/trace_event.h" |
| 22 #include "ipc/ipc_channel_factory.h" | 23 #include "ipc/ipc_channel_factory.h" |
| 23 #include "ipc/ipc_logging.h" | 24 #include "ipc/ipc_logging.h" |
| 24 #include "ipc/ipc_message_macros.h" | 25 #include "ipc/ipc_message_macros.h" |
| 25 #include "ipc/ipc_sync_message.h" | 26 #include "ipc/ipc_sync_message.h" |
| 26 | 27 |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 } | 560 } |
| 560 | 561 |
| 561 sync_msg_queue->set_top_send_done_watcher(&send_done_watcher); | 562 sync_msg_queue->set_top_send_done_watcher(&send_done_watcher); |
| 562 | 563 |
| 563 send_done_watcher.StartWatching(context->GetSendDoneEvent(), | 564 send_done_watcher.StartWatching(context->GetSendDoneEvent(), |
| 564 context->MakeWaitableEventCallback()); | 565 context->MakeWaitableEventCallback()); |
| 565 | 566 |
| 566 { | 567 { |
| 567 base::MessageLoop::ScopedNestableTaskAllower allow( | 568 base::MessageLoop::ScopedNestableTaskAllower allow( |
| 568 base::MessageLoop::current()); | 569 base::MessageLoop::current()); |
| 569 base::MessageLoop::current()->Run(); | 570 base::RunLoop().Run(); |
| 570 } | 571 } |
| 571 | 572 |
| 572 sync_msg_queue->set_top_send_done_watcher(old_send_done_event_watcher); | 573 sync_msg_queue->set_top_send_done_watcher(old_send_done_event_watcher); |
| 573 if (old_send_done_event_watcher && old_event) { | 574 if (old_send_done_event_watcher && old_event) { |
| 574 old_send_done_event_watcher->StartWatching(old_event, old_callback); | 575 old_send_done_event_watcher->StartWatching(old_event, old_callback); |
| 575 } | 576 } |
| 576 } | 577 } |
| 577 | 578 |
| 578 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { | 579 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { |
| 579 DCHECK(event == sync_context()->GetDispatchEvent()); | 580 DCHECK(event == sync_context()->GetDispatchEvent()); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 600 | 601 |
| 601 void SyncChannel::OnChannelInit() { | 602 void SyncChannel::OnChannelInit() { |
| 602 for (const auto& filter : pre_init_sync_message_filters_) { | 603 for (const auto& filter : pre_init_sync_message_filters_) { |
| 603 filter->set_is_channel_send_thread_safe( | 604 filter->set_is_channel_send_thread_safe( |
| 604 context()->IsChannelSendThreadSafe()); | 605 context()->IsChannelSendThreadSafe()); |
| 605 } | 606 } |
| 606 pre_init_sync_message_filters_.clear(); | 607 pre_init_sync_message_filters_.clear(); |
| 607 } | 608 } |
| 608 | 609 |
| 609 } // namespace IPC | 610 } // namespace IPC |
| OLD | NEW |