OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_BASE_SERIAL_RUNNER_H_ | 5 #ifndef MEDIA_BASE_SERIAL_RUNNER_H_ |
6 #define MEDIA_BASE_SERIAL_RUNNER_H_ | 6 #define MEDIA_BASE_SERIAL_RUNNER_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 public: | 27 public: |
28 typedef base::Callback<void(const base::Closure&)> BoundClosure; | 28 typedef base::Callback<void(const base::Closure&)> BoundClosure; |
29 typedef base::Callback<void(const PipelineStatusCB&)> BoundPipelineStatusCB; | 29 typedef base::Callback<void(const PipelineStatusCB&)> BoundPipelineStatusCB; |
30 | 30 |
31 // Serial queue of bound functions to run. | 31 // Serial queue of bound functions to run. |
32 class MEDIA_EXPORT Queue { | 32 class MEDIA_EXPORT Queue { |
33 public: | 33 public: |
34 Queue(); | 34 Queue(); |
35 ~Queue(); | 35 ~Queue(); |
36 | 36 |
| 37 void Push(const base::Closure& closure); |
37 void Push(const BoundClosure& bound_fn); | 38 void Push(const BoundClosure& bound_fn); |
38 void Push(const BoundPipelineStatusCB& bound_fn); | 39 void Push(const BoundPipelineStatusCB& bound_fn); |
39 | 40 |
40 private: | 41 private: |
41 friend class SerialRunner; | 42 friend class SerialRunner; |
42 | 43 |
43 BoundPipelineStatusCB Pop(); | 44 BoundPipelineStatusCB Pop(); |
44 bool empty(); | 45 bool empty(); |
45 | 46 |
46 std::queue<BoundPipelineStatusCB> bound_fns_; | 47 std::queue<BoundPipelineStatusCB> bound_fns_; |
(...skipping 30 matching lines...) Expand all Loading... |
77 | 78 |
78 // NOTE: Weak pointers must be invalidated before all other member variables. | 79 // NOTE: Weak pointers must be invalidated before all other member variables. |
79 base::WeakPtrFactory<SerialRunner> weak_factory_; | 80 base::WeakPtrFactory<SerialRunner> weak_factory_; |
80 | 81 |
81 DISALLOW_COPY_AND_ASSIGN(SerialRunner); | 82 DISALLOW_COPY_AND_ASSIGN(SerialRunner); |
82 }; | 83 }; |
83 | 84 |
84 } // namespace media | 85 } // namespace media |
85 | 86 |
86 #endif // MEDIA_BASE_SERIAL_RUNNER_H_ | 87 #endif // MEDIA_BASE_SERIAL_RUNNER_H_ |
OLD | NEW |