Chromium Code Reviews| Index: media/audio/cross_process_notification.cc |
| diff --git a/media/audio/cross_process_notification.cc b/media/audio/cross_process_notification.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..1b3b7be4cb64ff2255217548def961c98cf4e177 |
| --- /dev/null |
| +++ b/media/audio/cross_process_notification.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "media/audio/cross_process_notification.h" |
| + |
| +#include "base/logging.h" |
| +#include "base/memory/scoped_ptr.h" |
| + |
| +CrossProcessNotification::CrossProcessNotification() {} |
| + |
| +CrossProcessNotification::WaitForMultiple::WaitForMultiple( |
| + const Notifications* notifications) |
|
Ami GONE FROM CHROMIUM
2012/03/14 16:40:51
FWIW the initializer-list & ctor body can both be
tommi (sloooow) - chröme
2012/03/14 21:20:38
Done.
|
| + : notifications_(notifications), wait_offset_(0) { |
| + DCHECK(!notifications_->empty()); |
| +} |
| + |
| +int CrossProcessNotification::WaitForMultiple::Wait() { |
| + DCHECK(CalledOnValidThread()); |
| + int ret = WaitMultiple(*notifications_, wait_offset_); |
| + wait_offset_ = (static_cast<size_t>(ret) + 1) % notifications_->size(); |
|
Ami GONE FROM CHROMIUM
2012/03/14 16:40:51
Is the static_cast<size_t>() really necessary?
(I
tommi (sloooow) - chröme
2012/03/14 21:20:38
it's not necessary. removed.
|
| + return ret; |
| +} |
| + |
| +void CrossProcessNotification::WaitForMultiple::Reset( |
| + const Notifications* notifications) { |
| + DCHECK(CalledOnValidThread()); |
| + wait_offset_ = 0; |
| + notifications_ = notifications; |
| + DCHECK(!notifications_->empty()); |
| +} |