| 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/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 StartWatching(); | 453 StartWatching(); |
| 454 } | 454 } |
| 455 | 455 |
| 456 SyncChannel::~SyncChannel() { | 456 SyncChannel::~SyncChannel() { |
| 457 } | 457 } |
| 458 | 458 |
| 459 void SyncChannel::SetRestrictDispatchChannelGroup(int group) { | 459 void SyncChannel::SetRestrictDispatchChannelGroup(int group) { |
| 460 sync_context()->set_restrict_dispatch_group(group); | 460 sync_context()->set_restrict_dispatch_group(group); |
| 461 } | 461 } |
| 462 | 462 |
| 463 scoped_refptr<SyncMessageFilter> SyncChannel::CreateSyncMessageFilter() { |
| 464 scoped_refptr<SyncMessageFilter> filter = new SyncMessageFilter( |
| 465 sync_context()->shutdown_event(), |
| 466 sync_context()->IsChannelSendThreadSafe()); |
| 467 AddFilter(filter.get()); |
| 468 return filter; |
| 469 } |
| 470 |
| 463 bool SyncChannel::Send(Message* message) { | 471 bool SyncChannel::Send(Message* message) { |
| 464 #ifdef IPC_MESSAGE_LOG_ENABLED | 472 #ifdef IPC_MESSAGE_LOG_ENABLED |
| 465 std::string name; | 473 std::string name; |
| 466 Logging::GetInstance()->GetMessageText(message->type(), &name, message, NULL); | 474 Logging::GetInstance()->GetMessageText(message->type(), &name, message, NULL); |
| 467 TRACE_EVENT1("ipc", "SyncChannel::Send", "name", name); | 475 TRACE_EVENT1("ipc", "SyncChannel::Send", "name", name); |
| 468 #else | 476 #else |
| 469 TRACE_EVENT2("ipc", "SyncChannel::Send", | 477 TRACE_EVENT2("ipc", "SyncChannel::Send", |
| 470 "class", IPC_MESSAGE_ID_CLASS(message->type()), | 478 "class", IPC_MESSAGE_ID_CLASS(message->type()), |
| 471 "line", IPC_MESSAGE_ID_LINE(message->type())); | 479 "line", IPC_MESSAGE_ID_LINE(message->type())); |
| 472 #endif | 480 #endif |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 // manual reset since the object watcher might otherwise reset the event | 586 // manual reset since the object watcher might otherwise reset the event |
| 579 // when we're doing a WaitMany. | 587 // when we're doing a WaitMany. |
| 580 dispatch_watcher_callback_ = | 588 dispatch_watcher_callback_ = |
| 581 base::Bind(&SyncChannel::OnWaitableEventSignaled, | 589 base::Bind(&SyncChannel::OnWaitableEventSignaled, |
| 582 base::Unretained(this)); | 590 base::Unretained(this)); |
| 583 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), | 591 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), |
| 584 dispatch_watcher_callback_); | 592 dispatch_watcher_callback_); |
| 585 } | 593 } |
| 586 | 594 |
| 587 } // namespace IPC | 595 } // namespace IPC |
| OLD | NEW |