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

Side by Side Diff: media/base/callback_util.h

Issue 10830146: Replace RunInSeries() and RunInParallel() with CallbackSeries helper class. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src
Patch Set: boom Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | media/base/callback_util.cc » ('j') | media/base/serial_runner.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #ifndef MEDIA_BASE_CALLBACK_UTIL_H_
6 #define MEDIA_BASE_CALLBACK_UTIL_H_
7
8 #include <queue>
9
10 #include "base/callback.h"
11 #include "base/memory/scoped_ptr.h"
12 #include "media/base/pipeline_status.h"
13
14 namespace media {
15
16 typedef base::Callback<void(const base::Closure&)> ClosureFunc;
17 typedef base::Callback<void(const PipelineStatusCB&)> PipelineStatusCBFunc;
18
19 // Executes the closures in FIFO order, executing |done_cb| when the last
20 // closure has completed running.
21 //
22 // All closures (including |done_cb|) are executed on same thread as the
23 // calling thread.
24 void RunInSeries(scoped_ptr<std::queue<ClosureFunc> > closures,
25 const base::Closure& done_cb);
26
27 // Executes the closures in FIFO order, executing |done_cb| when the last
28 // closure has completed running, reporting the final status code.
29 //
30 // Closures will stop being executed if a previous closure in the series
31 // returned an error status and |done_cb| will be executed prematurely.
32 //
33 // All closures (including |done_cb|) are executed on same thread as the
34 // calling thread.
35 void RunInSeriesWithStatus(
36 scoped_ptr<std::queue<PipelineStatusCBFunc> > status_cbs,
37 const PipelineStatusCB& done_cb);
38
39 // Executes the closures in parallel, executing |done_cb| when all closures have
40 // completed running.
41 //
42 // No attempt is made to parallelize execution of the closures. In other words,
43 // this method will run all closures in FIFO order if said closures execute
44 // synchronously on the same call stack.
45 //
46 // All closures (including |done_cb|) are executed on same thread as the
47 // calling thread.
48 void RunInParallel(scoped_ptr<std::queue<ClosureFunc> > closures,
49 const base::Closure& done_cb);
50
51 } // namespace media
52
53 #endif // MEDIA_BASE_CALLBACK_UTIL_H_
OLDNEW
« no previous file with comments | « no previous file | media/base/callback_util.cc » ('j') | media/base/serial_runner.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698