| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/threading/thread_local.h" | 9 #include "base/threading/thread_local.h" |
| 10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 top_send_done_watcher_ = watcher; | 162 top_send_done_watcher_ = watcher; |
| 163 } | 163 } |
| 164 | 164 |
| 165 private: | 165 private: |
| 166 friend class base::RefCountedThreadSafe<ReceivedSyncMsgQueue>; | 166 friend class base::RefCountedThreadSafe<ReceivedSyncMsgQueue>; |
| 167 | 167 |
| 168 // See the comment in SyncChannel::SyncChannel for why this event is created | 168 // See the comment in SyncChannel::SyncChannel for why this event is created |
| 169 // as manual reset. | 169 // as manual reset. |
| 170 ReceivedSyncMsgQueue() : | 170 ReceivedSyncMsgQueue() : |
| 171 dispatch_event_(true, false), | 171 dispatch_event_(true, false), |
| 172 listener_message_loop_(base::MessageLoopProxy::CreateForCurrentThread()), | 172 listener_message_loop_(base::MessageLoopProxy::current()), |
| 173 task_pending_(false), | 173 task_pending_(false), |
| 174 listener_count_(0), | 174 listener_count_(0), |
| 175 top_send_done_watcher_(NULL) { | 175 top_send_done_watcher_(NULL) { |
| 176 } | 176 } |
| 177 | 177 |
| 178 ~ReceivedSyncMsgQueue() {} | 178 ~ReceivedSyncMsgQueue() {} |
| 179 | 179 |
| 180 // Holds information about a queued synchronous message or reply. | 180 // Holds information about a queued synchronous message or reply. |
| 181 struct QueuedMessage { | 181 struct QueuedMessage { |
| 182 QueuedMessage(Message* m, SyncContext* c) : message(m), context(c) { } | 182 QueuedMessage(Message* m, SyncContext* c) : message(m), context(c) { } |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 504 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { | 504 void SyncChannel::OnWaitableEventSignaled(WaitableEvent* event) { |
| 505 DCHECK(event == sync_context()->GetDispatchEvent()); | 505 DCHECK(event == sync_context()->GetDispatchEvent()); |
| 506 // The call to DispatchMessages might delete this object, so reregister | 506 // The call to DispatchMessages might delete this object, so reregister |
| 507 // the object watcher first. | 507 // the object watcher first. |
| 508 event->Reset(); | 508 event->Reset(); |
| 509 dispatch_watcher_.StartWatching(event, this); | 509 dispatch_watcher_.StartWatching(event, this); |
| 510 sync_context()->DispatchMessages(); | 510 sync_context()->DispatchMessages(); |
| 511 } | 511 } |
| 512 | 512 |
| 513 } // namespace IPC | 513 } // namespace IPC |
| OLD | NEW |