Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(585)

Unified Diff: media/audio/shared_mem_synchronizer.cc

Issue 9605015: Add a SharedMemSynchronizer class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address review comments from Ami Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/audio/shared_mem_synchronizer.cc
diff --git a/media/audio/shared_mem_synchronizer.cc b/media/audio/shared_mem_synchronizer.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a3487f69c50011cfd061ea6652d58a1ba8bd2200
--- /dev/null
+++ b/media/audio/shared_mem_synchronizer.cc
@@ -0,0 +1,28 @@
+// 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/shared_mem_synchronizer.h"
+
+#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
+
+SharedMemSynchronizer::SharedMemSynchronizer() {}
+
+SharedMemSynchronizer::WaitForMultiple::WaitForMultiple(
+ const SynchronizerVector* synchronizers)
+ : synchronizers_(synchronizers), last_(synchronizers_->size() - 1) {
Ami GONE FROM CHROMIUM 2012/03/13 20:08:02 Why init last_ (an unsigned type) to the result of
tommi (sloooow) - chröme 2012/03/14 13:32:43 Done.
+ DCHECK_GT(synchronizers_->size(), 0U);
Ami GONE FROM CHROMIUM 2012/03/13 20:08:02 clearer as DCHECK(!synchronizers_->empty());
tommi (sloooow) - chröme 2012/03/14 13:32:43 Done.
+}
+
+int SharedMemSynchronizer::WaitForMultiple::Wait() {
+ int ret = WaitMultiple(*synchronizers_, last_);
+ last_ = static_cast<size_t>(ret);
+ return ret;
+}
+
+void SharedMemSynchronizer::WaitForMultiple::Reset(
+ const SynchronizerVector* synchronizers) {
+ synchronizers_ = synchronizers;
+ DCHECK_GT(synchronizers_->size(), 0U);
Ami GONE FROM CHROMIUM 2012/03/13 20:08:02 ditto
Ami GONE FROM CHROMIUM 2012/03/13 20:08:02 reset next_start_offset_ (nee last_)?
tommi (sloooow) - chröme 2012/03/14 13:32:43 Done.
tommi (sloooow) - chröme 2012/03/14 13:32:43 Done.
+}

Powered by Google App Engine
This is Rietveld 408576698