OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "cc/debug/micro_benchmark_controller_impl.h" | 5 #include "cc/debug/micro_benchmark_controller_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "cc/trees/layer_tree_host_impl.h" | 11 #include "cc/trees/layer_tree_host_impl.h" |
12 | 12 |
13 namespace cc { | 13 namespace cc { |
14 | 14 |
15 MicroBenchmarkControllerImpl::MicroBenchmarkControllerImpl( | 15 MicroBenchmarkControllerImpl::MicroBenchmarkControllerImpl( |
16 LayerTreeHostImpl* host) | 16 LayerTreeHostImpl* host) |
17 : host_(host) { | 17 : host_(host) { |
18 DCHECK(host_); | 18 DCHECK(host_); |
19 } | 19 } |
20 | 20 |
21 MicroBenchmarkControllerImpl::~MicroBenchmarkControllerImpl() {} | 21 MicroBenchmarkControllerImpl::~MicroBenchmarkControllerImpl() {} |
22 | 22 |
23 void MicroBenchmarkControllerImpl::ScheduleRun( | 23 void MicroBenchmarkControllerImpl::ScheduleRun( |
24 scoped_ptr<MicroBenchmarkImpl> benchmark) { | 24 std::unique_ptr<MicroBenchmarkImpl> benchmark) { |
25 benchmarks_.push_back(std::move(benchmark)); | 25 benchmarks_.push_back(std::move(benchmark)); |
26 } | 26 } |
27 | 27 |
28 void MicroBenchmarkControllerImpl::DidCompleteCommit() { | 28 void MicroBenchmarkControllerImpl::DidCompleteCommit() { |
29 for (const auto& benchmark : benchmarks_) { | 29 for (const auto& benchmark : benchmarks_) { |
30 DCHECK(!benchmark->IsDone()); | 30 DCHECK(!benchmark->IsDone()); |
31 benchmark->DidCompleteCommit(host_); | 31 benchmark->DidCompleteCommit(host_); |
32 } | 32 } |
33 | 33 |
34 CleanUpFinishedBenchmarks(); | 34 CleanUpFinishedBenchmarks(); |
35 } | 35 } |
36 | 36 |
37 void MicroBenchmarkControllerImpl::CleanUpFinishedBenchmarks() { | 37 void MicroBenchmarkControllerImpl::CleanUpFinishedBenchmarks() { |
38 benchmarks_.erase( | 38 benchmarks_.erase( |
39 std::remove_if(benchmarks_.begin(), benchmarks_.end(), | 39 std::remove_if(benchmarks_.begin(), benchmarks_.end(), |
40 [](const scoped_ptr<MicroBenchmarkImpl>& benchmark) { | 40 [](const std::unique_ptr<MicroBenchmarkImpl>& benchmark) { |
41 return benchmark->IsDone(); | 41 return benchmark->IsDone(); |
42 }), | 42 }), |
43 benchmarks_.end()); | 43 benchmarks_.end()); |
44 } | 44 } |
45 | 45 |
46 } // namespace cc | 46 } // namespace cc |
OLD | NEW |