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 #include "media/base/serial_runner.h" | 5 #include "media/base/serial_runner.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
9 #include "base/location.h" | 9 #include "base/location.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 static void RunOnTaskRunner( | 33 static void RunOnTaskRunner( |
34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, | 34 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner, |
35 const PipelineStatusCB& status_cb, | 35 const PipelineStatusCB& status_cb, |
36 PipelineStatus last_status) { | 36 PipelineStatus last_status) { |
37 // Force post to permit cancellation of a series in the scenario where all | 37 // Force post to permit cancellation of a series in the scenario where all |
38 // bound functions run on the same thread. | 38 // bound functions run on the same thread. |
39 task_runner->PostTask(FROM_HERE, base::Bind(status_cb, last_status)); | 39 task_runner->PostTask(FROM_HERE, base::Bind(status_cb, last_status)); |
40 } | 40 } |
41 | 41 |
42 SerialRunner::Queue::Queue() {} | 42 SerialRunner::Queue::Queue() {} |
| 43 SerialRunner::Queue::Queue(const Queue& other) = default; |
43 SerialRunner::Queue::~Queue() {} | 44 SerialRunner::Queue::~Queue() {} |
44 | 45 |
45 void SerialRunner::Queue::Push(const base::Closure& closure) { | 46 void SerialRunner::Queue::Push(const base::Closure& closure) { |
46 bound_fns_.push(base::Bind(&RunClosure, closure)); | 47 bound_fns_.push(base::Bind(&RunClosure, closure)); |
47 } | 48 } |
48 | 49 |
49 void SerialRunner::Queue::Push( | 50 void SerialRunner::Queue::Push( |
50 const BoundClosure& bound_closure) { | 51 const BoundClosure& bound_closure) { |
51 bound_fns_.push(base::Bind(&RunBoundClosure, bound_closure)); | 52 bound_fns_.push(base::Bind(&RunBoundClosure, bound_closure)); |
52 } | 53 } |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 105 } |
105 | 106 |
106 BoundPipelineStatusCB bound_fn = bound_fns_.Pop(); | 107 BoundPipelineStatusCB bound_fn = bound_fns_.Pop(); |
107 bound_fn.Run(base::Bind( | 108 bound_fn.Run(base::Bind( |
108 &RunOnTaskRunner, | 109 &RunOnTaskRunner, |
109 task_runner_, | 110 task_runner_, |
110 base::Bind(&SerialRunner::RunNextInSeries, weak_factory_.GetWeakPtr()))); | 111 base::Bind(&SerialRunner::RunNextInSeries, weak_factory_.GetWeakPtr()))); |
111 } | 112 } |
112 | 113 |
113 } // namespace media | 114 } // namespace media |
OLD | NEW |