| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/common/ipc_sync_channel.h" | 5 #include "chrome/common/ipc_sync_channel.h" |
| 6 | 6 |
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/thread_local.h" | 9 #include "base/thread_local.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 return true; | 381 return true; |
| 382 } | 382 } |
| 383 | 383 |
| 384 // *this* might get deleted in WaitForReply. | 384 // *this* might get deleted in WaitForReply. |
| 385 scoped_refptr<SyncContext> context(sync_context()); | 385 scoped_refptr<SyncContext> context(sync_context()); |
| 386 if (context->shutdown_event()->IsSignaled()) { | 386 if (context->shutdown_event()->IsSignaled()) { |
| 387 delete message; | 387 delete message; |
| 388 return false; | 388 return false; |
| 389 } | 389 } |
| 390 | 390 |
| 391 DCHECK(sync_messages_with_no_timeout_allowed_ || timeout_ms != base::kNoTimeou
t); | 391 DCHECK(sync_messages_with_no_timeout_allowed_ || |
| 392 timeout_ms != base::kNoTimeout); |
| 392 SyncMessage* sync_msg = static_cast<SyncMessage*>(message); | 393 SyncMessage* sync_msg = static_cast<SyncMessage*>(message); |
| 393 context->Push(sync_msg); | 394 context->Push(sync_msg); |
| 394 int message_id = SyncMessage::GetMessageId(*sync_msg); | 395 int message_id = SyncMessage::GetMessageId(*sync_msg); |
| 395 WaitableEvent* pump_messages_event = sync_msg->pump_messages_event(); | 396 WaitableEvent* pump_messages_event = sync_msg->pump_messages_event(); |
| 396 | 397 |
| 397 ChannelProxy::Send(message); | 398 ChannelProxy::Send(message); |
| 398 | 399 |
| 399 if (timeout_ms != base::kNoTimeout) { | 400 if (timeout_ms != base::kNoTimeout) { |
| 400 // We use the sync message id so that when a message times out, we don't | 401 // We use the sync message id so that when a message times out, we don't |
| 401 // confuse it with another send that is either above/below this Send in | 402 // confuse it with another send that is either above/below this Send in |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 457 dispatch_watcher_.StartWatching(dispatch_event, this); | 458 dispatch_watcher_.StartWatching(dispatch_event, this); |
| 458 sync_context()->DispatchMessages(); | 459 sync_context()->DispatchMessages(); |
| 459 } else { | 460 } else { |
| 460 // We got the reply, timed out or the process shutdown. | 461 // We got the reply, timed out or the process shutdown. |
| 461 DCHECK(event == sync_context()->GetSendDoneEvent()); | 462 DCHECK(event == sync_context()->GetSendDoneEvent()); |
| 462 MessageLoop::current()->Quit(); | 463 MessageLoop::current()->Quit(); |
| 463 } | 464 } |
| 464 } | 465 } |
| 465 | 466 |
| 466 } // namespace IPC | 467 } // namespace IPC |
| OLD | NEW |