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

Side by Side Diff: media/base/serial_runner.cc

Issue 1906423005: Replace scoped_ptr with std::unique_ptr in //media/base. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptr-media-base: . Created 4 years, 8 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
OLDNEW
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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 weak_factory_.GetWeakPtr(), 81 weak_factory_.GetWeakPtr(),
82 PIPELINE_OK)); 82 PIPELINE_OK));
83 return; 83 return;
84 } 84 }
85 85
86 RunNextInSeries(PIPELINE_OK); 86 RunNextInSeries(PIPELINE_OK);
87 } 87 }
88 88
89 SerialRunner::~SerialRunner() {} 89 SerialRunner::~SerialRunner() {}
90 90
91 scoped_ptr<SerialRunner> SerialRunner::Run( 91 std::unique_ptr<SerialRunner> SerialRunner::Run(
92 const Queue& bound_fns, const PipelineStatusCB& done_cb) { 92 const Queue& bound_fns,
93 scoped_ptr<SerialRunner> callback_series( 93 const PipelineStatusCB& done_cb) {
94 std::unique_ptr<SerialRunner> callback_series(
94 new SerialRunner(bound_fns, done_cb)); 95 new SerialRunner(bound_fns, done_cb));
95 return callback_series; 96 return callback_series;
96 } 97 }
97 98
98 void SerialRunner::RunNextInSeries(PipelineStatus last_status) { 99 void SerialRunner::RunNextInSeries(PipelineStatus last_status) {
99 DCHECK(task_runner_->BelongsToCurrentThread()); 100 DCHECK(task_runner_->BelongsToCurrentThread());
100 DCHECK(!done_cb_.is_null()); 101 DCHECK(!done_cb_.is_null());
101 102
102 if (bound_fns_.empty() || last_status != PIPELINE_OK) { 103 if (bound_fns_.empty() || last_status != PIPELINE_OK) {
103 base::ResetAndReturn(&done_cb_).Run(last_status); 104 base::ResetAndReturn(&done_cb_).Run(last_status);
104 return; 105 return;
105 } 106 }
106 107
107 BoundPipelineStatusCB bound_fn = bound_fns_.Pop(); 108 BoundPipelineStatusCB bound_fn = bound_fns_.Pop();
108 bound_fn.Run(base::Bind( 109 bound_fn.Run(base::Bind(
109 &RunOnTaskRunner, 110 &RunOnTaskRunner,
110 task_runner_, 111 task_runner_,
111 base::Bind(&SerialRunner::RunNextInSeries, weak_factory_.GetWeakPtr()))); 112 base::Bind(&SerialRunner::RunNextInSeries, weak_factory_.GetWeakPtr())));
112 } 113 }
113 114
114 } // namespace media 115 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698