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

Unified Diff: media/base/callback_util.h

Issue 10753021: Move AudioRenderer out of Filter heirarchy. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: woot for RunInSeries/Parallel Created 8 years, 5 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/base/callback_util.h
diff --git a/media/base/callback_util.h b/media/base/callback_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..22b9253daadfdd86eeffe9038b32b9829a065660
--- /dev/null
+++ b/media/base/callback_util.h
@@ -0,0 +1,39 @@
+// 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.
+
+#ifndef MEDIA_BASE_CALLBACK_UTIL_H_
+#define MEDIA_BASE_CALLBACK_UTIL_H_
+
+#include <queue>
+
+#include "base/callback.h"
+#include "base/memory/scoped_ptr.h"
+
+namespace media {
+
+typedef base::Callback<void(const base::Closure&)> ClosureCB;
+
+// Executes the closures in FIFO order, executing |done_cb| when the last
+// closure has completed running.
+//
+// |done_cb| will be executed on the same thread as the last completed closure
+// or the current thread if |closures| is empty.
+void RunInSeries(scoped_ptr<std::queue<ClosureCB> > closures,
+ const base::Closure& done_cb);
+
+// Executes the closures in parallel, executing |done_cb| when all closures have
+// completed running.
+//
+// No attempt is made to parallelize execution of the closures. In other words,
+// this method will run all closures in FIFO order if said closures execute
+// synchronously on the same call stack.
+//
+// |done_cb| will be executed on the same thread as the last completed closure
+// or the current thread if |closures| is empty.
+void RunInParallel(scoped_ptr<std::queue<ClosureCB> > closures,
+ const base::Closure& done_cb);
+
+} // namespace media
+
+#endif // MEDIA_BASE_CALLBACK_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698