| 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 <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include "chrome/common/ipc_sync_channel.h" | 7 #include "chrome/common/ipc_sync_channel.h" |
| 8 | 8 |
| 9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/thread_local.h" | 11 #include "base/thread_local.h" |
| 12 #include "chrome/common/child_process.h" | 12 #include "chrome/common/child_process.h" |
| 13 #include "chrome/common/ipc_logging.h" | 13 #include "chrome/common/ipc_logging.h" |
| 14 #include "chrome/common/ipc_sync_message.h" | 14 #include "chrome/common/ipc_sync_message.h" |
| 15 | 15 |
| 16 using base::TimeDelta; |
| 17 using base::TimeTicks; |
| 16 | 18 |
| 17 namespace IPC { | 19 namespace IPC { |
| 18 // When we're blocked in a Send(), we need to process incoming synchronous | 20 // When we're blocked in a Send(), we need to process incoming synchronous |
| 19 // messages right away because it could be blocking our reply (either | 21 // messages right away because it could be blocking our reply (either |
| 20 // directly from the same object we're calling, or indirectly through one or | 22 // directly from the same object we're calling, or indirectly through one or |
| 21 // more other channels). That means that in SyncContext's OnMessageReceived, | 23 // more other channels). That means that in SyncContext's OnMessageReceived, |
| 22 // we need to process sync message right away if we're blocked. However a | 24 // we need to process sync message right away if we're blocked. However a |
| 23 // simple check isn't sufficient, because the listener thread can be in the | 25 // simple check isn't sufficient, because the listener thread can be in the |
| 24 // process of calling Send. | 26 // process of calling Send. |
| 25 // To work around this, when SyncChannel filters a sync message, it sets | 27 // To work around this, when SyncChannel filters a sync message, it sets |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 dispatch_watcher_.StartWatching(dispatch_event, this); | 473 dispatch_watcher_.StartWatching(dispatch_event, this); |
| 472 sync_context()->DispatchMessages(); | 474 sync_context()->DispatchMessages(); |
| 473 } else { | 475 } else { |
| 474 // We got the reply, timed out or the process shutdown. | 476 // We got the reply, timed out or the process shutdown. |
| 475 DCHECK(object == sync_context()->GetSendDoneEvent()); | 477 DCHECK(object == sync_context()->GetSendDoneEvent()); |
| 476 MessageLoop::current()->Quit(); | 478 MessageLoop::current()->Quit(); |
| 477 } | 479 } |
| 478 } | 480 } |
| 479 | 481 |
| 480 } // namespace IPC | 482 } // namespace IPC |
| OLD | NEW |