OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "media/audio/cross_process_notification.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 |
| 10 CrossProcessNotification::CrossProcessNotification() {} |
| 11 |
| 12 CrossProcessNotification::WaitForMultiple::WaitForMultiple( |
| 13 const Notifications* notifications) { |
| 14 Reset(notifications); |
| 15 } |
| 16 |
| 17 int CrossProcessNotification::WaitForMultiple::Wait() { |
| 18 DCHECK(CalledOnValidThread()); |
| 19 int ret = WaitMultiple(*notifications_, wait_offset_); |
| 20 wait_offset_ = (ret + 1) % notifications_->size(); |
| 21 return ret; |
| 22 } |
| 23 |
| 24 void CrossProcessNotification::WaitForMultiple::Reset( |
| 25 const Notifications* notifications) { |
| 26 DCHECK(CalledOnValidThread()); |
| 27 wait_offset_ = 0; |
| 28 notifications_ = notifications; |
| 29 DCHECK(!notifications_->empty()); |
| 30 } |
OLD | NEW |