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 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 | 435 |
436 bool SyncChannel::Send(Message* message) { | 436 bool SyncChannel::Send(Message* message) { |
437 return SendWithTimeout(message, base::kNoTimeout); | 437 return SendWithTimeout(message, base::kNoTimeout); |
438 } | 438 } |
439 | 439 |
440 bool SyncChannel::SendWithTimeout(Message* message, int timeout_ms) { | 440 bool SyncChannel::SendWithTimeout(Message* message, int timeout_ms) { |
441 #ifdef IPC_MESSAGE_LOG_ENABLED | 441 #ifdef IPC_MESSAGE_LOG_ENABLED |
442 Logging* logger = Logging::GetInstance(); | 442 Logging* logger = Logging::GetInstance(); |
443 std::string name; | 443 std::string name; |
444 logger->GetMessageText(message->type(), &name, message, NULL); | 444 logger->GetMessageText(message->type(), &name, message, NULL); |
445 TRACE_EVENT1("task", "SyncChannel::SendWithTimeout", | 445 TRACE_EVENT1("toplevel", "SyncChannel::SendWithTimeout", |
446 "name", name); | 446 "name", name); |
447 #else | 447 #else |
448 TRACE_EVENT2("task", "SyncChannel::SendWithTimeout", | 448 TRACE_EVENT2("toplevel", "SyncChannel::SendWithTimeout", |
449 "class", IPC_MESSAGE_ID_CLASS(message->type()), | 449 "class", IPC_MESSAGE_ID_CLASS(message->type()), |
450 "line", IPC_MESSAGE_ID_LINE(message->type())); | 450 "line", IPC_MESSAGE_ID_LINE(message->type())); |
451 #endif | 451 #endif |
452 if (!message->is_sync()) { | 452 if (!message->is_sync()) { |
453 ChannelProxy::Send(message); | 453 ChannelProxy::Send(message); |
454 return true; | 454 return true; |
455 } | 455 } |
456 | 456 |
457 // *this* might get deleted in WaitForReply. | 457 // *this* might get deleted in WaitForReply. |
458 scoped_refptr<SyncContext> context(sync_context()); | 458 scoped_refptr<SyncContext> context(sync_context()); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 // manual reset since the object watcher might otherwise reset the event | 570 // manual reset since the object watcher might otherwise reset the event |
571 // when we're doing a WaitMany. | 571 // when we're doing a WaitMany. |
572 dispatch_watcher_callback_ = | 572 dispatch_watcher_callback_ = |
573 base::Bind(&SyncChannel::OnWaitableEventSignaled, | 573 base::Bind(&SyncChannel::OnWaitableEventSignaled, |
574 base::Unretained(this)); | 574 base::Unretained(this)); |
575 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), | 575 dispatch_watcher_.StartWatching(sync_context()->GetDispatchEvent(), |
576 dispatch_watcher_callback_); | 576 dispatch_watcher_callback_); |
577 } | 577 } |
578 | 578 |
579 } // namespace IPC | 579 } // namespace IPC |
OLD | NEW |