Chromium Code Reviews| Index: cc/debug/micro_benchmark_controller.cc |
| diff --git a/cc/debug/micro_benchmark_controller.cc b/cc/debug/micro_benchmark_controller.cc |
| index a0dc306612fa77c0d65a0c45ce3adf488eaf64ed..8353e99c4a44c000438b457255a2bb93cd6fc205 100644 |
| --- a/cc/debug/micro_benchmark_controller.cc |
| +++ b/cc/debug/micro_benchmark_controller.cc |
| @@ -37,16 +37,6 @@ scoped_ptr<MicroBenchmark> CreateBenchmark( |
| return nullptr; |
| } |
| -class IsDonePredicate { |
| - public: |
| - typedef const MicroBenchmark* argument_type; |
| - typedef bool result_type; |
| - |
| - result_type operator()(argument_type benchmark) const { |
| - return benchmark->IsDone(); |
| - } |
| -}; |
| - |
| } // namespace |
| MicroBenchmarkController::MicroBenchmarkController(LayerTreeHost* host) |
| @@ -85,9 +75,9 @@ int MicroBenchmarkController::GetNextIdAndIncrement() { |
| bool MicroBenchmarkController::SendMessage(int id, |
| scoped_ptr<base::Value> value) { |
| - for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin(); |
| - it != benchmarks_.end(); |
| - ++it) { |
| + for (std::vector<scoped_ptr<MicroBenchmark>>::iterator it = |
|
danakj
2015/11/17 01:12:16
auto. also range-based?
vmpstr
2015/11/17 23:26:23
Done.
|
| + benchmarks_.begin(); |
| + it != benchmarks_.end(); ++it) { |
| if ((*it)->id() == id) |
| return (*it)->ProcessMessage(value.Pass()); |
| } |
| @@ -96,9 +86,9 @@ bool MicroBenchmarkController::SendMessage(int id, |
| void MicroBenchmarkController::ScheduleImplBenchmarks( |
| LayerTreeHostImpl* host_impl) { |
| - for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin(); |
| - it != benchmarks_.end(); |
| - ++it) { |
| + for (std::vector<scoped_ptr<MicroBenchmark>>::iterator it = |
| + benchmarks_.begin(); |
| + it != benchmarks_.end(); ++it) { |
| scoped_ptr<MicroBenchmarkImpl> benchmark_impl; |
| if (!(*it)->ProcessedForBenchmarkImpl()) { |
| benchmark_impl = (*it)->GetBenchmarkImpl(main_controller_task_runner_); |
| @@ -110,9 +100,9 @@ void MicroBenchmarkController::ScheduleImplBenchmarks( |
| } |
| void MicroBenchmarkController::DidUpdateLayers() { |
| - for (ScopedPtrVector<MicroBenchmark>::iterator it = benchmarks_.begin(); |
| - it != benchmarks_.end(); |
| - ++it) { |
| + for (std::vector<scoped_ptr<MicroBenchmark>>::iterator it = |
| + benchmarks_.begin(); |
| + it != benchmarks_.end(); ++it) { |
| if (!(*it)->IsDone()) |
| (*it)->DidUpdateLayers(host_); |
| } |
| @@ -122,7 +112,10 @@ void MicroBenchmarkController::DidUpdateLayers() { |
| void MicroBenchmarkController::CleanUpFinishedBenchmarks() { |
| benchmarks_.erase( |
| - benchmarks_.partition(std::not1(IsDonePredicate())), |
| + std::remove_if(benchmarks_.begin(), benchmarks_.end(), |
| + [](const scoped_ptr<MicroBenchmark>& benchmark) { |
| + return benchmark->IsDone(); |
|
danakj
2015/11/17 01:12:16
do you mean !IsDone?
vmpstr
2015/11/17 23:26:23
No, this should remove things that are done. The c
|
| + }), |
| benchmarks_.end()); |
| } |