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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 new SyncChannel(listener, ipc_task_runner, shutdown_event)); | 441 new SyncChannel(listener, ipc_task_runner, shutdown_event)); |
442 } | 442 } |
443 | 443 |
444 SyncChannel::SyncChannel( | 444 SyncChannel::SyncChannel( |
445 Listener* listener, | 445 Listener* listener, |
446 base::SingleThreadTaskRunner* ipc_task_runner, | 446 base::SingleThreadTaskRunner* ipc_task_runner, |
447 WaitableEvent* shutdown_event) | 447 WaitableEvent* shutdown_event) |
448 : ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)) { | 448 : ChannelProxy(new SyncContext(listener, ipc_task_runner, shutdown_event)) { |
449 // The current (listener) thread must be distinct from the IPC thread, or else | 449 // The current (listener) thread must be distinct from the IPC thread, or else |
450 // sending synchronous messages will deadlock. | 450 // sending synchronous messages will deadlock. |
451 DCHECK_NE(ipc_task_runner, base::ThreadTaskRunnerHandle::Get()); | 451 DCHECK_NE(ipc_task_runner, base::ThreadTaskRunnerHandle::Get().get()); |
452 StartWatching(); | 452 StartWatching(); |
453 } | 453 } |
454 | 454 |
455 SyncChannel::~SyncChannel() { | 455 SyncChannel::~SyncChannel() { |
456 } | 456 } |
457 | 457 |
458 void SyncChannel::SetRestrictDispatchChannelGroup(int group) { | 458 void SyncChannel::SetRestrictDispatchChannelGroup(int group) { |
459 sync_context()->set_restrict_dispatch_group(group); | 459 sync_context()->set_restrict_dispatch_group(group); |
460 } | 460 } |
461 | 461 |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
578 // manual reset since the object watcher might otherwise reset the event | 578 // manual reset since the object watcher might otherwise reset the event |
579 // when we're doing a WaitMany. | 579 // when we're doing a WaitMany. |
580 dispatch_watcher_callback_ = | 580 dispatch_watcher_callback_ = |
581 base::Bind(&SyncChannel::OnWaitableEventSignaled, | 581 base::Bind(&SyncChannel::OnWaitableEventSignaled, |
582 base::Unretained(this)); | 582 base::Unretained(this)); |
583 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), | 583 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), |
584 dispatch_watcher_callback_); | 584 dispatch_watcher_callback_); |
585 } | 585 } |
586 | 586 |
587 } // namespace IPC | 587 } // namespace IPC |
OLD | NEW |